Minecraft wiki entry for dialogue, associated text: dialogue open
Forces open the targeted NPC's dialogue box to the targeted player(s), simulating the experience of clicking on an NPC.
A targeted scene can also be indicated.
Syntax:
dialogue open <npc: target> <player: target> [sceneName: string]
Example: Open the dialogue of an NPC with tag "ducky" toward the nearest player showing scene "ducky_intro".
dialogue open @e[type=npc, tag=ducky] @p ducky_intro