Prerequisites 

API Block
JSON
GET requests

What you'll learn:

  • How to Retrieve data into your project from Airtable
  • How to use the Endpoint Tool to test whether your requests are working successfully.

What is Airtable?

Airtable is a powerful tool that lets us mimic a lot of the functionality of databases without having to worry about a lot of the technical details. Airtable does most of the heavy lifting for us. 


Storing data on Airtable is easy. Lets head into Airtable and create a project first.


Airtable has a variety of different templates we can use. I'm going to create a blank spreadsheet for our example.


Once we update the spreadsheet with values, we can now access these values in our skills within Voiceflow!


First lets head to this link:

https://airtable.com/api

This link is quite useful for us as it will give us all the information we need to pull all the data that we need.


Here we see that we can see values with or without our API keys. I'm going to check this box to make things easier for me.

Now lets head to the bar on the left and select "Retrieve a record" to see how we can retrieve values from our spreadsheet.

On the right, we can find all the information we need to get our information into Voiceflow.


There's a lot of information in this picture. Let's see what each line is doing:

https://api.airtable.com/v0/app5y0nsnMRpEqKWd/Table%201/recPZgnoOd32W1XkG

This is the endpoint that we will be retrieving data from and will go into our API block in Voiceflow. Note that this endpoint is only for ONE record in your spreadsheet.

Most usecases will require us to pull our entire spreadsheet, and so we will remove the ending id and our URL will be:

https://api.airtable.com/v0/app5y0nsnMRpEqKWd/Table%201/
 "Authorization: Bearer keyM6ZYJYmkN5p0vt"

These values will be important to tell Airtable who we are and whether they can access our spreadsheet. 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.

{    
    "id": "recPZgnoOd32W1XkG",
    "fields": {
       "Notes": "Loves cookies",
       "Name": "Andrew"  
  },
    "createdTime": "2018-12-14T21:43:15.000Z"
}


The above is the payload of what we are pulling in.  Refer to the JSON tutorial if you are unfamiliar with how to work with JSON.

Now if we head over to Voiceflow, we can input our values to into the API block to pull our data.

Above we are filling our API block with the values we received above. Please not that the Endpoint URL does not have the record id

https://api.airtable.com/v0/app5y0nsnMRpEqKWd/Table%201/recPZgnoOd32W1XkG

instead we use the URL that returns our entire table:

https://api.airtable.com/v0/app5y0nsnMRpEqKWd/Table%201/


I also mapped the response I received to a variable called name.

Below, we can see the an example skill I've put together to test out our API call.


When I head into our test tool to, we see that the value is coming in successfully.


Lets turn on debug mode by hitting this button in the test tool:


We can see what our request and response values are now when we send our API calls to AirTable. 

Although the response is a bit jumbled, we can see everything being sent back to us. This will help us debug if we ever run into issues.

Above we see that we're being returned the correct values and they are being set to our variable.

And it's as easy as that! We can now pull our data easily and have our values changing dynamically within our skills.

Did this answer your question?