Mark from Uchat built an chatbot automation that checks Calendly booking of a user and gives them the booking details if an appointment is found in Free Calendly account. It is not a complex workflow but for beginners it can feel a bit intimidating. Here is the explanation on how to correctly set this automation.
It is probably the easiest step in the whole process.
You just have to go to the dashboard of your uchat workspace and go to integrations. Find 'Calendly' among the list and simply follow the instructions. If you're already logged into Calendly account, it will simply get integrated in under a minute.
Once the integration is done, you will be able to use all the Calendly integrations available within uchat.
So let's quickly look at how this chatbot automation works.
It has two major steps. In the first step( Flow ) you create a button and connect with Calendly so that a contact can make a booking.
And in the second step, you check your Calendly account with the user email to see if there are any bookings made by this user. If a booking is found, the appointment details will be shared with user. If not, we will ask the user to make another booking or we get help from a Live agent to sort out the issue.
So lets get into the details now.
Making a calendly appointment on uchat is as easy as creating a button and connecting it to Calendly integration.
First create a message with a button
Give the button a name as "Book an appointment" or anything that you like.
Click on the button settings and connect it with Calendly from "When this button is pressed" options.
If you have integrated your Calendly account correctly, it will then give all your available Calendly events to choose from. Just select the one you want the booking to be made from the dropdown options.
Once Calendly appointment booking step is done, the user has to go to the next flow - the appointment checking flow. This is the flow where we check the bookings in your free calendly account for events booked under a specific user email.
So the flow works something like this..
A user is checked against a tag that signified booking status. If the tag is found, user is taken to booking confirmation details block.
If tag is not found, we go through your calendly events details multiple times over the period of 2 minutes looking for appointment details. This is achieved by using a counter and conditional blocks.
If an event is found within this 2 minutes time, a confirmation message will be shown to user.
If event is not found within this time, we will either ask them to book again or to see if the user used a different email to book the appointment.
If the user used a different email, we will then do a quick check against this new email to see to if a booking is found. If found, confirmation will be given, if not, there could be some error and we will transfer them to a Live agent for troubleshooting.
So that is the overview. Now lets see how to implement this.
Some custom fields and tags are required to achieve this automation.
Name | Type | Description |
calendly_appointment_check_counter | Number | Counter to track |
calendly_organisation_url | Text | To save org url |
calendly_user_url | Text | To save user url |
calendly_event_count | Number | To save event count |
calendly_event_name | Text | To save event name |
calendly_meet_start_time | Date Time | To save starting time |
calendly_event_url | Text | To save event url |
calendly_loc_url | Text | To save zoom link etc |
calendly_resch_url | Text | To save reschedule link |
calendly_canc_url | Text | To save cancellation link |
[event] Calendly booked appointment | Tag | To track booking |
You can either create these custom fields all at once or whenever you need them as you reach each steps.
As soon as the user enters this flow, we check for "[event] Calendly booked appointment" tag. If the user has already made a booking and has gone through the automation, we don't want them to go through it all over again.
If this tag is found, we simply grab their appointment details from Calendly and show them the confirmation message. This is done via a condition block and the condition is "Has a Tag"
In most cases it will be a new user and the condition will fail. So in most cases, the user will be taken to the next condition block to check for the counter we have set up using the custom field "calendly_appointment_check_counter"
When we are creating this custom field, the initial value will be set as 0.
The condition block checks if the value of this counter is equal to or greater than 4.
Why specifically 4, will be explained in the coming steps.
Since initially the counter value is 0 and less than 4, the False step will get executed. This will take the user to the next action step as shown below
In this action step we have a smart delay and an increment operator.
The smart delay is set for 30 seconds. So as a user enters this block, the user will stay there for 30 seconds. And after that, the second action in the same block gets activated, which is to increment the value of the counter and store it back to the custom field.
So after 3 seconds the value of counter calendly_appointment_check_counter becomes 1.
And then the user data will be passed to the next step which is getting user data from Calendly.
In this step, we grab our Calendly details such as Organisational and User url and store the value to custom fields that we have created (or going to create)
In order to do this, you have to add an action step and select Calendly from integrations.
Then select "Get Current user" and click 'Test Request'.
This will give you the json path corresponding to organisational and user url. You just have to save the json path to the custom fields.
This custom field values will be used in the next step.
Note : The user and organisation mentioned in this step are referring to you - the owner of the calendly account. Don't get confused with your chatbot visitor.
Next step is to search for the scheduled events in your account matched against the email address of the user.
In order to search for the details, this action step needs organisation, user url and email address of the contact.
You might have already collected the email of your user in one of the earlier steps or flows and this value will be stored in 'Email' user field.
You need to get test values from previous action step and add it on the right hand side in order to run the test. When you run the test, you can click on the json variables and create the json path needed for rest of the custom field values that you'll require in this step.
When you click test results, you will get the sample data. When you click on the sample data, you will get the json path, which then you can assign to a custom field.
The important custom fields that we want from this step are 'calendly_event_count' and 'calendly_event_url'
Other custom fields will come in handy when we need to display the meeting details.
Now we will see why 'calendly_event_count' is an important variable.
When you scroll down through the sample data, you will see something called as pagination.
If there is one event, a pagination count will be created to represent page 1 of the events. But if there are no events associated with a user, the pagination count will be zero.
So as long as the pagination count is 0, it means there are no events associated with a user. But instead if the event is anything but zero, there is an event.
So if we check the value of pagination count, we will get an idea if an event is created under someone's email or not and that is exactly what we are going to do in the next step.
Pagination value is stored at 'calendly_event_count' and if it is 0, no event is found, if it is NOT zero, then even IS found.
If the event count is 0 and event is not found, we will go back to the first step again do all these process all over again.
When counter == 4, then we send the user a message to check if they actually made a booking within this 2 minutes. There can be two situations here.
If it is the first case and they didn't book yet, we will ask them to book again using Calendly booking button.
If they click that. we will then Reset their counter and send them to the first step to do the checking loop. We are resetting the value because, at this point their counter value is already 4 and if we don't reset it, when they go back to the loop, immediately the condition to check the counter will be turn to be True (Greater than or equal to 4) and send them a message to book again and it will become an endless loop. Hence we reset the counter and send to the first step.
This could happen mainly due to one reason. They gave a different email and booked using another email.
If that is the case, we ask them to share the email they booked with and we run our calendly checking to see if pagination count connected with that email is zero or not.
If we can't locate the Calendly booking even with the updated email address there could be something wrong somewhere. This is the point we bring the backup and get the Live Agent's support.
We do this by pausing the automation and sending the live agent notification.
Now it is time for us to go back and see what happens when we actually finds the Calendly booking.
When the pagination count becomes non-zero, we say that we found an event.
When that happens, we need to go into calendly again and get the necessary details to give the user a better User experience. We do that by creating an action step with Calendly integration.
We need to give the event url connected with booking and fetch links to Reschedule and cancel the event.
In order to get these links, we have to input the Event uuid which we have saved earlier to calendly_event_url custom field. When you add the actual link you got from eariler steps on the right hand side field and click 'test request' you will get json paths for cancellation and reschedule links.
Once we have these details, we can include them in the confirmation message.
That is all about this Calendly appointment checking. Hope this helps you to understand uchat - Calendly automatic appointment checking chatbot.
In case you want to show the meeting starting time on your confirmation message, you can very well use the calendly provided time stamp. But it is not well formatted.
In that situation all you have to do is use the 'Select' option
You can 'Select' Calendly attributes and apply formatting.
Once you select the element you want to format with, click on the format value dropdown.
Then select the formating that suits your requirement and click save. You will have a formatted date time value on your confirmation message.
There is a short video showing the same points if you'd like to see how it is done on uchat platform.
If you have any questions, or if you know a better way to do it, please let me know in the comments.