Some time back, I put up a survey on my website asking readers what they find most challenging about learning Dialogflow. The most challenging topic, not too surprisingly, was webhooks a.k.a fulfillment.
This prompted me to write an article about why it is so hard to find good documentation for Dialogflow webhooks. And unfortunately it has only gotten even more difficult since I wrote it. And in this article I am going to explain why.
Challenges with learning Dialogflow webhooks
There is a lot of documentation you see for Dialogflow webhooks which is quite out of date. This is actually due to a combination of 4 different factors.
API version change
Did you know that the API version you set inside Dialogflow makes a difference to the webhook code you write?
However, you will see a lot of tutorials around the web (including some on my website) which are still based on the v1 API. From the comments on these articles, I can see that folks are not aware of this difference.
NodeJS learning curve
You will find a lot of documentation for Dialogflow using NodeJS, and this is even more true for integrations such as Google Assistant. The Dialogflow fulfillment library, for example, is only available in NodeJS to the best of my knowledge.
Now this is a matter of opinion I suppose, but the fundamentally "everything async" nature of NodeJS is not very suited for beginner tutorials.
Churn of Dialogflow libraries
How many different tools has the Dialogflow team released to help us with our Dialogflow development needs?
Here is a fulfillment library, an Actions SDK, the Actions on Google NodeJS client library, with each of them having different versions for Dialogflow API v1 and v2, plus different resources explaining how to migrate between them based on what you were using before 🙂
[And don't ask me. I have stopped trying to follow it for now. Let it all churn, and let a winner emerge. I will look into it at that point]
Inline editor + package.json + Firebase cloud functions updates
When Dialogflow first created its inline editor, I thought it was a wonderful feature. And it uses Firebase cloud functions, which is by all measures an amazing piece of technology in isolation. But the combination is not good.
When you try and combine the inline editor (with its package.json requirements) with Firebase cloud functions (with its own documentation churn issues), what you get is just an amazing hodge-podge of tutorials on the web which all have one thing in common - they don't actually work as written.
Its not a surprise that it is so challenging to find good documentation for Dialogflow webhooks.
My Webhooks course
I have created a Dialogflow Webhooks course where I have attempted to focus on the core material without getting sidetracked with all the different challenges of "infrastructure setup". And I have hopefully created a course which will be not only easy to understand, but also one where it will be easy for learners to fully replicate everything I am teaching.
I did this by making some unconventional choices for the tech stack.
My tech choices
In a way, I decided to handle it by moving far away from the bleeding edge.
Instead, I made three choices focused on teachability - low documentation churn, ease of explanation, ease with which students can replicate my tutorials.
PHP is the programming language I am using because it is reasonably easy to read and explain PHP code. In addition, the tooling around PHP is actually very stable. Plus, compared to NodeJS, almost no one is writing Dialogflow tutorials for PHP programmers, which is strange considering that it powers a large percentage of the internet.
This is a service which lets you create REST API mocks quickly. In my view, it is the easiest way to understand what is happening under the hood in Dialogflow fulfillment. I use it as the basis to explain how the JSON requests and responses work.
This is a "database as a REST service". This way, all students of the course can focus on the Dialogflow aspects of the lessons and not get stuck because they couldn't get their database set up, or the DB connection working, and so on.
About the course
Now that I have explained my choices for the tech stack I use for the course, here is what you can learn from the course
- Understand the request-response lifecycle (see full chapter preview here)
- Do simple math in your webhook
- Call an external API from your webhook without using parameters
- Call an external API from your webhook using parameters
- Read from restdb.io database in your webhook
- Write to restdb.io database in your webhook
- Manipulate contexts from your webhook
- Slot filling using webhooks (check out the full chapter preview here)
- You also get the agent ZIP files and the PHP code files included
Total time ~ 2 hours 30 minutes
You can use this link to get a $10 off discount on the course till end of day Nov 20th 2018 (UTC time).