top of page

How integrated python with dialogflow | How to build a chatbot using python and dialogflow - ngrok

Updated: Sep 16, 2020



To create dialogfow chat using python script and output show with the help of ngrok.

In this two node is used one for client and second for server(ngrok), ngrok basically used to send HTTP request.


Python Script to Embedded dialogflow


First write python code for dialogflow. Here we attached full python code script:



After this go to the cmd command prompt and run:


Add file path here>python app.py



Download and run ngrok node


Now download ngrok by using given official website:


https://ngrok.com/ log-in and download file.


Download ngrok zip file and extract it and then run ngrok.exe file. New ngrok terminal window open.


Now run these two command one by one to connect you account this:


>ngrok authtoken 6QNf62kCyevs35qwpFEQ9_7TsZ9ayw3azQBBidVaRR


> ngrok http 80


ngrok terminal run and generate two http and https url like this



Copy this http url and paste at the dialogflow webhook location. Go to the dialogflow fulfillment section and update webhook url.



Add this in webhook and save


Now it connect with the ngrok and python script.


Run using give the text(Federal bank interest) input in dialogflow:



Enter and you will see that both node working dialogflow output generated in cmd and server run on the ngrok terminal.


cmd terminal output:


ngrok terminal:


It display 200 ok, means http request sent properly and output generated from dialogflow using python script.


To show real time chatbot go to the integrations and enable web demo and click on it.



copy link and run on the web browser.( this is not active link for security issue please run own project link)


https://bot.dialogflow.com/471b0d4f-6c51-4c0c-ae27-77a334961e53


It look like that:


If you like Codersarts blog and looking for Assignment help,Project help, Programming tutors help and suggestion  you can send mail at contact@codersarts.com.

Please write your suggestion in comment section below if you find anything incorrect in this blog post.



bottom of page