Conversational AI
  • Introduction
  • Getting started
    • Getting started
    • Adding content to your bot
    • Capture information with entities
    • Capture information with input validation
    • Reusing intents with context
    • Flow navigation with variables
    • Adding new users to your account
  • Understanding users
    • Natural Language Processing (NLP)
      • NLP threshold
      • NLP Import & Export
      • Train your bot with actual user messages
      • NLP Dashboard & NLP Improve
      • Synonym entities
      • System entities
      • Supported languages
      • Intent templates
    • Expression generator
    • Context
    • Multi-language bots
  • Bot answers
    • Bot dialogs
      • Message components
      • Go To
      • Input Validation
      • Action
      • Translations
    • Conversations
    • Analytics
      • User flow
    • Publishing your bot
    • Events
    • Reuse flows
    • Settings
      • Variables
  • Integrations
    • API integration
      • Advanced API integrations
    • Chat message structure for API's
    • Retrieving data from Airtable (GET)
    • Sending data to Airtable (POST)
    • Human handover & live chat
      • #Interact
      • RingCentral Engage Digital
      • Genesys Cloud
      • Help Scout
      • Zendesk Chat
      • Intercom
      • Sparkcentral (beta)
      • Offloading Webhook
  • Channels
    • Channels
    • Facebook Messenger
      • Facebook Admin Removal
      • Facebook Webview Whitelisting
    • WhatsApp Business API
    • Google Assistant
    • Webhook Channel API
    • Chat widget
    • Phone & voice
    • Workplace from Facebook
    • Sinch Conversation API (beta)
  • Tips & Best practices
    • How to NLP
    • Creating diverse expressions
    • Why is my bot not responding the way I want it to?
    • What makes a good chatbot?
    • How to recognize a returning bot user
    • Gathering user feedback
    • Using time in your chatbot
Powered by GitBook
On this page

Was this helpful?

  1. Integrations

Sending data to Airtable (POST)

PreviousRetrieving data from Airtable (GET)NextHuman handover & live chat

Last updated 4 years ago

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.

If you're new to using variables in Chatlayer.ai, follow tutorial first.

  • 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.

const body = {
    "records": [{
        "fields": {
            "First Name": args.firstName,
            "Customer Type": args.customerType
        }
    }]
}
const airtableResult = await fetch('https://api.airtable.com/v0/(yourAppId)/(yourTableName)', {
    method: 'POST',
    body: JSON.stringify(body),
    headers: {
        'Authorization': 'Bearer (insert token here)',
        'Content-Type': 'application/json'
    }
}).then(r => r.json())

ChatlayerResponseBuilder()
    .setNextDialogState(args.nextDialogState)
    .send()
  • 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!

Remember to get the right app id, table name and bearer token for your Airtable. You can find it .

this Airtable
here
Airtable
this