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 |
Fields | |
---|---|
name |
The unique identifier of the webhook. Required for the |
display |
Required. The human-readable name of the webhook, unique within the agent. |
timeout |
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 ' |
disabled |
Indicates whether the webhook is disabled. |
Union field webhook . Required. The webhook configuration. webhook can be only one of the following: |
|
generic |
Configuration for a generic web service. |
service |
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 ], "oauthConfig": { object ( |
Fields | |
---|---|
uri |
Required. The webhook URI for receiving POST requests. It must use https protocol. |
username |
The user name for HTTP Basic authentication. |
password |
The password for HTTP Basic authentication. |
request |
The HTTP request headers to send together with webhook requests. An object containing a list of |
allowed |
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,
A base64-encoded string. |
oauth |
Optional. The OAuth configuration of the webhook. If specified, Dialogflow will initiate the OAuth client credential flow to exchange an access token from the 3rd party platform and put it in the auth header. |
service |
Optional. Indicate the auth token type generated from the Diglogflow service agent. The generated token is sent in the Authorization header. |
webhook |
Optional. Type of the webhook. |
http |
Optional. HTTP method for the flexible webhook calls. Standard webhook always uses POST. |
request |
Optional. Defines a custom JSON object as request body to send to flexible webhook. |
parameter |
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 |
OAuthConfig
Represents configuration of OAuth client credential flow for 3rd party API authentication.
JSON representation |
---|
{ "clientId": string, "clientSecret": string, "tokenEndpoint": string, "scopes": [ string ] } |
Fields | |
---|---|
client |
Required. The client ID provided by the 3rd party platform. |
client |
Required. The client secret provided by the 3rd party platform. |
token |
Required. The token endpoint provided by the 3rd party platform to exchange an access token. |
scopes[] |
Optional. The OAuth scopes to grant. |
ServiceAgentAuth
Indicate the auth token type generated from the Diglogflow service agent.
Enums | |
---|---|
SERVICE_AGENT_AUTH_UNSPECIFIED |
Service agent auth type unspecified. Default to ID_TOKEN. |
NONE |
No token used. |
ID_TOKEN |
Use ID token generated from service agent. This can be used to access Cloud Function and Cloud Run after you grant Invoker role to service-<PROJECT-NUMBER>@gcp-sa-dialogflow.iam.gserviceaccount.com . |
ACCESS_TOKEN |
Use access token generated from service agent. This can be used to access other Google Cloud APIs after you grant required roles to service-<PROJECT-NUMBER>@gcp-sa-dialogflow.iam.gserviceaccount.com . |
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 ( |
Fields | |
---|---|
service |
Required. The name of Service Directory service. Format: |
generic |
Generic Service configuration of this webhook. |
Methods |
|
---|---|
|
Creates a webhook in the specified agent. |
|
Deletes the specified webhook. |
|
Retrieves the specified webhook. |
|
Returns the list of all webhooks in the specified agent. |
|
Updates the specified webhook. |