[Example] Sending data to Airtable (POST)
Last updated
Was this helpful?
Last updated
Was this helpful?
Data gathered inside of bots is often sent to an external database. An easy way of doing this is by ingrating with . Airtable is a tool that allows you to create a spreadsheet that you can talk to with an API.
In this tutorial we will set up an integration with Airtable. Because of all the code it looks quite technical, but in fact it's pretty easy.
Start by building a short flow that you use to gather some data about your user, for example:
This flow adds the variables "customerType" and "firstName" to the session of the user.
Set up an Airtable that has a column for each variable you want to save. Rows will be added for each customer.
At the point in the flow where you want to send the data to Airtable, add an Action containing a Code plugin.
In our example, we want to send the customer's type and first name. Furthermore, we want to jump to another bot dialog as soon as the data has been sent. Start by adding these parameters at the top of your code editor.
Then add the code below to the plugin and save your Action dialog.
Et voilà ! Now, every time a user goes through your flow, their data will be sent to Airtable, and they will continue on to the Success bot dialog.
If there are any errors with your connection to Airtable, you can find them in the Error logs tab in Chatlayer.ai.
In this tutorial, we will be using . Feel free to reuse it!
Want to learn more about the possibilities of the Code plug-in? You can find it .
Remember to get the right app id, table name and bearer token for your Airtable. You can find it .