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 a bot has opened a dialog, it will not be possible to close it in the standard manual way - via the button in ChatApp Dialog. For now, you will have to close the dialog using one of the methods given in this article.
Block "Closing the dialog"
This block closes the dialog and restarts the script. This means that if a client writes to the chat after the "Close Dialog" block has been triggered, the bot will start the conversation again from the starting block.
You can't start a script from it, the Block must come from another block.
"Close dialog" is placed at the end of the script and it is not possible to get the next block out of it.
How to close a dialog manually from a ChatApp Dialog
1. Create a "Reaction to Phrase" block separate from the main script branch.
2. In the "Reaction to phrase:" block, select "Outgoing".
3. In the "Key" field, enter the /closechat command. This command is not displayed in chat, but without creating such a script branch, the command will not work.
4. Create a "Close a dialog" block and bind it after "React to phrase".
Now the dialog will close when the operator sends the /closechat command to the chat.
Block "Dialog auto-close"
This block is mandatory and appears automatically when creating a script. The "Autoclose dialog" block exists separately from the main branch of the script. By default, the dialog will be reset to zero after 24 hours.
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 and restarted. Both a message from the client and a message from the bot are considered an activity.
After the dialog is closed, the bot can send a message to the client. To do this, select "Message" in the "Action" field and enter the text. The allowed message size is up to 200 characters.
If you still have questions, we have prepared a video tutorial on Blocks "Closing the dialog" and "Dialog auto-close.