\In this tutorial, we'll show you how to connect a Voiceflow project to an Airtable database. And then we'll explain how to retrieve information from that database using a GET request. In Voiceflow, hooking up Airtable to your Voiceflow project is a great way to harness the power of relational databases.
The first thing you'll need to do is create an Airtable account. You'll need to head to Airtable.com and sign up for free. Once you've successfully created your account, you're going to want to navigate to the bases tab. From there, click add a base and then select start from scratch to create a brand new database. Once Airtable creates this for us, we can rename this database to Airtable tutorial.
We can also rename the table itself if we so choose to. In this case, I'm going to call this overview. Finally, we can rename any field or fields we're using. So let's go ahead and name this task. Let's now add three things under our task field - let's put laundry, buy gym membership, and grocery shopping.
Now that we have our Airtable database created, let's show you how we can connect it to our Voiceflow project so we can pull or bring these answers into our experience. The first thing we need to do is drag our API step onto the canvas.
Let's now open up the editor and select the dropdown next to GET.
And what this does is give you a few different ways you can access, manipulate, or utilize the data in your Airtable. For this scenario, we want to use the GET request which allows us to retrieve data, or in this case, the information we just inputted into our Airtable database.
Next, we're going to need to head back to Airtable and navigate over to the help tab.
From there, we need to select API documentation. It's important to remember that each Airtable database has its own unique set of API documents, which provides us with everything we need to fill out this API step.
Once here, we're going to need find the API key and the ID of the base.
Now as you scroll down, there are a few things you may want to look at. The first thing you might notice is that our variables are have been added: for example overview, task, and our example values. What we're going to want to do here is copy over the URL under EXAMPLE USING BEARER TOKEN and we're going to place that inside our API step in the request URL text field.
One thing to note when you copy this over is to make sure the URL has the entire slug in it, including the name of the tab you want to pull data from.
Next, let's head back to the API documentation for our Airtable.
We're going to want to click show API key in the top right corner of the screen. This personal API key is required in order to use the Airtable API and can be generated in your Airtable account settings. If you haven't generated this key yet, be sure to do so or this check box will not appear.
The next thing we need to do is copy the line next to authorization. We'll need to copy over bearer and the key for the actual base itself. And then we'll head back to Voiceflow, type in authorization [under header assignments] and then paste what we had copied into the value field.
Now that that's finished, we can test that request.
You can see that it's now succeeded and voila, there are the tasks that I previously created in my Airtable database. What I can do now is select any one of these. So for instance, I can copy our Grocery Shopping task by clicking this copy to clipboard button and then paste that back in Voiceflow where it says 'Enter object path'. This maps the Grocery Shopping task to a variable.
For this example, I'll create a new variable in the text field below and call it recent_task since it's the most recent task of the three tasks we inputted into our Airtable database.
Now our API step is set up and ready to fetch from our Airtable project.
Now let's see what this looks like in our test tool. But before we do this let's create a hypothetical scenario where we might need to execute a GET request from an Airtable database. In this scenario, maybe we're recalling a to-do list that we filled out at the beginning of our week.
To build out this example, let's drag a speak step onto the canvas. We can open up the editor and type "what would you like to know about your weekly task list?" Next, we can add a choice block underneath that step and create a next_task intent within it. We'll then fill in our utterances: what is my next task, next task, and last task.
Okay. Done. And so that will now trigger your Airtable to go get or fetch a response.
We'll link this to our API step and then drag another speak step onto the canvas. In the editor, we'll write what the assistant might say after the API call and include our variable. So we'll type "your next task is", and then add the recent_task variable.
Prototyping this Experience
Now we're finally ready to see our API integration work its magic.
And so we'll head over to our test tool, but first we'll train our assistant to incorporate all of the changes we've made. Now we can prototype our experience.
Assistant: What would you like to know about your weekly task list?
User: what is my next task?
Assistant: Your next task is grocery shopping.
So that's a super easy way for you to be able to go in and pull information from an Airtable base. As I mentioned earlier, there are many different ways you can use Airtable with Voiceflow's API integration to perform all sorts of requests - from retrieving and presenting existing data to saving user responses to a specific field in your Airtable database.
Voiceflow makes it easy to create rich experiences such as editorial calendars, to-do lists, idea trackers, product catalogs, expense tracking, and a whole lot more. We hope this tutorial inspired you to level up with Airtable in your next Voiceflow project. Thanks for watching today.