Simple Script / ChatApp
Copied +55 (21) 960104492
Log In Free trial

Select a language

Simple Script

Let's put together a simple script in which the bot will:

1. Assign an operator depending on the client's needs;

2. Open a dialog in ChatApp Dialog;

3. Close the dialog by /closechat command;

4. Automatically close the dialog if the client stops responding;

5. Notify the client about his work schedule if he writes in non-working hours.

Setting up

1. Create a company and add employees in your ChatApp personal account.

2. Go to the "Bot" section and select the bot in which you want to use distribution. In the "Company" field, select the one to which the desired employees are linked.

3. In the "Line" field, select the one on which the bot will work.

Creating a script

1. Enter the script editor.

2. Create a "Send Message" box and enter a welcome message. The maximum message size is 200 characters.

Example message: 

Good afternoon, which department can I connect you to?

Write a number in your reply message.

1 - Support

2 - Accounting

3 - Sales

3. Create 3 "Reaction to Phrase" boxes and link them to the previous box. In the "Reaction on:" field, select "Inbox". 

4. In the "Key" field, type the word to which the bot will react. In our case, the keys will be the numbers 1, 2 and 3.

5. Create one more block "Send message". The message from this block will be sent if none of the keys work. Link it to the previous "Send Message" block.

For example: 

Sorry, I don't understand you.

Send a chat 1, 2 to chat 1, 2 or 3 to chat 3.

Please note: in order for the script not to end on this block, the outgoing arrow from the message must be linked to the start of the previous message block.

6. Add three "Assignment" blocks to the workspace and link them to the "Response to the Phrase" blocks 

7. Add employees to whom the dialogs will be assigned. How to do this is described in the article "Assignment". The "Execute immediately" slider should be enabled.

8. Create a block "Open a dialog" and connect it to all the " Assignment" blocks. Do this to notify the employee of an active chat.

9. Add the "Reaction to Phrase" and "Close Dialogue" blocks separately from the script. 

In the Phrase Response block, enter the /closechat key. Link the two blocks. The employee will now be able to close the dialog from the ChatApp Dialog.

10. Drag the "Dialog Auto Close" block to the workspace. Set a timer and add a message. The bot will close the dialog if the client does not respond within the specified time.

11. Create a block "Non-working hours". For instructions on how to set it up, see the "Non-working hours" article.

12. Name the script.

13. Click "Save and publish".

The bot is ready for work! - If you still have any questions watch our tutorial

Leave a request for integrator services