Plug Sample #3: Zoho bookings integration plug for chatbots built with codeless bot builder

Plug Sample #3: Zoho bookings integration plug for chatbots built with codeless bot builder

Appointment scheduling is an essential process for any business, and we have Zoho Bookings to do it hassle-free. You can further automate the process using AI-powered chatbots, which can save a lot of time and act as an excellent tool to increase engagement with your website visitors. You can build such chatbots without writing a single line of code using our Codeless bot builder that has a drag-and-drop user interface. However, you can make your no-code bot unleash its full potential using Plugs.
 
Plugs in the Codeless bot platform help you create customized actions and third-party integrations by writing minimal code. Let's learn how to add a Zoho bookings plug for scheduling appointments.

What can this plug incorporate? 
The following plug can help you to incorporate an appointment scheduling option using Zoho bookings into your existing codeless bot flow.   
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:
    • Input Parameter 1 : name | Data Type  : String
    • Input Parameter 2 : email | Data Type  : Email
    • Input Parameter 3 : phone | Data Type  : Phone
    • Input Parameter 4 : datetime | Data Type  : Date and Time
    • Output Parameters : bookingid | Data Type : String
Note : To know how to fetch the operator's available slot, click here.


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 SalesIQ and 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. 
  1. response = Map();
  2. name = "";
  3. phone = "";
  4. email = "";
  5. datetime = "";
  6. //Change your service_id and staff_id
  7. service_id = "4302354000000026055";
  8. staff_id = "4302354000000026017";
  9. name = session.get("name").get("value");
  10. email = session.get("email").get("value");
  11. phone_number = session.get("phone").get("value");
  12. phoneList = phone.toList(" ");
  13. phone = phoneList.get(1);
  14. datetime = session.get("datetime").get("value").get("date_time");
  15. //Changing the date and time format
  16. parsedDate = datetime.toDateTime();
  17. dateAndTimesList = datetime.toList("T");
  18. parsedDateList = parsedDate.toString().toList(" ");
  19. changed_format_datetime = parsedDateList.get(0) + " " + dateAndTimesList.get(1) + ":00";
  20. //create bookings API
  21. customerDetails = Map();
  22. customerDetails.put("name",name);
  23. customerDetails.put("email",email);
  24. customerDetails.put("phone_number",phone);
  25. // "zohobookings" - connection name
  26. create_booking = zoho.bookings.createAppointment(service_id,changed_format_datetime,customerDetails,staff_id,"Asia/Calcutta",true,"zohobookings");
  27. bookingid = create_booking.get("response").get("returnvalue").get("booking_id");
  28. response = Map();
  29. response.put("bookingid",bookingid);
  30. return response;
  • Then, click Save , preview the plug and Publish it.
How to incorporate Plugs in Codeless bot?
  • 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 select the required Plug (Only published plugs will be listed here)
  • Provide the Plug inputs and outputs.
  • In this case, name, email, phone, date & time are stored in bot context and used as Plug inputs
  • The plug executes and returns the booking ID as output which is stored in bot context (booking.id) for displaying it to the visitors.
  • Click Save


Head's up:
  • If you have multiple services and staff, create similar plugs for each service and staff/operator and then associate them respectively in the codeless bot. 
  • For example, say you provide a service called Depression Therapy, Motivational Therapy and you have two staff for each therapy. 
  • Create plugs for each service id and staff id, and add them in the bots flow. 
    • Plug 1 - (Depression Therapy, Staff 1)
    • Plug 2 - (Depression Therapy, Staff 2)
    • Plug 3 - (Motivational Therapy, Staff 1)
    • Plug 4 - (Motivational Therapy, Staff 2)
  • Initially, display the services you provide to the visitors (In this case, depression and motivational therapy) using Button blocks.
  • Once the visitors select the service, then provide the staff available (Staff 1 and 2) and then add the respective plug in the bot' flow to schedule bookings.   
Related Links:
To know more about the features of Zobot, kindly visit our Resources Section

Regards, 
Sasidar Thandapani