diff --git a/assets/fulfillment-unavailability.png b/assets/fulfillment-unavailability.png new file mode 100644 index 0000000..6af4efa Binary files /dev/null and b/assets/fulfillment-unavailability.png differ diff --git a/guides/dialogflow/fulfillment/README.md b/guides/dialogflow/fulfillment/README.md new file mode 100644 index 0000000..cd8d246 --- /dev/null +++ b/guides/dialogflow/fulfillment/README.md @@ -0,0 +1,9 @@ +# Dialogflow Fulfillment + +Fulfillment is a part of Google Dialogflow platform which allows developers to provide more dynamic responses by using webhooks. When you enable fulfillment for an intent, Dialogflow responds to that intent by calling a service that you define. Web service will receive a POST request from Dialogflow in the form of the response to a user query matched by intents with webhook enabled. To read more. + +The following are some quick guides to common features we use: + +* [Fulfillment Unavailability Handler](fulfillment-unavailability-handler.md) + +For more information visit https://cloud.google.com/dialogflow/es/docs/fulfillment-overview diff --git a/guides/dialogflow/fulfillment/fulfillment-unavailability-handler.md b/guides/dialogflow/fulfillment/fulfillment-unavailability-handler.md new file mode 100644 index 0000000..84e1ff3 --- /dev/null +++ b/guides/dialogflow/fulfillment/fulfillment-unavailability-handler.md @@ -0,0 +1,29 @@ +# Dialogflow Fulfillment Unavailability Handler + +Sometimes conversational journeys require some response from fulfillment service. For example: in the end of ID&V process fulfillment service should return some [Followup Event Input](https://cloud.google.com/dialogflow/es/docs/fulfillment-webhook#event), but fulfillment service hasn't responded within 5(by default) seconds for some reasons. In this case Dialogflow will respond with the default text response which breaks normal flow as fulfillment service can't confirm result of the ID&V process. That's why it's important to escalate such calls to some "failover" endpoint. + +In order to escalate or redirect calls which haven't received any response from the fulfillment service we can do the following: + +1. Create a new intent which will be triggered in case of fulfillment unavailability with the following details: + +- Input contexts: `fulfillment-requested` +- Output contexts: `fulfillment-requested(2)` +- Training phrases: any 3-5 phrases which marked as `@sys.any` entity +- Parameters: any extra parameters which you need to handle a call. For example, in order to escalate a call you can add `action`, `stop_recording` and `router_name` parameters +- Fulfillment: make sure webhook is disabled for this intent + +Example of Fulfillment Unavailability intent: + +![fulfillment-unavailability-failover](../../../assets/fulfillment-unavailability.png) + +2. Add `fulfillment-requested(3)` output context To all intents which expect any response form fulfillment service + +3. Add this output context to all your fulfillment responses: + +``` +{ + lifespanCount: 0, + name: `${sessionid}/contexts/fulfillment-requested` +} +``` +This response won't allow DF to match an intent which we created in step 1 as it removes `fulfillment-requested` context by setting `lifespanCount: 0`. If fulfillment is not available and can't delete `fulfillment-requested` context, next utterance will match "fulfillment unavailability" intent.