Message Handler

Bot Message Handler

The Message Handler is invoked when the bot receives a message from the website visitor. The combination of messages we receive from the website visitor will be analysed and stored in the code(if the context handler is used) already, and the bot will respond to the visitors based on the question they receive from the available answers.

The attributes passed when a message handler is triggered are listed below:

InputsTypeDescription
messageMapDetails of the message in the conversation (Attribute: text)
visitorMapDetails of the website visitor
operationStringDetails of the operations happen during the chat conversation (Attribute: chat, message)

Message Handlers in Zoho SalesIQ - Bot

To embed the message handler script:

  • Navigate to Settings > Bots, click Add Bot.
  • Enter the name, description, choose website, departments and then select SalesIQ Script
  • Then, choose the Message Handler in the drop-down.
  • And then draft the script in the respective section, click Save and Publish.

Example of a Bot Message Handler

In this example, we have used a travel website called Zylker travels. And the bot acts as a travel assistant and guides the visitors visiting the website. Here, the Message handler will be invoked once the bot gets a reply from the visitor for the trigger initiated. So, the responses for the visitor message will be invoked.


response = Map();
if(operation.equals("chat"))
{
	// First question from the visitor
	response.put("action","reply");
	response.put("replies",{{"text":"Hi, this is Zyt."},{"text":" Can you please choose a price range for the travel plan?"}});
	response.put("input",{"type":"range-slider","values":{"500","1000","1500","2000"}});
	}
else if(operation.equals("message"))
{
	//msg = message.get("text");
    response.put("action","context");
	response.put("context_id","information");
	question1 = {"name":"info","replies":{{"text":" With what information I can assist you today? "}},"input":{"type":"select","options":{"Services","SpecialDeals","Packages"}}};
	questions = Collection();
	questions.insert(question1);
	response.put("questions",questions);
}
return response;

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohosalesiq.com