Cliq Bots - Let your bot welcome it's subscribers via the welcome handler

Cliq Bots - Let your bot welcome it's subscribers via the welcome handler

In this post, we're going to shed light on how important it is for a bot to greet subscribers with a welcome message. We'll also be looking at how to configure a simple yet effective welcome handler! 

A welcome message is the first and the most important action / interaction performed by your bot. But why is it so important? 
  • A message that explains the user what the bot does will provide them with a concrete understanding of how the bot can help them. 
  • Including a call to action, such an instant button in the message will show the user how easy it is to interact with the bot.
Working of the bot welcome handler 

The bot welcome handler will be triggered to send a message when a user subscribes to a bot. Another interesting fact is that, the handler can also send a message to a user if they unsubscribe and subscribe to the bot again! There are a list of attributes passed when a welcome handler is triggered. Take a look at them in our welcome handler help page. 

Sample Scenario

Let us try to build a conference bot with a welcome message explaining the user on what the bot does and a call to action. Assuming the conference has a hackathon event where participants are encouraged to build applications. The welcome handler should serve the following purposes : 

  • The welcome message will explain all the necessary details- about the verticals available, how to get started with their application, so on and so forth. 
  • A call to action for the user to select their choice of vertical under which they can submit the application. 
  • Each entry from the user will be added to the creator form to maintain a record.
Sample Welcome Handler Code

  1. response = Map();
  2. response = {"text":" Hey *" + user.get("first_name") + "* !​ \n Welcome to ZylCal Developers Conference -2017 and thank you for subscribing! I'm here to help you with the following : \n ​​  Session Timings \n ​  Session Overview \n ​​  Feedback \n ​​  ZylCal Hackathon \n Click on any of the buttons know more about the respective topics! [+Sessions](invoke.function|conference|li.jung@zylker.com|session-1)  [+Hackathon](invoke.function|conference|li.jung@zylker.com|hack-2)"};
  3. return response;

Sample Functions Execution Code

  1. response = Map();
  2. message = Map();
  3. button_name = target.get("name");
  4. key = arguments.get("key");
  5. // details = zoho.creator.getRecords("<app_creator_name>","<application_name>","<form_name>","<condition>",1,1,"<insert_connection_name> ", <user_access>);

  6. details = zoho.creator.getRecords("lijungdeveloper","test","Sessions_Report","ID1 == 100",1,1," <insert_connection_name> ",true);
  7. if(key.matches("session-1"))
  8. {
  9. overview = details.toMap().get("Session_Overview");
  10. feedback = details.toMap().get("Feedback");
  11. response = {"text":" Please refer the session information (Details, Timings) from here! \n Session Overview: " + overview + " \n Feedback: " + feedback,"bot":{"name":"ZylCal Conf Bot","image":" <insert_bot_image_url> "}};
  12. }
  13. else if(key.matches("hack-2"))
  14. {
  15. response = {"text":"The hackathon event involves developing applications under any of these categories. Select any category to register with your name and email ID. \n [+Productivity](invoke.function|conference|li.jung@zylker.com|101)  [+IT-Admin](invoke.function|conference|li.jung@zylker.com|102) [+Entertainment](invoke.function|conference|li.jung@zylker.com|103)","bot":{"name":"ZylCal Conf Bot","image":" <insert_bot_image_url> "}};
  16. }
  17. else if(key.matches("101"))
  18. {
  19. dataMap = {"Resp":target.get("name"),"zuid":user.get("email")};
  20. record = zoho.creator.createRecord("lijungdeveloper","test","Hackathon",dataMap,"zohocreator2",true);
  21. response = {"text":"Awesome! Your name has been registered under the *" + target.get("name") + "* category! All the best. :grinning:","bot":{"name":"ZylCal Conf Bot","image":" <insert_bot_image_url> "}};
  22. }
  23. else if(key.matches("102"))
  24. {
  25. dataMap = {"Resp":target.get("name"),"zuid":user.get("email")};
  26. record = zoho.creator.createRecord("lijungdeveloper","test","Hackathon",dataMap,"zohocreator2",true);
  27. response = {"text":"Awesome! Your name has been registered under the *" + target.get("name") + "* category! All the best. :grinning:","bot":{"name":"ZylCal Conf Bot","image":" <insert_bot_image_url> "}};
  28. }
  29. else if(key.matches("103"))
  30. {
  31. dataMap = {"Resp":target.get("name"),"zuid":user.get("email")};
  32. record = zoho.creator.createRecord("lijungdeveloper","test","Hackathon",dataMap,"zohocreator2",true);
  33. response = {"text":"Awesome! Your name has been registered under the *" + target.get("name") + "* category! All the best. :grinning:","bot":{"name":"ZylCal Conf Bot","image":" <insert_bot_image_url> "}};
  34. }
  35. else
  36. {
  37. response = {"text":"I can only help you with these right now! To know any other information please contact support@zylcal.com"};
  38. }
  39. post = zoho.cliq.postToChat(chat.get("id"),response);
  40. return message;


The slide show below will give a better understanding of the sample execution!




The welcome handler sets an opening tone to the bot and also establishes a connection between the user and the bot. Try using this sample code snippet and let us know what you think! Comments and suggestions are welcome. 


Few useful links:




Best,
Manasa
Cliq
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      • Sticky Posts

      • Convert a message on Cliq into a task on Zoho Connect

        Message actions in Cliq are a great way to transform messages in a conversation into actionable work items. In this post, we'll see how to build a custom message action that'll let you add a message as a task to board on Zoho Connect. If you haven't created
      • Cliq Bots - Post message to a bot using the command line!

        If you had read our post on how to post a message to a channel in a simple one-line command, then this sure is a piece of cake for you guys! For those of you, who are reading this for the first time, don't worry! Just read on. This post is all about how
      • Cliq Bots - How to make a bot respond to your messages?

        Bots are just like your buddies with whom you can interact. They carry out your tasks, keep you notified about your to-dos and come in handy when you need constant updates from a third party application.  So, how can you make your bot respond to a message? The bot message handler is a piece of code triggered when a message is sent to the bot. Message handlers help you customise your bot responses to make it look conversational. The message input from the user can be either a string or an option selected
      • Cliq Bots - Get notifications about any action on an application with the incoming webhook handler!

        Webhooks can be used to get notified about events happening in other applications inside Cliq. All bots in Cliq have their own incoming webhook endpoint. This makes it simple to post messages to the bot from external applications. Unlike the send message
      • The Slash Command Series - Types of Command Suggestions

        Hi Everybody! I hope you guys tried the /zdocs command and now have an idea of how command suggestions with click to execute work. If you have no clue of what command suggestion is, I recommend you to take a look at all the Slash Command Series posts, especially the one on Command Suggestions ! This post is all about the different types of command suggestions.  Customise your command suggestions  Did you know you could customise your command suggestion list with a title, description, image? Well,

      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方