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.

PythonAnywhereGoogle Cloud FunctionsHerokuRender
Debugging UXSimpleVery challengingSimpleSimple
Has a fully free tierYesQuotaSoon to be deprecatedYes
Wake up delay for free plan (this is a problem for chatbots)NoNoYesYes
Bounded cost for paid tierYesNoYesYes
SupportVery goodPoorOKGood
DocumentationVery goodPoorVery good (sets the benchmark)Pretty good
ScalabilityOKBest-in-classGoodGood
ReliabilityOKBest-in-classGoodGood
Multiple endpoints in single appYesNoYesYes
Overall complexityModerateVery highLowLow

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


About this website

BotFlo1 was created by Aravind Mohanoor as a website which provided training and tools for non-programmers who were2 building Dialogflow chatbots.

This website has now expanded into other topics in Natural Language Processing, including the recent Large Language Models (GPT etc.) with a special focus on helping non-programmers identify and use the right tool for their specific NLP task. 

For example, when not to use GPT

1 BotFlo was previously called MiningBusinessData. That is why you see that name in many videos

2 And still are building Dialogflow chatbots. Dialogflow ES first evolved into Dialogflow CX, and Dialogflow CX itself evolved to add Generative AI features in mid-2023