Dialogflow Python Webhook Example | Python Flask Webhook | Dialogflow Tutorial | Responsive Webhook

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome to another video on my youtube channel in this video i will show you how you can create a web hook for your google dialog flow chat board and in this video i will use python programming language and flask framework now let's see what is a web hook so a web hook is http callbacks whenever our dialogflow needs web hook it sends a request and with that request some request data to the webhook this web hook uses external apis and database to generate a response for that particular request and it sends a response with some response data to dialog flow and then in turn dialog flow will show that response to the user for the development of a webhook and to follow this tutorial you will need ngrok installed on your system so that we can have a public url and we can give that public url to dialogflow and that public url will divert all the request to our localhost you will need dialogflow account also you will need python installed on your system a virtual environment created and flask framework installed on that virtual environment so let's get started also i will assume that you know some things about dialogflow and web app because we are using those basic concepts here and i am not going to explain everything here but instead i will show how it works and how can you get started with a web hook for dialog flow so i will start with dialogflow and create new agent here i will give name youtube demo to the agent i will hit create it it takes some time usually because it needs to create a google cloud platform project okay now the chat boot is created let's test the chat board with hello okay you get the response hi how are you now i will create a folder and inside that folder i will start my visual studio code to edit the files inside this file i have a sample web app ready with flask so let's first test this i'm using conda so i will activate my virtual environment now i am in my virtual environment let's run python process workbook okay as you can see the web server is running and hopefully it will print hello world so the web hook is ready for development let's start ng rock i will start my ngrok engine it will give us public url make sure you use this https url we will go to dialogflow under fulfillment section i will enable the webhook i will paste the url now i'll make a root web hook for that url now inside the intents let's go to the default welcome intent delete all the responses i don't want the response to be to come from this default responses instead i will enable the web hook and save this so when now i write hello it will say not available and if if you go to the diagnostic info you will see that dialogflow has sent a fulfillment request but fulfillment status says that webhook call failed an error not found because if you see here that it indeed came to the ng rock and it says 404 not found because we don't have that route ready and you can see the error here now what we will do i'll create a new route webhook methods post let's first get the request get jason and force true and print the request i will say hello again again it will fail because we haven't send anything now you can see the error is changed from not found to internal error because we haven't responded to the request but if you see that we indeed got a request from dialogflow okay let's just send okay hopefully it's running again let's now test hello you see we got hello from the other side on the ngrok it sends 200 status okay we see here 200 status is okay no error and if you go to diagnostics info you will see that fulfillment request was this fulfillment response was this and fulfillment status web hook successful so this is it for the video now there are many things you can do here you can process the request and go to external apis and do stuff and then come back here and then generate a response and send it back to the dialog flow the code used in this is available on my git repository and the link for that is in the description thank you for watching peace
Info
Channel: Raj Kapadia
Views: 1,249
Rating: 5 out of 5
Keywords: dialogflow webhook, python webhook, python flask webhook, dialogflow python webhook, dialogflow tutorial, dialogflow fulfilment python, python dialogflow webhook
Id: Oh62SfC-3KY
Channel Id: undefined
Length: 9min 41sec (581 seconds)
Published: Sun Mar 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.