Bot Message Received
This script is called when a user sends a new message to the bot - not called when the bot posts messages. Called after the generic ChatBeforeSaveNewMessage and ChatAfterSaveNewMessage triggers have run. The bot can respond usingaddChatMessage(sessionId, message, type, author, specialType, specialParams, whenPosted) to add more messages to the chat.
Use type = 1 to indicate that the message is sent from bot to customer. You can use the whenPosted parameter to space out the bot replies to make them seem less robotic.
Some of the input values:
chatSession.topicIdchatSession.status- pre-chat form, in-queue, user message, etcchatMessage.sessionIdchatMessage.idchatMessage.message- what the customer typedchatMessage.type- 2 = from the customer, or 3 = specialchatMessage.specialType- if type = 3chatMessage.specialParam- if type = 3 - json containing optionschatMessage.author- name shown in chatchatTopic.idchatTopic.botName
- All CRMScript triggers defined for the Chat Message Received event are run.
- Webhooks for chatSession.message are dispatched.