Home / REST API / The challenge with using Dialogflow SDKs
REST API

The challenge with using Dialogflow SDKs

A reader mentioned that this is their biggest challenge with Dialogflow at the moment:

“Finding current and well documented SDKs”

This is actually a pretty big issue with Dialogflow at the moment.

There is a simple workaround though, and in my opinion this workaround is ALSO a best practice. The workaround is to not use these SDKs and instead go one layer deeper and ignore the abstraction.

Here are three specific cases where doing this is a big help.

REST API Client libraries

Dialogflow has a REST API, and also has client libraries. Unfortunately they are not well maintained. The basic stuff works, but the features included in the client library often is not on par with the actual REST API.

Solution: use the Google API Client for authentication (it is too risky/dangerous to write your own auth code), and then make a direct call to the REST API from your code. If you want a detailed example of this, check out my Dialogflow REST API course.

First of all, this approach improves your understanding of the Dialogflow REST API, and this has no downsides at all.

Second, you don’t have to rely on the updates in the client libraries or mess around with the underlying code if you find that something is missing. This means you can more easily add your own enhancements to the REST API code where it makes sense.

Fulfillment library

In my view, Dialogflow should have never promoted their fulfillment libraries as a major reason to use Dialogflow. (This used to be touted as a big selling point in their initial demos). There are at least two big problems with the current fulfillment libraries: they are written predominantly in NodeJS (which makes the code hard to read), and keeping it up-to-date is almost impossible given that the chat applications like FB Messenger and Skype and Telegram keep adding new types of rich responses quite regularly.

Solution: Instead of using the fulfillment library, it is MUCH easier to understand the exact JSON that needs to be sent back and to simply construct the JSON dynamically in your code. All the major programming languages have great JSON libraries so this is not especially hard, although you might find it a bit tedious.

Besides, really understanding the JSON structure also gives you additional insight into your conversation design. That is one more reason to construct the JSON directly instead of relying on a fulfillment library.

Direct Integrations

This might come as a big surprise to folks who chose Dialogflow mainly because it supports so many integrations out of the box – Facebook, Slack, Skype etc.

While this is very good to get started and to understand what Dialogflow can do, you will find that it is a good example of the Lowest Common Denominator not being very useful for the task at hand.

I have written a somewhat detailed explanation here, but the gist is that if you build a custom integration, the short term learning curve is a challenge, but the long term benefits are well worth the initial cost.

Also, I am aware of the sample code provided by the Dialogflow team for these custom integrations. I suggest you ignore that sample code and just build the integration from scratch. It is not very hard once you understand the basics (my Dialogflow REST API course can help you with that), and you can maintain the code much more easily because you are the one who wrote it.

<— 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