BeginDialogPacket[integer] is a WSTP packet that indicates the start of the Dialog subsession referenced by integer.
Launch a subsidiary Wolfram Language kernel process:
Read the first packet:
Write the packet representing the text to enter:
Read the BeginDialogPacket expression indicating the start of a dialog subsession:
Close the link: