How chatbots can take reservations with Dialogflow and Google Sheets

How to build a Messenger chatbot to take reservations.

Josh Barkin
Being Janis

--

If you like this story, consider taking my Dialogflow Course.

As local businesses push to re-open in the wake of COVID-19, it’s critical to ensure the virus doesn’t gain momentum by continuing to practice social distancing. For every business with a physical location, managing capacity is critical to social distancing.

Social Distancing = Human Capacity Management

Most local businesses never needed a booking system before the pandemic, but businesses in many parts of the world are currently mandated to operate well below 100% capacity in order to ensure social distancing. Waiting in line wearing masks to get in the door isn’t the best customer experience.

Every business with a physical location needs to balance safety with a need to generate revenue. This reservation system wasn’t designed to be a robust system like the one Open Table provides restaurants. It’s less formal and more practical, with reservations not extending well into the future, but on a rolling 7-day basis. It enables a business to more easily manage customer relations in the current local business environment. Most importantly, it can be set up in minutes and help a business immediately.

Who can benefit from this?

Here is a quick shortlist of business that I think will benefit:

✅ Restaurants need to manage capacity
✅ Hotels need to manage capacity
✅ Hair salons and spas need to manage capacity
✅ Gyms need to manage capacity
✅ Local parks and pools need to manage capacity
✅ Any office or co-working space needs to manage capacity
✅ Real Estate open houses need to manage capacity
✅ Car showrooms need to manage capacity
✅ Coffee Shops need to manage capacity

OK… everyone needs to manage capacity in the age of COVID!

Getting Started

In addition to a Google account for Google Sheets, here is what you’ll need to get started:

1. A Manychat bot for Messenger with a Manychat Pro account

2. An Integromat account — Integromat will send data to the Google Sheet from Manychat and get data back from the Google Sheet.

3. (Optional) A Dialogflow account so you can understand messages and complete bookings faster. It’s not essential but makes this use-case far better.

Step 1: Get The Google Sheet template

👉 Make a copy of this Google Sheet template.

Open the Google Sheet and click the green Share button in the top right corner and change the share settings so that Anyone on the Internet with this link can view.

You don’t need to copy the link. We’ll come back to the Google Sheet after.

Step 2: Get The Integromat Blueprints

This Integromat Blueprints (templates) can be configured in a few minutes and they will be used to communicate with the Google Sheet using data you collect through your Messenger bot.

👉 Download the Integromat Blueprints

Step 3: Install the Integromat Blueprints

Login to Integromat account and click Create a new scenario

Now instead of picking applications for your scenario, click the Skip button.

Let’s give this Scenario a name. If you click in the top left corner you’ll see how you can give it a name.

You can see here, that I’ve named the scenario ReservationKit but you can give it any name you want.

Scroll to the bottom and click Save.

Now at the bottom of your screen, click the 3 dots to trigger the “More” menu and then select Import Blueprint

Now let’s import one of the Integromat Blueprints. Unzip the file you downloaded with the Blueprints and you’ll see two JSON files in a folder.

Select the Make a Reservation — Advanced Version.json file, then click the blue Save button to upload the Blueprint.

Now you’ll see the Blueprint. You can zoom in to the first module on the far left. It’s the Manychat module that will watch for incoming data.

Click the module and you’ll need to add a Webhook.

If you’ve never used Integromat with Manychat before. then click here to see how to create a connection using your Manychat API token. I already have a connection so I can now create a Webhook.

If you want to add a webhook click the Add button. Name your Webhook Reservations and select your Manychat connection. Then click Save. You can see that the Webhook has been added.

Now go to all the other blue Manychat modules in the Blueprint and select the same connection for every module. There are a lot of Manychat modules, so it will take you a few minutes to go through all of them.

Keep going… there are a lot of them! Use the same Connection for every one.

Now you’ll need to connect the Google Sheet modules to a Google Sheet template. Click any green Google Sheet module icon

You’ll need to add a connection, so if you’ve connected Google Sheets before to Integromat, select the Connection name from the list. If you haven’t connected Integromat to Google Sheets yet, click the Add button and give your Connection a name, then click Continue and give Google permission to share data with Integromat.

Once you’ve selected your connection, make sure the reservations template is selected.

There are a lot of Google Sheet modules here too, so select your Connection for each one referring to the same Reservations Template file. Do it for each module. When you select your connection, give Integromat a few seconds to load the fields in the form, then click OK.

Once you’ve connected all of the Manychat modules and all of the Google Sheet modules, click the Save button at the bottom of your screen. If you’ve added all your Google Sheet and Manychat connections for each module, it will save!

Make sure to turn on scheduling and set the scenario to run immediately.

Now that you’ve created the ReservationKit scenario and saved it, there is one other scenario you’re going to want to add.

Click the Scenarios button in the left navigation to get to your scenarios list. You’re going to repeat the process you did for the first scenario. Click Create a new scenario, click Skip since you’re going to import a Blueprint.

You can name this scenario “ReservationKit-2”.

At the bottom of your screen, click the 3 dots to trigger the “More” menu and then select Import Blueprint

Now let’s import ReservationKit — Clear Yesterday’s Reservation Data.json

Click the first module in the Blueprint and select your connection. You’ll need to give Integromat extended permissions, so do that.

Click the second module. You’re now going to need to add your Google Sheet ID (it’s in the URL) to the second Google Sheets module.

You can get the spreadsheet ID from the URL of your Google Sheet.

This Scenario can run at a longer interval. Its purpose is to re-set data on a rolling basis. Make sure you turn on scheduling, then click the clock and run the scenario once a day. I set mine to 8am but anytime after midnight should be fine.

Click Save!

If you return to your Scenarios in the navigation, you should have both ReservationKit and ReservationKit-2 set up and turned on.

If you want to change the way data appears in the Google Sheet, you can edit the layout in the Tools module in your ReservationKit scenario.

Step 4: Install the Manychat Template

Let’s now install a Manychat template that will communicate with Google Sheets through Integromat.

👉 Click to install this Manychat template

If you go to your Settings in Manychat and if you look at the Bot Fields in your Manychat settings you’ll see this:

Both the Google Sheets template and the Manychat template are customizable. Make sure the interval between the times in the Google Sheet column headers is set in your ManyChat Bot field Janis-reservation-interval.

What you see in your Bot Fields should match what you have in the Google Sheet. You can see that both the Bot Field value for the earliest time is 5:00pm both in the Bot Field and as the first blue column header in the worksheets, and if you scroll over to the far right you’ll see the last Google Sheet column header is 10:00pm

Go through the request Request Type column and define your spaces. You’ll want to have a number of small spaces that limit the number of people per space and so that the total capacity is equal to the total number of people you’ll accommodate for any of the time periods. A request for space can be anything — A table at a restaurant, a room, or it could even be just a designated area in your space. For example, if you manage space on a beach, you may have capacity limited spaces within the beach area you serve.

You can set things up in the “Monday” worksheet, and then just copy all of the cells to the other worksheets and for each day.

Important

The structure needs to stay the same or it won’t work:

T h:mm am/pm
e.g.
T 5:00 pm
T 10:00 am

Furthermore, set the open hour Bot Fields in ManyChat as well:

  • Janis-reservation-earliest (e.g. 2:00pm)
  • Janis-reservation-latest (e.g. 11:00pm)
  • Janis-reservation-interval (in minutes e.g. 30)
  • Janis-reservation-integromat (Yes)

One last thing would be to change the date format you want to use for the customer facing reservation confirmation:

  • Janis_reservation_date_time_format

Please refer to this date/time formatting guide for the correct format.

Adding Dialogflow

Dialogflow is conversational AI from Google that will help understand the messages users send. I’m using the booking Dialogflow template from Janis.ai

You can automatically extract and store User Fields when users send messages. You can see here that I added training phrases which are things users might say to the bot and all of the highlighted words are variables. They represent just a sample of data that will be stored in custom user fields:

Words like schedule could be expressed as book or arrange and you only need a few phrases to capture ANY variation. The user could say 1, 2, or 4 million. A number is variable and you can capture and store any number in a number-type Manychat field. For the day, it could be Tuesday and Dialogflow will interpret that as the next Tuesday on the calendar, or if the user says next Sunday then that will be interpreted and a date value will be stored in a date-type custom user field. There are 3 values I NEED to capture to complete a booking, so I just make those parameters required, and if a user’s message doesn’t provide me with all 3 values, then I can prompt them with questions until I get the data I need.

If a user sends a message that triggers this Dialogflow Intent, I can then respond with a Manychat flow and display the values I captured, then send that data to Integromat.

While Dialogflow isn’t required, it does give you the ability to reduce the number of steps to complete a booking IF the user provides data you can use in their message. If a user says I need a table for tomorrow for 4 people at 6pm then you can extract every value you need from that one message and get the user through a reservation flow faster.

You can use these Dialoglow Intents I created too, if you want to add Dialogflow into the mix and don’t have time to spend training AI

  1. Go to Dialogflow.com and login with your Google account. Create a new Dialogflow agent by naming it and saving it.
  2. Download these Dialogflow Intents. It’s a ZIP file you’ll download to your computer.
  3. Click the ⚙ icon next to your Dialogflow agent name, then click the Import and Export tab. Then click the IMPORT button to import the Intents.

Drag the ZIP file from your computer (ZIPPED) into the box and then type the word IMPORT. Then click the IMPORT button.

You’ll need to connect your Dialogflow agent to your Manychat bot and Janis can do that for you for free. Just sign-in at Janis.ai using the same Google Account you used to sign-in with Dialogflow and connect your Dialogflow agent to Janis, then Janis will give you a free key you can add to your Manychat bot so your Manychat flows communicate with the Dialogflow agent. That’s it.

Wrapping Up

With chatbots, you can connect all of these systems together and quickly build applications that solve real-world problems. The pandemic is both a huge health and business problem, but deploying these kinds of tools quickly only helps businesses better manage customers in uncertain times

Need Help

I am glad to answer questions on a 1-to-many basis in the Janis community (if you used Dialogflow), but for anything related to Integromat, you should connect with Manuel Gick who is a Manychat, Integromat, and Dialogflow expert. He set up the Integromat scenarios for this, so if you need customization like automating the changing, or canceling of a reservation, or other related functionality, I’d recommend him.

If you like this story, consider taking my Dialogflow Course.

--

--

Josh Barkin
Being Janis

Building conversational AI platforms since 2016