I was recently asked about integrating a Dialogflow health chatbot with the Infermedica API. While I haven’t personally done this yet, I realized that I have been getting questions about API integrations recently, and they all don’t mean the same thing.
Here are some of the types of APIs you will be dealing with when building Dialogflow chatbots.
The API of your Dialogflow agent
Dialogflow allows programmatic access to the agent you build inside your console.
Consider the Chemistry chatbot I built for my Intro to Dialogflow course.
I can interact with my Chemistry bot in multiple ways. For example, I could simply use what is now called the Dialogflow Simulator on the top right of the Dialogflow’s web interface (it used to be called the Dialogflow test console).
But you can also use it from a web demo.
Under the hood, when you use the built in web demo, you are programmatically calling the API for the agent.
The channel API
If you look under integrations tab, you will notice that Dialogflow provides a whole bunch of integrations with external messaging channels such as Slack, Skype, Twitter, Telegram etc.
How do these integrations work? Usually, all these messaging channels expose their own API. For example Facebook Messenger will have an API which will tell external applications what they should do if they want to send a message to a given Messenger user.
The Dialogflow team utilized these APIs to build out a chat interface with their Dialogflow agents.
External web API
In addition, you also have external web APIs. I have used the Internet Chuck Norris Database API to build a Chuck Norris joke bot, for example.
The important thing to understand about calling web APIs such as the Chuck Norris Joke API is that you can only do so from inside your webhook code.
In the case of the Infermedica API, you will need to call it from your webhook. Since Dialogflow imposes some limits on how long a webhook call can take before it times out (5 seconds as of this writing), you need to make sure that any API calls you make from your webhook code returns a response quickly.
The webhook itself is similar to an API
In addition, to complicate matters further, some people refer to the webhook itself as being similar to an API (it uses similar principles). Some might say, a webhook is like an API to the business logic of your chatbot. I don’t think this is common usage, but it is something that you might want to keep in mind.
You need to be clear what API you are referring to, as well as how you will use it, while talking about Dialogflow API integrations. Once you do this, it will be much easier to create your chatbot specifications.
This website contains affiliate links. See the disclosure page for more details.
Check out my free YouTube courses Dialogflow CX Beginner Tutorial Dialogflow ES vs CX using a Decision Tree Bot Intro to NLU for technical non-programmers Better Dialogflow ES Bots Using the CTFS Framework Search the autogenerated transcripts of all my YouTube videos
"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