Zia with SalesIQ's Zobot

Zia with SalesIQ's Zobot

Zobot is Zoho SalesIQ's virtual chat agent that is designed to interact with website visitors conversationally. Zobot automates the process of interacting with website visitors and helps to maintain the presence of a helping hand, even when all the live agents are not available. The following sample use case demonstrates a realtime bot built on Zobot powered by Zia Skills platform.

Example scenario - Service appointment booking

Consider an imaginary company, Zylker Inc. which is a burgeoning local services marketplace. Zylker helps customers to hire professionals for various field services like housekeeping, vehicle maintenance, appliance repairs and so on. Once a customer schedules an appointment, Zylker assigns a field professional to complete the requested service.

In the current process of Zylker, to schedule a service appointment, customers have to chat with a live agent through the live chat option in Zylker's website (powered by Zoho SalesIQ).

Zylker's website with their live chat option.

 A typical conversation between an agent and a user trying to schedule an appointment would be like below.
However, the demand for Zylker's services have increased and it is challenging for them to manage the appointment requests through live chats, since it would require a lot of manpower, which would be expensive. Hence they plan to automate the appointment booking process using a bot using Zobot (powered by SalesIQ).

As inferred from the aforementioned conversation (between the agent and the user) the following details are required by Zylker from the user, to schedule a service appointment.
  1. Name of the customer
  2. Mobile number of the customer
  3. Address of the service location
  4. Category of service (Car wash, Painting, Cleaning etc.)
  5. Preferred date fo service
Thus, in order to create a service appointment, the bot has to prompt these details to the user, just like how an agent did in the live chat.

Creating a Zobot backed by Zia Skills

  1. Create a bot in SalesIQ ( under Settings -> Zobot ) for Zylker's website.
  2. Choose Zia Skills for the option 'Which platform would you like to use to develop your bot?'.
  3. In the next screen that appears, 'Zia's skill name' & 'description' would have been auto populated. You can change them if needed.
  4. Enter a valid 'Trigger Response' (bot's welcome message to the user) in JSON format and click CREATE. In this case, 
    1. {
    2.   "replies": [
    3.                       {
    4.                         "text" : "Welcome to Zylker services"
    5.                      }
    6.                  ]

The Zobot along with its associated Zia skill would have been created now. Conversational abilities can be added as actions to this bot from Zia skills console.

Modelling service appointment booking as an action

  1. Click Access Zia Skills Console on the top right corner to access the Zia skills console. It leads to the bot's details page.
  2. In the skill details page of Zia skills console, under Customize tab, click + ADD ACTION. The Create New Action page appears.

  3. Enter a meaningful 'Action Name', that reflects the purpose of this action - in this case, "Service appointment booking".
  4. For 'What should this action do?', choose Perform an operation, since this action carries out something on behalf of the user.
  5. Under 'How will this operation be invoked?', define the sample invoking sentences that users would say to invoke this action. For instance,
    I would like to schedule a service appointment
    Use the plus icon + besides the last entered text box to add further sentences. 
  6. Practically, people would include data as part of invoking instruction and hence sample sentences may also include certain param values. For instance, in this case, we can have a sample sentence as
  7. Book an appointment for painting 
    1. Here the user mentions the type of service needed (painting). It has to be marked as a param. Select the word "painting" and the NEW PARAM popup appears.
      1. Mention a meaningful 'Param Name'. In this case, 'servicename', since this param defines the type of service.
      2. Choose the appropriate 'Param Type'. In this case, String.
      3. Enter a relevant 'Prompt message', which would be displayed to the user to prompt this param, if the param value is not given in the invocation sentence. In this case,"Which service are you looking for? (Painting/ Cleaning/ Car wash/ Electrical works)". 
      4. Click ADD. The param appears in the PARAMS list.
  8. Similarly we shall add more meaningful sample sentences.
  9. I want to schedule a car wash on Monday.
    In this sentence mark car wash as 'servicename' param and mark Monday as a new param 'visitdate' of 'Param Type' Date with 'Prompt message' "What's your preferred date for the service?"
  10. Define the remaining params as follows using +NEW option in the PARAMS list.


    Remaining details required



    Param name



    Param type



    Prompt message


    Name of the customer
    name
    String
    May I have your good name, please?
    Mobile number of the customer
    mobile
    Number
    May i have your mobile number, please? 
    Address of the service location
    location
    String
    What is the address of service location? 

    Note that the params will be prompted to the user in the order mentioned under PARAMS list. We shall reorder the added params now to have a better contextual conversation. To reorder the param, click the param and place in the appropriate position.
    The appropriate order of params for this action are,
         i. name
        ii. mobile
       iii. location
       iv. servicename
        v. visitdate
  11. Click DONE. It displays the Configure Functions page as below.

    Functions are custom hooks written by action developers that are invoked by Zia during action execution at various points. The fulfilment or the actual business logic of the action is defined in the Execution functionIt is executed after all params are prompted and got from the user. It gives the final success (or failure) message to the user indicating the action completion.
  12. Click EDIT EXECUTION FUNCTION, that would fulfill the core business logic of the action. 
    The core business logic of this action is to store the appointment details in Zoho CRM and 
    give an appropriate reply message to the user. To store the prospect's information in Zoho CRM, this function should hit an authenticated API of Zoho CRM. To handle the authentication between Zia and Zoho CRM, we are using Deluge Connections. The API authentication scope to be used in the connection in ZohoCRM.modules.ALL.

    The function to be used as follows.
    1. result = Map();
    2. fields = Map();
    3. field = list();
    4. if(servicename != null)
    5. {
    6. name1 = zoho.currenttime.toLong() / 1000 % 10000;
    7. fields.put("Name","ZY-" + name1);
    8. fields.put("Customer",name);
    9. fields.put("Mobile",mobile);
    10. fields.put("Service_Location",location);
    11. fields.put("Service_Date",visitdate.toString("yyyy-MM-dd"));
    12. fields.put("Service_Type",servicename);
    13. field.add(fields);
    14. rec = Map();
    15. rec.put("data",field);
    16. crmResp = invokeurl
    17. [
    18. url :"https://www.zohoapis.com/crm/v2/Contacts"
    19. type :POST
    20. parameters:rec + ""
    21. connection:"service_appointments"
    22. ];
    23. // Returning the appointment from Zylker service centre
    24. image1 = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS3Nebcyht53UB2jobI7VeTyfHI8gj0QW76X_VnnlnkRj7ux11t";
    25. response = Map();
    26. response.put("action","reply");
    27. response.put("replies",{"Alright. \nI have scheduled an appointment for your " + servicename + " on " + " " + visitdate + ".\n The approximate cost would be around $15." + "\n",{"text":"Product Name :" + " " + servicename + "\n" + "Approximate Cost :" + " " + "$15","image":image1}});
    28. result.put("data",response);
    29. result.put("message","Your appointment has been successfully scheduled");
    30. }
    31. result.put("message","Your appointment has been successfully scheduled");
    32. return result;

  13. Click Save Script to save the code and click DONE on the top right corner to navigate to the Configure functions page. Click DONE to complete the new action creation and the new action's detail page appears.
  14. Go back to the skill's details page and click PUBLISH to move the action to production.
    The created action can be tested in the bot testing window in Zoho SalesIQ.

Thus this bot now can attend live chat from visitors and could schedule actual appointments without agent intervention. Embedding this bot into your website would take this bot to production.m

Additional Scenario - Validating user input

Furthermore, it arises that Zylker doesn't operate on weekends.  Hence this bot should be made not to accept appointment requests to service on these days. i.e. technically the Zobot has to validate the user's input for the param 'visitdate' and make sure that it dosen't fall on weekends. This is achieved through the Context handler functionContext handler function is used to control the conversational flow of an action. It can be used to do custom validations of the param values and change the order in which the params are prompted in runtime.
To enable the context handler function, in the configure

User input validation with Context Handler Function

  1. To enable the context handler function, in the Configure Functions page, click the Enable option under Context Handler Function. It displays a pop-up window for confirmation click OK
  2. It will be redirected to the function's page. the below logic will go as the Context Handler function for our requirement. 
    1. result = Map();
    2. // To enter after getting input for servicename param
    3. if(servicename != null)
    4. {
    5. if(visitdate != null)
    6. {
    7. getdate = visitdate.getDayOfWeek();
    8. // Enter only if visitdate param has value
    9. if(getdate == 7 || getdate == 1)
    10. {
    11. prompt = Map();
    12. prompt.put("param_name","visitdate");
    13. prompt.put("msg","Oops, We don't work on weekends, Please select another date.)");
    14. result.put("prompt",prompt);
    15. result.put("todo","prompt");
    16. return result;
    17. }
    18. }
    19. }
    20. result.put("todo","prompt");
    21. return result;

  3. Click Save Script to save the code and click DONE on the top right corner to navigate to the Configure functions page.
  4. Click DONE in Configure functions page to navigate to the action's detail page appears.
  5. Go back to the skill's details page and click PUBLISH to move the code changes to production.
    The created action can be tested in the bot testing window in Zoho SalesIQ.
The following screens show a typical conversation between this Zylker bot and a user trying to book a service appointment.



    • Related Articles

    • Zia - An Overview

      Zia is an AI-driven support assistant who makes your customer support team more effective through data mining and machine learning. She provides support agents with analyses, customer forecasting, alerts and suggestions through a pre-configured ...
    • Zia

      Zia is an AI-driven chatbot that streamlines your activities in Zoho Projects. Zia has a conversational interface where you can get immediate responses to your questions on tasks, issues, and events modules in Zoho Projects. Zia can also suggest or ...
    • Setting up SalesIQ Integration

      Zoho SalesIQ integration with Zoho CRM, also called as Visitor Tracking, allows you to engage with people visiting your website through chat and push their information into CRM. You can also embed a chat widget on your webpage and converse with the ...
    • Integrating Zoho SalesIQ with Drupal

      Get the power of tracking and live chatting into your Drupal site and connect with your visitor’s and support your customers in real time. Getting Zoho SalesIQ Code Snippet Login to your Zoho SalesIQ Operator console. Navigate to  Settings -> ...
    • Zia Voice

      Zia helps you to get instant answers for all your questions with respect to data in Zoho CRM. Zia provides a conversational interface where you can get your questions answered based on any module within Zoho CRM.  For example, say you are asked to ...