This website contains affiliate links. See the disclosure page for more details.
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!
In addition, it is somewhat programming language agnostic and so the tutorial is more useful (if you can understand how the code is constructing the JSON).
But that’s not the only thing.
I usually avoid the Dialogflow fulfillment library entirely.
There are a few reasons for this.
Note: please do not confuse the Dialogflow fulfillment library with the AoG client library (although the code looks very similar). At the moment, the AoG client library is the simplest way to construct JSON responses for Google Assistant apps.
You will find a lot of issues raised on GitHub about how the fulfillment library isn’t up to date with the latest updates in some channel or the other.
It is not up to date
Also, for some context, the authors have already mentioned that the library isn’t maintained and should only be used within the inline editor.
However, they should have gone a step further and also asked people to stop using the inline editor because it is not a very useful tool for serious development work. Otherwise people who do use the inline editor end up going around asking questions like these:
The abstraction is not very helpful
All this might be OK if the abstraction provided by the fulfillment library is extremely good. That isn’t the case at all.
Often, you will have a much clearer understanding of what is going on by inspecting the raw JSON.
I am not sure why this is the case, but I suppose it is because the message object format is too flexible, meaning there are very few rules on what can be combined and what cannot be combined inside the message response JSON.
In any case, handling the pure JSON is often much easier.
If you are building a Dialogflow Messenger bot, I have built a tool which provides a visual editor for the custom payloads. Once you generate the payload JSON as per your requirements, you can just substitute the appropriate variables inside your webhook code.
The recently released Zoho SalesIQ v2 allows non-programmers to build chatbots using an easy-to-use code less bot builder. What is really unique about Zoho SalesIQ is the fact that you can also integrate AI into their code less bot builder. In my Zoho SalesIQ chatbots course, I explain how to use Zoho SalesIQ to add a chatbot to your website.
"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