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.
- response = Map();
- //Number of dates to display
- dateLimits = {"1","2","3","4","5","6","7","8","9","10"};
- //Static timeslots that will be initiatlly available for all days
- staticTimeSlots = {"10:00","12:00","15:00","17:00"};
- //Dates to exclude from the slots
- datesToExclude = {"02-04-2019"};
- //Days to exclude from the slots
- daysToExclude = {"Sunday","Saturday"};
- daynumbertowords = {"1":"Sunday","2":"Monday","3":"Tuesday","4":"Wednesday","5":"Thursday","6":"Friday","7":"Saturday"};
- 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"};
- cal = invokeurl
- [
- url :" https://www.zohoapis.com/crm/v2/Events "
- type :GET
- headers:{"Content-Type":"application/json"}
- connection:"zcal"
- ];
- filledSlots = {};
- for each event in cal.get("items")
- {
- start = event.get("start");
- dateformat = start.get("dateTime").toList("T");
- dateunits = dateformat.get("0").toList("-");
- revampeddateformat = dateunits.get("2") + "-" + dateunits.get("1") + "-" + dateunits.get("0");
- revampeddatetimeformat = revampeddateformat + "T" + dateformat.get("1");
- datetime = revampeddatetimeformat.toList("+");
- filledSlots.insert(datetime.get("0"));
- }
- dateList = {};
- maxdatelimit = dateLimits.largest();
- for each datelimit in dateLimits
- {
- nextdate = zoho.currentdate.addDay(datelimit);
- datesplit = nextdate.toList('-');
- scheduleDate = datesplit.get("0") + "-" + monthWordToNumber.get(datesplit.get("1")) + "-" + datesplit.get("2");
- dayInNumbers = scheduleDate.toDate().getDayOfWeek();
- dayInWords = daynumbertowords.get(dayInNumbers.toString());
- if(!daysToExclude.contains(dayInWords))
- {
- if(!datesToExclude.contains(scheduleDate))
- {
- dateList.insert(scheduleDate);
- }
- }
- }
- freeSlots = Map();
- for each datelimit in dateList
- {
- dateSlotMap = {};
- for each timeSlot in staticTimeSlots
- {
- scheduledDateTime = datelimit + "T" + timeSlot + ":00";
- if(!filledSlots.contains(scheduledDateTime))
- {
- dateSlotMap.insert(timeSlot);
- }
- if(!dateSlotMap.isEmpty())
- {
- freeSlots.put(datelimit,dateSlotMap);
- }
- }
- }
- Following this, it saves the date on the Zoho Calendar when the visitor chooses a convenient slot.
- ' date = answers.get("slot_selected");
- meta = date.get("meta");
- displayslot = date.get("text").toList(" ");
- card_data = meta.get("card_data");
- slot = card_data.get("value").get("slot") + ":00";
- value = slot.toDateTime();
- display_time = value.toString("HH:mm");
- display_date = value.toString("dd-MM-yyy");
- _date = value.toString("dd-MM-yyy HH:mm:ss");
- info _date;
- timeString = {'StartDate':slot,"EndDate":slot,"sum":'Call with ' + name + "Email:" + email};
- apiresponse = zoho.calendar.createEvent("zillium.pboyle",timeString);
- Finally, it sends a confirmation email to the visitor's email address with details about the appointment.
- sendmail
- [
- from :zoho.adminuserid
- to :" zillium.pboyle@gmail.com "
- subject :"Zoho SalesIQ | Demo Session"
- 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.
Regards,
Michelle.
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
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
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.