Home / DialogFlow ES / The most important tip for building Dialogflow webhooks
Debugging | DialogFlow ES | Webhooks

The most important tip for building Dialogflow webhooks

Yeah, I cannot help exaggerating sometimes. 🙂

But this one is not much of an exaggeration.

Why webhook development is a big pain in the backside

Not just Dialogflow webhooks, but the way webhooks work in general, you might believe that the best way to debug these webhooks is to sprinkle your code with very insightful print statements.

While insightful print statements do have a role, there is a better way.


Here is the definition of nGrok:

Ngrok is a multiplatform tunnelling, reverse proxy software that establishes secure tunnels from a public endpoint such as internet to a locally running network service while capturing all traffic for detailed inspection and replay.

OK, that may sound quite complicated. But here is what it means for you:

1 Install ngrok and follow setup instructions

2 Go to your webhook URL in Dialogflow

3 Replace it with a URL which will be generated by your nGrok installation

4 Make sure you configure your IDE to use the correct port

What happens when you use ngrok

1 User types a message to your Dialogflow agent

2 Dialogflow decides that it needs to call a webhook based on your setting

3 It looks up the webhook URL and finds the nGrok generated URL

4 Dialogflow sends the JSON post request to the nGrok generated URL

5 Some ngrok magic happens behind the scenes

6 The JSON post request is sent to your local development machine

7 If you configured everything properly in your IDE, you can set a breakpoint in your webhook code and that breakpoint should be hit by the incoming JSON post request

8 Now you can patiently step through the code and see if something is broken

<— End of article —>

This website contains affiliate links. See the disclosure page for more details. 
"The magic key I needed as a non-programmer"

The custom payload generator was the magic key I needed (as a non-programmer) to build a good demo with rich responses in DialogFlow Messenger. I've only used it for 30 minutes and am thrilled. I've spent hours trying to figure out some of the intricacies of DialogFlow on my own. Over and over, I kept coming back to Aravind's tutorials available on-line. I trust the other functionalities I learn to use in the app will save me additional time and heartburn.

- Kathleen R
Cofounder, gathrHealth
"Much clearer than the official documentation to be honest"

Thanks a lot for the advice (of buying and following your videos)! They helped a lot indeed. Everything is very clear when you explain, much clearer than the official documentation to be honest 🙂

Neuraz T
Review for Learn Dialogflow CX
"I will strongly recommend this course because even I can learn how to design chatbot (no programming background)"

I think Aravind really did a great job to introduce dialogflow to people like me, without programming background. He organizes his course in very clear manner since I have been a college professor for 20 years. It is very easy for me to recognize how great Aravind’s course is! Very use-friend and very easy to follow. He doesn’t have any strong accent when he gives the lectures. It is so easy for me to understand. Really appreciate it.

Yes, I will strongly recommend this course because even I can learn how to design chatbot (no programming background) after studying Avarind’s course, you definitely can!

Ann Cai
Review for Learn Dialogflow ES

Similar Posts