Last updated March 19th, 2019

What You'll Learn 🧠

  • How to search for a value in your Airtable spreadsheet and return the corresponding data.
  • How to use a variable to tailor what the user is searching for in the spreadsheet.

What is Airtable?

Airtable is a powerful tool that lets us mimic the functionality of databases without the hassle of learning technical details. Essentially, Airtable does most of the heavy lifting for us. 

First, let's head into Airtable and create a project.

You can start with a template, an imported spreadsheet, or from scratch.


For this example, I'm going to start from scratch and input data that I would like to access through Voiceflow.

Once we're happy with our sheet, we can head to this link. 

A list of all your Airtable sheets should appear. Now, you just need to click on the sheet you would like to work with.

Once you reach this page, navigate to the left task bar and click [List records]. 

Next, ensure that you have 'show API key' checked off. This should be in the top right corner of your page.

Now, if you're unfamiliar with coding, this page may be intimidating. Luckily, the majority of this process really just consists of copying and pasting.

1) Endpoint:

https://api.airtable.com/v0/appaQ6rbKJAL5oFuZ/Voiceflow%20Tutorial?maxRecords=3&view=Grid%20view


This is the endpoint that we'll be retrieving data from (reference screenshot above). This will go into our API block in Voiceflow. Also note that we have the GET request selected, this is because we're retrieving data from the spreadsheet.


2) Header

Authorization: Bearer keyPsb0uwEgg6O2Gz


In this tutorial, you will only need the Authorization header. Each sheet has a unique key. If you have the key to a sheet, you have access to it.

Note that this has an example API key we used to make this tutorial. Never share your API Key with anyone you don't want to give access to your spreadsheet.

Replace my key (underlined in red) with your key.

Now, if you hit the [Test Endpoint] button, you should see all of your records from your spreadsheet.

All of this data is great, but what if we only want to retrieve information that corresponds with one person? This is where the filterByFormula parameter comes in handy.


3) Parameter

filterByFormula
string

A formula used to filter records. The formula will be evaluated for each record, and if the result is not 0, false,"", NaN, [], or #Error! the record will be included in the response.


Navigate to the 'Params' tab and copy the information I've input in the screenshot below.

filterByFormula is the name of the parameter. 

Name is the name of a column in our spreadsheet. Similarly, we could replace this value with Profile or Phone Number - it just depends what we're searching for. 

{name} is the variable. User's will enter who they would like to search for in the spreadsheet and this name would be stored here.

"          " are used outside of the {name} variable because this parameter must hold a String value (a fancy term for word).

'   =  ' is the condition. The formula works like this:

  • If any of the values in the 'Name' column equal the value stored in the name variable, Voiceflow will receive all of those entries with their corresponding data. 


Let's try it out! 

Success! Now all that's left to do is store our data in variables. This will allow us to use them throughout our skill.

Hover over the data you wish to use, and a little blue clipboard should appear. Click the blue clipboard.

Now that this is copied, paste it in an object path and assign it to a variable. Repeat the same steps for the other data you wish to store in variables.

You're done with the API block! Time to test! 

This time, I'll search for Samantha's information.

Here I'm using a set block, but you can also use an Interaction block to map a slot to a variable.


Here is the output:


Still have questions? Be sure to post in our Forums to get fast answers!

Did this answer your question?