Skip to content

Commit

Permalink
Add fulfillment-unavailability article
Browse files Browse the repository at this point in the history
Why:

* Explain how to handle fulfillment unavailability cases

How:

* Created a new section for fulfillment best practices
  • Loading branch information
VitaliiProdanSabio committed May 31, 2021
1 parent 386811e commit 2ccdcd4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
Binary file added assets/fulfillment-unavailability.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions guides/dialogflow/fulfillment/README.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 2ccdcd4

Please sign in to comment.