In my webhook tutorials, I usually directly construct the JSON and send it back to Dialogflow. Obviously, this has the major benefit of explaining what happens under the hood, as someone pointed out on my YouTube channel: “THANKS THANKS THANKS! For days i have been trying to find a video where people show how to use an external webhook, but from approx. 40 videos i watched, NONE used your solution. They all stick to the Firebase solution. Thanks for your way!”
This is another question which came to me from a client, and I think the answer might be helpful for a lot of folks. Here is the challenge: You want to use the text response you write in your Dialogflow console to be available to the webhook code.
I chose the title “How to send any Facebook rich response from Dialogflow webhook”. But it could just as well have been “How to send any Facebook Messenger | Telegram | Slack | Skype | Google Assistant | Google Telephony | Viber | Kik rich response” from a Dialogflow webhook, because there is no difference in terms of the channel. The technique I am going to show here is dead simple. Unfortunately, it has one big con, which I will cover at the end of this article.
I got a question recently on this topic. Now this isn’t an actual answer to this specific question. Rather, I will explain the approach you should use to handle these kinds of messages in general. At the same time, I think the general answer is becoming more important now because of an important reason.
In this tutorial I will explain how you can debug your Python Flask webhook for your Dialogflow bot using ngrok. I use the PyCharm professional IDE (you can also download the free PyCharm community edition) in this tutorial.