- [JSON representation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#SCHEMA_REPRESENTATION)
- [SetParameterAction](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#SetParameterAction)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#SetParameterAction.SCHEMA_REPRESENTATION)
- [ConditionalCases](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#ConditionalCases)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#ConditionalCases.SCHEMA_REPRESENTATION)
- [Case](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#Case)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#Case.SCHEMA_REPRESENTATION)
- [CaseContent](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#CaseContent)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#CaseContent.SCHEMA_REPRESENTATION)
- [GeneratorSettings](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#GeneratorSettings)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#GeneratorSettings.SCHEMA_REPRESENTATION)

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 `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.flows.pages#Page` or `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.flows.pages#Page.Form` lifecycle. For example, when a `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.conversations#DetectIntentRequest` drives a session to enter a new page, the page's entry fulfillment can add a static response to the `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.conversations#QueryResult` in the returning `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.conversations#DetectIntentResponse`, call the webhook (for example, to load user data from a database), or both.

| JSON representation |
|---|
| ``` { "messages": [ { object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/ResponseMessage`) } ], "webhook": string, "returnPartialResponses": boolean, "tag": string, "codeBlockFunction": string, "setParameterActions": [ { object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#SetParameterAction`) } ], "conditionalCases": [ { object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#ConditionalCases`) } ], "advancedSettings": { object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/AdvancedSettings`) }, "enableGenerativeFallback": boolean, "generators": [ { object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#GeneratorSettings`) } ] } ``` |

| Fields ||
|---|---|
| `messages[]` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/ResponseMessage`)`` The list of rich message responses to present to the user. |
| `webhook` | `string` The webhook to call. Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/webhooks/<WebhookID>`. |
| `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 `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/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. |
| `codeBlockFunction` | `string` Optional. The name of the code block function to execute, if this is a code block fulfillment. The code block itself is implied by the fulfillment's parent, e.g. a playbook. |
| `setParameterActions[]` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#SetParameterAction`)`` Set parameter values before executing the webhook. |
| `conditionalCases[]` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#ConditionalCases`)`` Conditional cases for this fulfillment. |
| `advancedSettings` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/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 `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#FIELDS.messages` in the fulfillment will be respected. This flag is only useful for fulfillments associated with no-match event handlers. |
| `generators[]` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#GeneratorSettings`)`` A list of Generators to be called during this fulfillment. |

## SetParameterAction

Setting a parameter value.

| JSON representation |
|---|
| ``` { "parameter": string, "value": value } ``` |

| Fields ||
|---|---|
| `parameter` | `string` Display name of the parameter. |
| `value` | ``value (`https://protobuf.dev/reference/protobuf/google.protobuf#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 (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#Case`) } ] } ``` |

| Fields ||
|---|---|
| `cases[]` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#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 (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#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](https://cloud.google.com/dialogflow/cx/docs/reference/condition). |
| `caseContent[]` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#CaseContent`)`` A list of case content. |

## CaseContent

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

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "message": { object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/ResponseMessage`) }, "additionalCases": { object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#ConditionalCases`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| Either a message is returned or additional cases to be evaluated. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `message` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/ResponseMessage`)`` Returned message. |
| `additionalCases` | ``object (`https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/Fulfillment#ConditionalCases`)`` Additional cases to be evaluated. |
| End of mutually exclusive fields. ||

## GeneratorSettings

Generator settings used by the LLM to generate a text response.

| JSON representation |
|---|
| ``` { "generator": string, "inputParameters": { string: string, ... }, "outputParameter": string } ``` |

| Fields ||
|---|---|
| `generator` | `string` Required. The generator to call. Format: `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/generators/<GeneratorID>`. |
| `inputParameters` | `map (key: string, value: string)` Map from \[placeholder parameter\]\[Generator.Parameter.id\] in the `https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.generators#Generator` to corresponding session parameters. By default, Dialogflow uses the session parameter with the same name to fill in the generator template. e.g. If there is a placeholder parameter `city` in the Generator, Dialogflow default to fill in the `$city` with `$session.params.city`. However, you may choose to fill `$city` with `$session.params.desination-city`. - Map key: \[parameter ID\]\[Genrator.Parameter.id\] - Map value: session parameter name An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `outputParameter` | `string` Required. Output parameter which should contain the generator response. |