Fulfillment

A fulfillment can do one or more of the following actions at the same time:

  • Generate rich message responses.
  • Set parameter values.
  • Call the webhook.

Fulfillments can be called at various stages in the Page or Form lifecycle. For example, when a DetectIntentRequest drives a session to enter a new page, the page's entry fulfillment can add a static response to the QueryResult in the returning DetectIntentResponse, call the webhook (for example, to load user data from a database), or both.

JSON representation
{
  "messages": [
    {
      object (ResponseMessage)
    }
  ],
  "webhook": string,
  "returnPartialResponses": boolean,
  "tag": string,
  "setParameterActions": [
    {
      object (SetParameterAction)
    }
  ],
  "conditionalCases": [
    {
      object (ConditionalCases)
    }
  ],
  "advancedSettings": {
    object (AdvancedSettings)
  },
  "enableGenerativeFallback": boolean
}
Fields
messages[]

object (ResponseMessage)

The list of rich message responses to present to the user.

webhook

string

The webhook to call. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>.

returnPartialResponses

boolean

Whether Dialogflow should return currently queued fulfillment response messages in streaming APIs. If a webhook is specified, it happens before Dialogflow invokes webhook. Warning: 1) This flag only affects streaming API. Responses are still queued and returned once in non-streaming API. 2) The flag can be enabled in any fulfillment but only the first 3 partial responses will be returned. You may only want to apply it to fulfillments that have slow webhooks.

tag

string

The value of this field will be populated in the WebhookRequest fulfillmentInfo.tag field by Dialogflow when the associated webhook is called. The tag is typically used by the webhook service to identify which fulfillment is being called, but it could be used for other purposes. This field is required if webhook is specified.

setParameterActions[]

object (SetParameterAction)

Set parameter values before executing the webhook.

conditionalCases[]

object (ConditionalCases)

Conditional cases for this fulfillment.

advancedSettings

object (AdvancedSettings)

Hierarchical advanced settings for this fulfillment. The settings exposed at the lower level overrides the settings exposed at the higher level.

enableGenerativeFallback

boolean

If the flag is true, the agent will utilize LLM to generate a text response. If LLM generation fails, the defined responses in the fulfillment will be respected. This flag is only useful for fulfillments associated with no-match event handlers.

SetParameterAction

Setting a parameter value.

JSON representation
{
  "parameter": string,
  "value": value
}
Fields
parameter

string

Display name of the parameter.

value

value (Value format)

The new value of the parameter. A null value clears the parameter.

ConditionalCases

A list of cascading if-else conditions. Cases are mutually exclusive. The first one with a matching condition is selected, all the rest ignored.

JSON representation
{
  "cases": [
    {
      object (Case)
    }
  ]
}
Fields
cases[]

object (Case)

A list of cascading if-else conditions.

Case

Each case has a Boolean condition. When it is evaluated to be True, the corresponding messages will be selected and evaluated recursively.

JSON representation
{
  "condition": string,
  "caseContent": [
    {
      object (CaseContent)
    }
  ]
}
Fields
condition

string

The condition to activate and select this case. Empty means the condition is always true. The condition is evaluated against [form parameters][Form.parameters] or [session parameters][SessionInfo.parameters].

See the conditions reference.

caseContent[]

object (CaseContent)

A list of case content.

CaseContent

The list of messages or conditional cases to activate for this case.

JSON representation
{

  // Union field cases_or_message can be only one of the following:
  "message": {
    object (ResponseMessage)
  },
  "additionalCases": {
    object (ConditionalCases)
  }
  // End of list of possible types for union field cases_or_message.
}
Fields
Union field cases_or_message. Either a message is returned or additional cases to be evaluated. cases_or_message can be only one of the following:
message

object (ResponseMessage)

Returned message.

additionalCases

object (ConditionalCases)

Additional cases to be evaluated.