Bot Welcome Handler

Bot Welcome Handler

A welcome handler can be used to trigger a custom message, when the user subscribes to a bot. You can also configure a welcome handler to post a custom message when a user unsubscribes a bot and subscribes again. The list of attributes passed when this welcome handler is triggered are:

Attribute NameDescription
userDetails of the user subscribing to the bot for the first time.
newuserAttribute of the type boolean, to confirm if the user subscribing is a new user.

Example:

A sample syntax is given below, where the newuser attribute of the data type boolean, will ensure that a user subscribing to the bot receives a welcome message different from the user who re-subscribes to the bot!  The user attribute of the type Map will store the details of the user and can be used to get the user's first name, to make the message look more personalized.



// Sample Syntax For Bot Welcome Handler

response=Map();
if(newuser)
{
  response.put("text","Hey *" + user.get("first_name") + "* ! Thank you for subscribing! Click the *Actions* option in the bottom right corner of the chat window, and choose *Know Cliq Help Bot* to know more about me. Trust me, I am interesting! :wink: ");
}
else
{
  response.put("text","I guess you missed me! :smirk: Anyhoo, thanks for subscribing back.");
}
return response;

 

The image illustrates the Cliq Help Bot's welcome handler triggered to send a message to a user, subscribing for the first time.

The Cliq Help Bot's welcome handler message, when a user unsubscribes to the bot and subscribes again. 

Share this post : FacebookTwitter

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

Write to us: support@zohocliq.com