A simple chatbot.
The difference with Echobot
is that here we allow the pre-chat form and FAQ to happen before the bot takes over the chat.
- Create a CrmScript folder named 'Echo2'.
- Place the 4 CrmScripts into the folder.
- The presence of a script named
...bot register...
signals the existence of a chatbot in the folder. - Go to the Chat admin and open a chat topic.
- Go to the Chatbot tab and enable the chatbot.
- Choose the "Echo2" folder from the list, and name the chatbot.
- Save the chat topic.
When the chat channel (aka topic) is configured and saved, the ...bot register...
script is called.
The CrmScript folder is scanned for additional scripts, and the ones with recognized names are noted.
The ...bot session created...
script is called. This happens before the FAQ or pre-chat forms are shown. The initial state of the session
depends on the options configured on the topic.
The echobot2 checks to see if we have gone straight to the queue - which means there is no pre-chat form or FAQ configured.
When the session changes state to 4 (in-queue) - then the pre-chat form and faq are done. This is the point where a bot can start talking to the user.
When the user posts a message to the channel, and the bot is active, then the script called
...bot message received...
is called.
If the session has not yet reached the queue state, then the bot must ignore its input. Let the default processing handle the message.