Better return Journey with API block?

Hi Voiceflow team,

So I was wondering if I could prototype a better return user journey with the help of an the Api block and a variable. You explained how to use Google Sheets with the GET function. Is it possible to use a PUT function to send data to a Cell in Google Sheets?

I just tried this and got a 405 - Not allowed. So I can’t PUT anything to my Google Sheet via VoiceFlow?

Would the something like FireBase be possible ??

Yes, FireBase or Airtable. For googlesheet it’s read only this way.

Okay, Ill have to try and figure it out. If there any tutorials on how to use Firebase or Airtable that would be wonderful. Ill google and try and figure it out.

The aim was the use the table to better track return users.

Here is a tutorial for POST to Airtable. Be aware, though, that the free tier for Airtable has volume limitations. Developers should review their pricing plan, especially if the intention is to track return users, to make sure a budget is in place for a paid plan for when the skill becomes popular. VFU has some additional Airtable tutorials as well.

https://voices.app/?p=948

Thanks very much Mark i’ll give that a go. I just need it for prototyping. Advantages of being a designer!

Here is the post I’ve made on the Voiceflow facebook page:

!! YOU DON’T NEED TO SET THE Authorization HEADER IF
YOU PUT api_key=keyxxxxxxxxxxx in the url.

//Get all the records from table Users

GET -> https://api.airtable.com/v0/appxxxxxxxxxx/Users?api_key=keyxxxxxxxxxxx

Here is the JSON response from the call:

{
“records” : [
{
“createdTime” : “2018-12-13T06:08:41.000Z”,
“fields” : {
“Timestamp” : 1544581320,
“UserID” : “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”
},
“id” : “rechMjxxxxxxxxxxx”
},
{
“createdTime” : “2018-12-13T06:15:13.000Z”,
“fields” : {
“Timestamp” : 1544581321,
“UserID” : “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”
},
“id” : “rechMjxxxxxxxxxxx”
}
]
}


// Create a record in an Airtable table

POST -> https://api.airtable.com/v0/appxxxxxxxxx/Users?api_key=keyxxxxxxxxxxx

!! YOU NEED TO PASS THIS HEADER IN ALL YOUR CALLS WITH A POST TO AIRTABLE

key: Content-Type
value: application/json

BODY RAW INPUT IN THE API BLOCK:

{
“fields”: {
“Timestamp”: “1544581320”,
“UserID”:“amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”
}
}

Here is the JSON response from the call:
{
“createdTime” : “2018-12-13T20:59:11.000Z”,
“fields” : {
“UserID” : “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”,
“Timestamp” : “1544581320”
},
“id” : “recl6lM9UyQjQmyI5”
}


// Search a record with his id

GET -> https://api.airtable.com/v0/appxxxxxxxxxxxxx/Users/recl6lM9UyQjQmyI5?api_key=keyxxxxxxxxxxx

Here is the JSON response from the call:

{
“createdTime” : “2018-12-13T06:15:13.000Z”,
“fields” : {
“Timestamp” : 1544581321,
“UserID” : “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”
},
“id” : “recl6lM9UyQjQmyI5”
}


// Search a record with a formula

GET -> https://api.airtable.com/v0/appxxxxxxxxxxxxxx/Users?maxRecords=3&filterByFormula=SEARCH(‘string_to_find’,%20{UserID})?api_key=keyxxxxxxxxxxx

maxRecords=3 is the number of results you want in return.
string_to_find can by replaced by a VF {variable} for example.
UserID is the field you want to search in.

Here is the JSON response from the call:

{
“records” : [
{
“createdTime” : “2018-12-13T15:46:40.000Z”,
“fields” : {
“UserID” : “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”,
“Timestamp” : 1544581321
},
“id” : “recl6lM9UyQjQmyI5”
}
]
}


// PATCH Upate a record with his id

To update some (but not all) fields of a Users record, issue a PATCH request to the record endpoint. Any fields that are not included will not be updated.

PATCH -> https://api.airtable.com/v0/appxxxxxxxxxxx/Users/rec4TJIiIjwcTwsnn?api_key=keyxxxxxxxxxxx

!! YOU NEED TO PASS THIS HEADER IN ALL YOUR CALLS WITH A PATCH TO AIRTABLE

key: Content-Type
value: application/json

BODY RAW INPUT IN THE API BLOCK:

{
“fields”: {
“Timestamp”: 1544581321
}
}

Here is the JSON response from the call:

{
“id”: “rec4TJIiIjwcTwsnn”,
“fields”: {
“Timestamp”: 1544581321,
“UserID”: “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”
},
“createdTime”: “2018-12-14T18:41:58.000Z”
}


// PUT Upate a record with his id

To update all fields of a Users record, issue a PUT request to the record endpoint. Any fields that are not included will be cleared ().

PUT -> https://api.airtable.com/v0/appxxxxxxxxxxx/Users/rec4TJIiIjwcTwsnn?api_key=keyxxxxxxxxxxx

!! YOU NEED TO PASS THIS HEADER IN ALL YOUR CALLS WITH A PUT TO AIRTABLE

key: Content-Type
value: application/json

BODY RAW INPUT IN THE API BLOCK:

{
“fields”: {
“Timestamp”: 1544581321,
“UserID”: “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”
}
}

Here is the JSON response from the call:

{
“id”: “rec4TJIiIjwcTwsnn”,
“fields”: {
“Timestamp”: 1544581321,
“UserID”: “amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxxx”
},
“createdTime”: “2018-12-14T18:41:58.000Z”
}