Plug Sample #3: Part 2 - Fetch the operators' available slots in Zoho Bookings.
In
earlier post
we covered how to design a Codeless bot to schedule an appointment/meeting on Zoho Booking using Plugs. In this post we will learn how to create a plug to fetch the operator's available timings on the visitor's preferred date in Zoho Bookings. Therefore, when scheduling a meeting, the bot initially asks for a preferred date from the visitor and then displays the operator's available slots during that particular day. This helps your organization to manage your operator's schedules and eliminates the clash of bookings/meetings.
What can this plug do?
-
Gets the visitor's preferred date.
-
Display the agent's
available slots
(Zoho Bookings) on the preferred date.
How to Create this Plugs?
-
In your SalesIQ Dashboard, navigate to
Settings
>
Developers
> Plugs > Click on
Add
.
-
Provide your Plug a name, description, select the Platform as
SalesIQ Scripts
, and click on
Create Plug.
-
Click on Parameters, provide the following
1. Input Parameter 1 :
date
| Data Type :
Date
2. Output Parameters :
slots
| Data Type :
Number list
Create a connection with Zoho bookings.
-
Click on
Connection
at the left bottom. You will be redirected to the connection page.
-
Click on
Create connection
at the top right corner. Under
Default connection
, select
Zoho OAuth
.
-
Then, give your connection a name, connection link name and choose required scopes.
-
Click on Create And Connect. Upon successful authentication, Zoho Bookings will be connected.
Note:
The Connection Link Name will be used in scripts to invoke URL tasks.
-
Copy, paste the below code and make the required changes.
-
response = Map();
-
date = "";
-
date = session.get("date").get("value");
-
unixDate = date.toDate();
-
slots = List();
-
//Zoho Booking "Available Deluge task"
-
//Ref -
https://www.zoho.com/deluge/help/bookings/get-available-slots.html
-
//Replace your staff ID and service ID
-
available_slots = zoho.bookings.getAvailableSlots(4302354000000026055,4302354000000026017,date,"zohobookings");
-
slots_collect = available_slots.get("response").get("returnvalue").get("data");
-
for each slot in slots_collect
-
{
-
unixSlot = unixDate + " " + slot + ":00";
-
slots.add(unixSlot.unixEpoch("Asia/Calcutta"));
-
response.put("slots",slots);
-
info slots;
-
}
-
return response;
-
Then, click
Save
, preview the plug and
Publish
it.
-
Navigate to
Settings
>
Bot
>
Add
, provide the necessary information and select Codeless Bot as bot platform or open an existing bot.
-
Select the
Plugs
under Action Block and choose the required Plug (Only published plugs will be listed here)
-
Provide the Plug
inputs
and
outputs
.
-
In this case, the preferred date from the visitor is collected from the calendar block and stored in bot context (date.option) -
Plug input.
-
Once the plug is executed, it will return the available slots as
output
which is stored in bot context (slot.option).
-
Then use
Slots block
to display the available slots to the visitors. Provide the bot context as slots (plug output).
Related Links:
Regards,
Sasidar Thandapani
Zoho SalesIQ Resources
Zoho Pagesense Resources
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Desk Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.