There are two blocks in the script editor that can close a dialog. They are useful if you want the bot to automatically request feedback at the end of a dialog, or if you want to set a time after which the dialog closes if a client doesn’t respond to a message.
Important: If the bot has opened a dialog, you won't be able to manually close it using the standard method via the button in ChatApp Dialog. For now you can close the dialog using one of the methods given in this article.
Block "Closing the dialog"
This block closes the dialog and the bot can continue communicating with the client independently without distracting operators. It can’t be used to start a script. It must be followed after the other block.
The "Execute immediately" slider can be used to force it to run immediately after the previous one, or to wait for the client to respond.
If the operator enters /clearall
in The Single ChatApp Dialog window, the command will restart the bot again from the start block and will not display to the client.
How to close a dialog manually from a ChatApp Dialog
1. Create a "Response to the Phrase" block separately from the main script branch.
2. In the "Response to:" field, select "Outgoing".
3. In the "Key" field, enter the command /closechat
. This command is not displayed in the chat, but without creating such a script branch the command won't work.
4. Create a "Closing the dialog" block and connect it after "Reaction to the Phrase".
The dialog will be closed when the operator sends the /closechat
command to the chat.
Highlight
For the script to start over from the start block, it's not enough just to close the chat. You need the client to send the /clearall
command.
Add a "Sending Message" block at the end of the script with this information. For example: "Thank you for the review! To restart the bot, send the /clearall
command to the chat room”.
Block "Dialog auto-close"
This block exists separately from the main script branch. You set the time to close the dialog in the "Last activity:" field. When the time since the last activity expires, the dialog will be closed.
After closing the dialog, the bot can send a message to the client. To do this, select "Message" in the "Action" field and enter the text.
Watch our video tutorial about "Closing the dialog" and "Dialog auto-close" blocks or go to the next block - "Assignment".