Getting Started
CX vs ES: Get User First and Last Names
Flowcharts and Test Cases
Entities and Parameters
CX Webhooks using Python
Dialogflow CX Slot Filling
Conditional routes with expressions
Building a Dialogflow CX Custom Integration
Exception Handling
Changing conversation topic
System Functions
Quickstart Templates Resources

3 Save data to Airtable

Watch the video tutorial

import os
from flask import Flask, request
from dotenv import load_dotenv
from pyairtable import Table
import json


api_key = os.getenv('AIRTABLE_API_KEY')
base_id = os.getenv('AIRTABLE_BASE_ID')
table_name = os.getenv('AIRTABLE_TABLE_NAME')

app = Flask(__name__)

@app.route('/')  # this is the home page route
def hello_world():  # this is the home page function that generates the page code
    return "Hello world Airtable!"

def save_to_db(req):
        session_info = req.get('sessionInfo')
        name = session_info.get('parameters').get('person').get('name')
        email = session_info.get('parameters').get('email')
        url = session_info.get('parameters').get('url')

        table = Table(api_key, base_id, table_name)
        result = table.create({'Name': name, 'Email': email, 'Website': url})
        return 'Thanks. We will be in touch soon.'
    except Exception as e:
        error_str = str(e)
        return 'Something went wrong. Please try again later'

@app.route('/webhook', methods=['POST'])
def hello_webhook():
    req = request.get_json(silent=True, force=True)
    with open('data.json', 'w', encoding='utf-8') as f:
        json.dump(req, f, ensure_ascii=False, indent=4)
    result = save_to_db(req)
    jsonResponse = {
                "messages": [
                        "text": {
                            "text": [
    return jsonResponse

if __name__ == '__main__':'', port=8081)

Dialogflow Tips for Non-Programmers

Avoid these 4 Dialogflow ES features

No code power tools to speed up the Dialogflow bot building process

Should non-programmers start with Dialogflow ES or Dialogflow CX?

Airtable vs Google Sheets: which is a better database for Dialogflow?