Schedule a call and push visitor data to Zoho CRM with Zobot!

Schedule a call and push visitor data to Zoho CRM with Zobot!

One of Zoho SalesIQ's huge milestones has been the Zobot that was designed to better website visitor interaction, to take over the place of the stereotypical bots and to become the do-gooder when all your operators are busy. This section will majorly focus on providing customers from different business streams with custom bot scripts that they can use for their websites. The post will throw light on a bot that was scripted on Deluge.

What integrations have been accommodated in this bot?

  • Google Calendar- to hold scheduled call dates
  • Zoho CRM- to record visitor details

The Scenario:

We need a bot that queries visitors about what they need help with, schedules calls and automatically records these on the  Google Calendar and also updates visitor details to  Zoho CRM at the end of every conversation.
To fulfil this, the following actions have to be performed:
  1. Configure options for the three different actions specified
  2. Create connections with Google Calendar and Zoho CRM
  3. Associate functions to perform these actions 

Handlers used:

The backbone of the Zobot is the Handler. Handlers are pre-defined responses to any specific actions/ messages in the bot. You can use them to customize the functionalities of the Zobot.

Trigger Handler:

This piece of code invokes a welcome message to the visitors from the Zobot, when they land on the website.

Message Handler:

When the visitor responds to the message triggered, the Message Handler is invoked. The combination of messages received from the website visitor will be analysed and stored in the context handler already, and the bot will respond to the visitors based on the questions received from the answers available.

Context Handler:

This handler can be used when visitors engage in conversations with the bot.  A context is a data definition for collecting multiple inputs to perform a single action. The conversation is mostly in a question-answer format, and can work in association with the message and trigger handlers i.e., the handlers can return a context instead of a message reply. So, all the inputs defined in the context will be collected and the context handler will be invoked. In that case, the context handler is a piece of SalesIQ script which is invoked after collecting all the inputs for a particular context.

What does this Zobot do?

The aforesaid bot was designed as such; it asks the visitor about what service they want to avail -  Enquiry, Support or Schedule a call and does the following in response to the actions chosen.
1. If the visitor chooses Zoho Enquiry or the Support option, it demands a bunch of details like the company size, customer name, email address and contact number.
2. When the email address is acquired, a welcome email is sent to the respective address saying that the visitor has been added to the mailing list.
3. Similarly, when all the required details are acquired, it asks the visitors if they want to schedule calls with representatives and when they agree, it schedules calls.
4. When the schedule a call option is chosen by visitors, it requests visitor details and then brings up a calendar along with preset times and lets them pick a slot according to their convenience. Then, the details about the scheduled call are saved to the integrated Google Calendar connection.
  1. /* Add event to google calendar */ 

  2. _date = value.getYear().toString() + "-" + value.getDay().toString() + "-" + value.getMonth().toString() + "T" + value.getHour().toString() + ":" + value.getMinutes().toString() + ":" + value.getSeconds().toString(); 

  3. paramMap={"start":{"dateTime":_date,"timeZone":"Asia/Kolkata"},"end":{"dateTime":_date,"timeZone":"Asia/Kolkata"},'summary':'Call with ' + name + '. Contact Number : ' + phone}; 

  4. apiresponse = invokeurl
  5.       [
  6.          url :" https://www.googleapis.com/calendar/v3/calendars/primary/events "
  7.          type :POST parameters:paramMap.toString()
  8.          headers:{'Content-type':'application/json;'}
  9.          connection:"your connection name"
  10.       ];
5. At the end of the action, all visitor details will be updated to the synced Zoho CRM account.
  1. /* Add data to Zoho CRM */ 

  2. crmdata = zoho.crm.searchRecords("Leads","(Email:equals:" + email + ")",0,0,Map(),"your CRM connection name"); 
  3. info crmdata;

  4.       if(!crmdata.isEmpty()) 
  5.          { // update existing
  6.                _crmdata = crmdata.get(0);   
  7.               info _crmdata; 
  8.               leadid = _crmdata.get("id"); 
  9.                crmdata = zoho.crm.update("Leads",leadid,{"Last_Name":name},Map(),"your CRM connection name"); 
  10.          } 

  11.        else
  12.         {
  13.           // create new lead
  14.           crmdata = zoho.crm.create("Leads",{"Email":email,"Last_Name":name},Map(),"your CRM connection name"); 
  15.         }

  16.         leadid = crmdata.get("id"); 
  17.         info leadid;
  18.         info apiresponse;

  19.        if(apiresponse.containsKey("status"))
  20.        { 
  21.           status=apiresponse.get("status"); 
  22.           if("confirmed".equalsIgnoreCase(status)) 
  23.            {
  24.             question = {"name":"thanks","replies":{"Thank you.","Your appointment has been scheduled with our Sales rep on " +    slot}}; 
  25.             response.put("questions",{question}); return response; 
  26.              } } 
  27.           question = {"name":"thanks","replies":{"Sorry, please try later"}}; 
  28.           response.put("questions",{question}); return response;
  29.       } 



Note:

I've used the code snippets specified above in the Context handler of the Zobot.
We've attached the full script for the bot, do give it a try on your website.
 
I hope this gave you deeper insights about how our Zobots work. 
You can learn how to construct your own Zobots and where to include handlers by heading to our  User Guide
 
Regards,
Michelle.

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      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 コンテンツ




                              ご検討中の方