Use Airtable and Stream blocks in Voiceflow (Podcast Skill)

Today we will create a skill that will allow us to load 5 podcasts from an Airtable database but also to allow the user of this skill to search the available podcast titles and start playing this podcast if a title matches.

Let’s start by creating our database with Airtable, for that, you will have to create an account on airtable.com or login if you have already created an account.

Once you have created your account (or logged in), you have access to your main screen.

To create our database, we will click on the “Add a database” button and then on “Start from scratch

36%20PM

Now give a name to this new database and hit enter on your keyboard

Now click on the database you just created

27%20PM

Your database will open with the default data

Let’s start by renaming this table, double-click on the “Table 1” tab and rename it as “Podcasts” for example.

%22

Double click on the first “Name” field to rename it to “Title”, leave the field type on “Single line text”. Click “Save”.

Do the same for the “Notes” field and rename it “Description”. Leave the field type at “Long text”. Click “Save”.

png

Finally, for the third field, rename it “Url” and replace “Attachment” in the field type for “Single line text”. Click “Save”.

Great, your database is ready to receive the data. Copy/paste or enter the information you want in this database. You must create at least 5 recordings because we will load at least 5 podcasts into our skill later.

On my side I used this link https://feeds.feedburner.com/ted/googlehome/tedtalks to fill my database but you can also use my shared database from this url https://airtable.com/shrBc1DHB0KLYL43D

Keep this base open aside we’ll come back to it later.

Now we are ready to create a new skill in Voiceflow.

58%20PM

Named this skill as you wish

And click on “Continue”.

49%20PM

On the next screen, select the “Blank” template and click on “Start”.

Here is what your skill will look like at the end of this tutorial.

And here is the link of the preview skill: https://creator.getvoiceflow.com/preview/X0OQ44Bm6x/28c76c1b1b5dcf949a36eb9a07802a14

We will analyze in broad terms the different parts that make up this skill.

First of all, the welcome dialogue and the choice between the last episode or a search in the database.

Here is the first step in the search process, we’re asking the user for a word to search with the help of the Capture block.

Add the {search} variable to the Global Variables to store the word the user is looking for from the Capture block

And map the response in the Capture block to this variable

And we send the search word to the API block

08%20PM

Now, we are going to configure the API block like this

So we start by creating the 3 new variables, {search_Title}, {search_Desc} and {search_Url} which will contain the results of our API call to Airtable.

Now, map the result from the API block like this:

For the URL Endpoint, we leave it to GET and for the url, we need to go back to Airtable.

For those who have not yet created an API key in Airtable, go to your account by clicking on the icon at the top right and selecting “Account

On this screen, click on “Generate API key”.


You can now close this window and go back to your Airtable base.
On this page, go to the help menu and select “API documentation

In the new window that opens, start by ticking the “show API key” box in the upper right corner.

%20showapi

And in the left menu, select “AUTHENTICATION

Copy for later use the URL with the api_key on the right of your screen

Here I have: https://api.airtable.com/v0/app1RbB2cGeQN2pmy/Podcasts?api_key=keyY6PccqvLBwFzSi

Now we can go back to Voiceflow to finish configuring our API block

Paste the URL you’ve just copied in the URL Endpoint of the API block and add
&maxRecords=1&filterByFormula=SEARCH(’{search}’,%7BTitle%7D) to the end of URL.

So the final URL must look like:

https://api.airtable.com/v0/app1RbB2cGeQN2pmy/Podcasts?api_key=keyY6PccqvLBwFzSi&maxRecords=1&filterByFormula=SEARCH(’{search}’,{Title})

Here, we’re going to ask for 1 record (maxRecords=1) with a search for the variable {search} in the field “Title” of our database Podcasts.

Great, you just finished configuring the first API block that allows you to search in an Airtable database.

The following blocks are pretty easy to understand, we use an IF block to check if we have a result and if so we start playing the podcast in a stream block.

Now we have to set the second API block

Again, we need to create all the Global variables before mapping them in the API block

For the URL Enpoint, just paste the url you get earlier but change the maxRecords=1 to maxRecords=5 to get the last 5 records from your database: https://api.airtable.com/v0/app1RbB2cGeQN2pmy/Podcasts?api_key=keyY6PccqvLBwFzSi&maxRecords=5

That’s all for this second API block.
The rest is also easy to understand, you start the playback with the first podcast and if the user says next or previous you change the source dynamically.

Again, here is the link to the preview of the skill to help you in the realization of yours:
https://creator.getvoiceflow.com/preview/X0OQ44Bm6x/28c76c1b1b5dcf949a36eb9a07802a14

Have fun and feel free to comment if you have any questions/comments.

1 Like

Excellent tutorial, Nicolas!

Thank you, don’t hesitate if you have any questions.

Hello, thanks for the tutorial. I think there is an error with the Alexa built-in “resume” function. If you decide to replay an audio file during the same session, Alexa waits for the resume input from the user but without asks for it. So user don’t hear anything and can’t continue. I’ve tried to disable the “Resume Prompt” in VoiceFlow Settings but with no success. May you help me?

Thank you,

Any suggestions or idea?

Did you try with the last stream block? Remove and add again the speak block on your canvas.

Hello, thanks for the reply.

Yes, I’ve used the latest “stream” block but it’s not possibile to manage the “custom pause” setting without interfere with the Alexa built-in pause/stop routine.

The only way I’ve found to use this podcast skill without issues, is to:

  • turn off the “custom pause”;
  • link “next and prev” of the stream block to the “stop stream” block;
  • continue with the flow.

In this case, pause/stop is managed by Alexa and not interfere with Voiceflow. See attachment. It’s not the same thing because when an user say: “stop” during the audio playback, Alexa don’t ask if he wants to do a new search or quit the skill - but it works.

Thank you.

Thanks @RicardoP for this info.

Awesome tutorial- thanks Nicolas!

1 Like

how will we check search found using the if block? what will be the condition?