What is Dialogflow fulfillment (w/ examples)
The concept of fulfillment webhooks is one of the most complicated in Dialogflow. In order to understand it, you need to be familiar with the key concepts of Dialogflow which are intents and entities.
Dialogflow is built to extract and classify important information into intents, entities, and sentiment. Then it sends the information to a fulfillment webhook for analysis.
According to the Cambridge Dictionary:
- Intent: “to be determined to do or achieve something”
- Entity: “something that exists apart from other things, having its own independent existence”
- Sentiment: “a general feeling, attitude, or opinion about something”
But how does that relate with Dialogflow 🤔 ?
Examples of how you can use Dialogflow fulfillment
Check your supply before an order
In the following sentence:
"The Tanuki wants to eat a strawberry ice cream."
Dialogflow understands that the tanuki's intent is to eat something. He is determined to eat that delicious ice cream.
Different Tanukis can have the same intent to eat, but they might not want to eat the same thing.
It can be a different type of ice cream, but it can also be a completely different entity like an apple or something else.
In our case, the entity would be "ice cream" and the entity type would be "strawberry".
But all this information is basically useless for your business if you are not informed about it. How could you satisfy the tanuki’s needs if you don’t know about it?
That's what fulfillment is all about. If you now refer to the Oxford dictionary “to fulfill” means
to meet the requirements of something, like a business order for example.
The goal is to determine what to do once the user's input's analysis is done. How do we fulfill the user's request?
In this example, you would like to check in your database whether or not there is enough ice cream to make a strawberry ice cream. If not, you may want to suggest another flavor.
Dialogflow cannot do that on its own. It can tell that the Tanuki want ice cream, but it does not know your business and it does not know your processes. Dialogflow can’t check your inventory to not know how much ice cream is left.
This is where the fulfillment webhooks come in handy. Without going into much detail, Dialogflow sends an HTTP POST request to an URL you control and sends the information to you as a JSON. Once you have the information, you have to code what to do with it.
Book an appointment and check your calendar
Now, let’s say your prospect can book an appointment with your team through your chatbot. For example, Mr. Tanuki would like to schedule a call with you next Thursday at 4 pm.
He can say something like:
“ Can you call me Thursday at 4 pm?”
Dialogflow can understand and extract the intent of booking a call, and it can extract the date and time of this call. In this case, “call” would be the intent, and “Thursday at 4 pm” would be the date entity.
However, Dialogflow can’t check your calendar to see if you are available at that time and even if it could, Dialogflow wouldn’t be able to schedule this call and book it in your calendar.
Again, this is where Dialogflow fulfillment webhook comes into play. A request is sent to your webhook URL. It contains the information from M.Tanuki and you can now use it to check your calendar and book a meeting automatically.
How does it work?
Now that you know what are intents and entities, let's see how it works in practice.
1. The user sends a request.
“I’m really hungry and want to eat a strawberry ice cream”
2. Dialogflow extracts intents, entities from the input
“intent: eat, entities: strawberry ice-cream”
3. Dialogflow sends the information to your webhook
4. The webhook service interacts with your database or external services in order to build the answer that will be sent back to Dialogflow. For example, it checks the amount of strawberry cream available.
5. Your answer is sent back to Dialogflow.
6. The information is sent to the user
“Sure, your Strawberry ice cream will be ready in 5 minutes”
“There is no more strawberry cream. Would you enjoy Raspberry Ice Cream instead ?”
7. The user sees the response and the cycle of conversation can start again.
How to build a webhook?
Once we have understood this workflow, how can you build a webhook?
If you go into the fulfillment panel of Dialogflow, you can see there are two options offered by Dialogflow.
- Inline Editor with Google Cloud Functions
You have to deploy a server with some specific code to receive and analyze what Dialogflow sends over to you. Concretely, in Dialogflow you will need to enter the URL of your server (with optional authentication information).
This means that you will have to write some code, host a server and manage it.
With Cloud Function
You have to deploy a cloud function connected to Dialogflow. This is a paid service of Google. That removes the hassle of hosting and managing a server, but you still have to understand the documentation and write the code.
However, both these solutions require some technical expertise plus some technical resources that could be used elsewhere for your business.
That's why Ideta has developed a no-code solution to remove the hassle of coding Dialogflow fulfillment webhooks.
Once your Dialogflow account is connected to Ideta, you can manage your intents and entities more seamlessly. And since we are directly connected to Dialogflow, you just have to select what you want to do with the information received from Dialogflow in the no-code interface.
Basically, you do not have to bother reading Dialogflow's documentation and you can focus on your core business.
Ideta’s Dialogflow fulfillment example
To illustrate that, let's make a chatbot that lets you order pizza, we will connect this chatbot to Dialogflow and use webhook fulfillment.
In our AI interface, you have to add intents sentence examples. These are the ground foundation so Dialogflow can start to understand some sentence structures and learn from them. You can continuously update and add new sentences to make Dialogflow learn faster.
In our example, these are extra ingredients a customer can add to their pizza.
Then, you have to indicate to Dialogflow what are the precise entities in the sentences. Don’t forget to add some synonyms or frequently misspelled words. This will give Dialogflow more leverage to learn.
Now that Dialogflow has enough information to learn and understand what the user wants, you have to tell it what to do with the information. This can be done easily in our no-code interface.
If your user’s intent is to order a pizza, redirect them to the order bubble
We hope these Dialogflow fulfillment examples helped you understand the core concepts of Dialogflow, which are intents and entities.
At Ideta we automated this so it’s easier to use and you can concentrate on creating a chatbot that delivers the best service to your customers.
This is quite a technical topic so if you have any questions don’t hesitate to send us a message via the chatbot at the bottom right of this screen or by email at firstname.lastname@example.org