If you are using one of the integrations options, and your agent needs more than static intent responses, you need to use fulfillment to connect your service to your agent. Connecting your service allows you to take actions based on end-user expressions and send dynamic responses back to the end-user. For example, if an end-user wants to schedule a haircut on Friday, your service can check your database and respond to the end-user with availability information for Friday.
Each intent has a setting to enable fulfillment. If an intent requires some action by your system or a dynamic response, you should enable fulfillment for the intent. If an intent without fulfillment enabled is matched, Dialogflow uses the static response you defined for the intent.
When an intent with fulfillment enabled is matched, Dialogflow sends a request to your webhook service with information about the matched intent. Your system can perform any required actions and respond to Dialogflow with information for how to proceed. The following diagram shows the processing flow for fulfillment.
- The end-user types or speaks an expression.
- Dialogflow matches the end-user expression to an intent and extracts parameters.
- Dialogflow sends a webhook request message to your webhook service. This message contains information about the matched intent, the action, the parameters, and the response defined for the intent.
- Your service performs actions as needed, like database queries or external API calls.
- Your service sends a webhook response message to Dialogflow. This message contains the response that should be sent to the end-user, which may or may not be the same as the response defined for the intent.
- Dialogflow sends the response to the end-user.
- The end-user sees or hears the response.