REST Resource: projects.locations.agents.webhooks

Resource: Webhook

Webhooks host the developer's business logic. During a session, webhooks allow the developer to use the data extracted by Dialogflow's natural language processing to generate dynamic responses, validate collected data, or trigger actions on the backend.

JSON representation
{
  "name": string,
  "displayName": string,
  "timeout": string,
  "disabled": boolean,

  // Union field webhook can be only one of the following:
  "genericWebService": {
    object (GenericWebService)
  },
  "serviceDirectory": {
    object (ServiceDirectoryConfig)
  }
  // End of list of possible types for union field webhook.
}
Fields
name

string

The unique identifier of the webhook. Required for the Webhooks.UpdateWebhook method. Webhooks.CreateWebhook populates the name automatically. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>.

displayName

string

Required. The human-readable name of the webhook, unique within the agent.

timeout

string (Duration format)

Webhook execution timeout. Execution is considered failed if Dialogflow doesn't receive a response from webhook at the end of the timeout period. Defaults to 5 seconds, maximum allowed timeout is 30 seconds.

A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".

disabled

boolean

Indicates whether the webhook is disabled.

Union field webhook. Required. The webhook configuration. webhook can be only one of the following:
genericWebService

object (GenericWebService)

Configuration for a generic web service.

serviceDirectory

object (ServiceDirectoryConfig)

Configuration for a Service Directory service.

GenericWebService

Represents configuration for a generic web service.

JSON representation
{
  "uri": string,
  "username": string,
  "password": string,
  "requestHeaders": {
    string: string,
    ...
  },
  "allowedCaCerts": [
    string
  ],
  "webhookType": enum (WebhookType),
  "httpMethod": enum (HttpMethod),
  "requestBody": string,
  "parameterMapping": {
    string: string,
    ...
  }
}
Fields
uri

string

Required. The webhook URI for receiving POST requests. It must use https protocol.

username
(deprecated)

string

The user name for HTTP Basic authentication.

password
(deprecated)

string

The password for HTTP Basic authentication.

requestHeaders

map (key: string, value: string)

The HTTP request headers to send together with webhook requests.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

allowedCaCerts[]

string (bytes format)

Optional. Specifies a list of allowed custom CA certificates (in DER format) for HTTPS verification. This overrides the default SSL trust store. If this is empty or unspecified, Dialogflow will use Google's default trust store to verify certificates. N.B. Make sure the HTTPS server certificates are signed with "subject alt name". For instance a certificate can be self-signed using the following command,

   openssl x509 -req -days 200 -in example.com.csr \
     -signkey example.com.key \
     -out example.com.crt \
     -extfile <(printf "\nsubjectAltName='DNS:www.example.com'")

A base64-encoded string.

webhookType

enum (WebhookType)

Optional. Type of the webhook.

httpMethod

enum (HttpMethod)

Optional. HTTP method for the flexible webhook calls. Standard webhook always uses POST.

requestBody

string

Optional. Defines a custom JSON object as request body to send to flexible webhook.

parameterMapping

map (key: string, value: string)

Optional. Maps the values extracted from specific fields of the flexible webhook response into session parameters. - Key: session parameter name - Value: field path in the webhook response

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

WebhookType

Represents the type of webhook configuration.

Enums
WEBHOOK_TYPE_UNSPECIFIED Default value. This value is unused.
STANDARD Represents a standard webhook.
FLEXIBLE Represents a flexible webhook.

HttpMethod

HTTP method to use when calling webhooks.

Enums
HTTP_METHOD_UNSPECIFIED HTTP method not specified.
POST HTTP POST Method.
GET HTTP GET Method.
HEAD HTTP HEAD Method.
PUT HTTP PUT Method.
DELETE HTTP DELETE Method.
PATCH HTTP PATCH Method.
OPTIONS HTTP OPTIONS Method.

ServiceDirectoryConfig

Represents configuration for a Service Directory service.

JSON representation
{
  "service": string,
  "genericWebService": {
    object (GenericWebService)
  }
}
Fields
service

string

Required. The name of Service Directory service. Format: projects/<Project ID>/locations/<Location ID>/namespaces/<Namespace ID>/services/<Service ID>. Location ID of the service directory must be the same as the location of the agent.

genericWebService

object (GenericWebService)

Generic Service configuration of this webhook.

Methods

create

Creates a webhook in the specified agent.

delete

Deletes the specified webhook.

get

Retrieves the specified webhook.

list

Returns the list of all webhooks in the specified agent.

patch

Updates the specified webhook.