In this tutorial, we will use The Bot Platform, Google Calendar and Make(formerly Integromat) to create a resource booking bot.
Step 1 - Building the bot
First we need to create a bot on The Bot Platform that collects the date, the time the resource is needed from and the time it will be returned. You will want to collect these variables in attributes in the platform. In your last message, you will need to include a webhook.
Step 2 - Setting up a calendar in Google Calendar
Creating a calendar for your resource is really easy. You want to click the + sign at the bottom left and select create a calendar.
Step 3 - Building the Booking Process in Make(formerly Integromat)
Our scenario in Make(formerly Integromat) takes the requested booking times from the user via the bot, checks to see if the resource is available at that time and if it is, books the resource and returns a message to the user. If it is already booked, then another message is returned to the user telling them it is booked and asking them if they wish to try another date and time.
First create a new webhook and paste this into the webhook message within the Bot Platform. Run the scenario and test your bot within the bot platform. You should see it pulls through your variables.
We now need to add in a module that gets events from your newly created Google Calendar. Connect your Make(formerly Integromat) to Google and in the calendar box, select the resource calendar you have created. It is really important that you check the box next to the option Continue the execution of the route if no results are found, or else your scenario will stop running when there are no bookings already in the calendar. In your start date, you want to use the start date field pulled through from your webhook and the time they want it to start.
In the end date, put the end date and the end time. When complete, your set up should look as follows:
We now need to add a router step to allow us to follow a route for when the resource is available and when it is booked.
We will start with when it is available. Add a create an event in Google Calendar module. You want to create an event in your new calendar. Use the start date and time and end date and time variables to populate these fields in your new event. For the event name you can use the Firstname and Lastname pulled through from your webhook to ensure you know who has booked the resource at that time, as shown below.
Now we need to add a webhook response to inform the user that their booking is complete. Add in a webhook response using the Github documentation. Your response text can contain any message you want. Here is ours.
Now we need to add a filter to this route to ensure it only runs when there is no other booking at that time. Set up a filter that checks to see if any events have been pulled back from the calendar when searching. You can do this by using Event ID does not exist.
Now we need to add in a flow for when the resource is booked. Add a filter to this row that is only triggered when Event ID does exist.
Now you want to add a webhook response that sends a preset message to the user as follows:
Set up a new message within the Bot Platform that you can send in this situation. Here is our example:
Now you have a resource booking bot set up and ready to go. You can extend this bot to check multiple calendars if you wish to use it as a room booking tool. You just need to use separate calendars for each room.
Updated 7 months ago