Draft
In this tutorial I will explain how you can create a custom integration for Dialogflow CX using Python Flask.
I use Zoho SalesIQ as the example integration. There are 4 layers of a Dialogflow bot, and Zoho SalesIQ, if you notice, provides us with the UI Layer. So we only need to create the middleware (integration) layer to get the CX integration to work with Zoho SalesIQ.
PythonAnywhere
If you are using Python for your Dialogflow bot (which I recommend), you need to host the middleware code on one of the cloud hosting services.
I will be using PythonAnywhere for the hosting the integration code. I have chosen it over other platforms for a few reasons that I have listed below.
PythonAnywhere | Google Cloud Functions | Heroku | Render | |
Debugging UX | Simple | Very challenging | Simple | Simple |
Has a fully free tier | Yes | Quota | Soon to be deprecated | Yes |
Wake up delay for free plan (this is a problem for chatbots) | No | No | Yes | Yes |
Bounded cost for paid tier | Yes | No | Yes | Yes |
Support | Very good | Poor | OK | Good |
Documentation | Very good | Poor | Very good (sets the benchmark) | Pretty good |
Scalability | OK | Best-in-class | Good | Good |
Reliability | OK | Best-in-class | Good | Good |
Multiple endpoints in single app | Yes | No | Yes | Yes |
Overall complexity | Moderate | Very high | Low | Low |
You can use the technique I describe here for storing GOOGLE_APPLICATION_CREDENTIALS on all these platforms. But PythonAnywhere wins out for its overall simplicity (in my opinion).
For the rest of the article, I will refer to PythonAnywhere as PA.
Create a new web app
First, create a free account on PA.
In the Dashboard, click on
Create a new virtual environment
Set the venv for the web app
Open Bash Console for that venv
create a new folder called app and cd into it
git clone () into the app folder
pip install
open wsgi file and make suitable modifications
download service account file
compress the JSON
add GOOGLE_APPLICATION_CREDENTIALS key and paste the compressed JSON into the value
upload .env file into your app folder
Create a new Zobot and choose Webhook as the integration option
Paste the URL of the pythonanywhere app into the URL
You will see a checkmark
Now create the integration