Let the Zobot dynamically display slots and fix appointments using Zoho Calendar!

Let the Zobot dynamically display slots and fix appointments using Zoho Calendar!


Calendars are a huge element in any business - be it small scale or big scale, an industry has requests and appointments coming in all around the year. If you own a business, you will know that a substantial amount of time gets wasted in scheduling. Staff get tied up manually with something as simple as setting up an appointment when they could be doing something more valuable.  Imagine if a bot could handle all the mundane stuff so that your staff is free to do more significant work? We have come up with one such Zobot that displays slots available on your Zoho Calendar dynamically and helps you block slots that don't clash with each other.  

Bot Requirements: 

  • A Zoho Calendar connection

How does this Zobot work? 

  • The Zobot triggers a welcome message when visitors land on the website.
  • It asks for the visitor's name and email address and then displays the list of slots available on your calendar. In case there are any previously blocked slots, the Zobot does not display those.

  1. response = Map();
  2. //Number of dates to display
  3. dateLimits = {"1","2","3","4","5","6","7","8","9","10"};
  4. //Static timeslots that will be initiatlly available for all days
  5. staticTimeSlots = {"10:00","12:00","15:00","17:00"};
  6. //Dates to exclude from the slots
  7. datesToExclude = {"02-04-2019"};
  8. //Days to exclude from the slots
  9. daysToExclude = {"Sunday","Saturday"};
  10. daynumbertowords = {"1":"Sunday","2":"Monday","3":"Tuesday","4":"Wednesday","5":"Thursday","6":"Friday","7":"Saturday"};
  11. monthWordToNumber = {"Jan":"01","Feb":"02","Mar":"03","Apr":"04","May":"05","Jun":"06","Jul":"07","Aug":"08","Sep":"09","Oct":"10","Nov":"11","Dec":"12"};
  12. cal = invokeurl
  13. [
  14. url :" https://www.zohoapis.com/crm/v2/Events "
  15. type :GET
  16. headers:{"Content-Type":"application/json"}
  17. connection:"zcal"
  18. ];
  19. filledSlots = {};
  20. for each  event in cal.get("items")
  21. {
  22. start = event.get("start");
  23. dateformat = start.get("dateTime").toList("T");
  24. dateunits = dateformat.get("0").toList("-");
  25. revampeddateformat = dateunits.get("2") + "-" + dateunits.get("1") + "-" + dateunits.get("0");
  26. revampeddatetimeformat = revampeddateformat + "T" + dateformat.get("1");
  27. datetime = revampeddatetimeformat.toList("+");
  28. filledSlots.insert(datetime.get("0"));
  29. }
  30. dateList = {};
  31. maxdatelimit = dateLimits.largest();
  32. for each  datelimit in dateLimits
  33. {
  34. nextdate = zoho.currentdate.addDay(datelimit);
  35. datesplit = nextdate.toList('-');
  36. scheduleDate = datesplit.get("0") + "-" + monthWordToNumber.get(datesplit.get("1")) + "-" + datesplit.get("2");
  37. dayInNumbers = scheduleDate.toDate().getDayOfWeek();
  38. dayInWords = daynumbertowords.get(dayInNumbers.toString());
  39. if(!daysToExclude.contains(dayInWords))
  40. {
  41. if(!datesToExclude.contains(scheduleDate))
  42. {
  43. dateList.insert(scheduleDate);
  44. }
  45. }
  46. }
  47. freeSlots = Map();
  48. for each  datelimit in dateList
  49. {
  50. dateSlotMap = {};
  51. for each  timeSlot in staticTimeSlots
  52. {
  53. scheduledDateTime = datelimit + "T" + timeSlot + ":00";
  54. if(!filledSlots.contains(scheduledDateTime))
  55. {
  56. dateSlotMap.insert(timeSlot);
  57. }
  58. if(!dateSlotMap.isEmpty())
  59. {
  60. freeSlots.put(datelimit,dateSlotMap);
  61. }
  62. }
  63. }
  • Following this, it saves the date on the Zoho Calendar when the visitor chooses a convenient slot.
  1. ' date = answers.get("slot_selected");
  2. meta = date.get("meta");
  3. displayslot = date.get("text").toList(" ");
  4. card_data = meta.get("card_data");
  5. slot = card_data.get("value").get("slot") + ":00";
  6. value = slot.toDateTime();
  7. display_time = value.toString("HH:mm");
  8. display_date = value.toString("dd-MM-yyy");
  9. _date = value.toString("dd-MM-yyy HH:mm:ss");
  10. info _date;
  11. timeString = {'StartDate':slot,"EndDate":slot,"sum":'Call with ' + name + "Email:" + email};
  12. apiresponse = zoho.calendar.createEvent("zillium.pboyle",timeString);
  • Finally, it sends a confirmation email to the visitor's email address with details about the appointment.

  1. sendmail
  2. [
  3. from :zoho.adminuserid
  4. to :" zillium.pboyle@gmail.com "
  5. subject :"Zoho SalesIQ | Demo Session"
  6. message :"<div>Dear Team,<br></div><div><br></div><div>Customer waiting for a time slot.<br></div><div><br></div><div>Name: " + name + "<br></div><div>Email address: " + email + "<br></div><div><br></div><div>Thanks,<br></div><div>Zylker Webmaster<br></div>"


Bot Flow:


                                                     
 

How to create this bot?

  • Navigate to Settings > Zobot > Create bot . Add a name, description, choose the website and preferred departments.
  • Set trigger criteria and enable business hours and operator handoff based on your requirements. 
  • Now, copy the code and paste it inside each of the three handlers- Trigger, Message and Context. 
  • Create a connection with your Zoho Calendar using Invoke URL. 
  • Save and Publish each handler separately and then publish the bot.  

Note:

Inside this Zobot, you can
  • Define the number of dates and dynamically display the list of slots available for appointments.    
  • Include static time slots for all days and also exclude dates that you do not want to display to visitors - like common holidays or organisation-specific holidays. Here, all Saturdays and Sundays are excluded to avoid meetings or appointments during weekends.  
  • Fix appointments and save them on your Zoho Calendar and also send a confirmation email to the visitor.
You can use the sample scripts attached if your use case is the same or you can use the functionality specific code snippets defined above based on your requirements.
To know more about the Zobot, please visit our  Resources Section

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




                              ご検討中の方