Webhook
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
不同类型的网络钩子的元数据。如果您使用的是 inlineCloudFunction
,则源代码必须位于与 executeFunction
键的值相同的目录中。例如,executeFunction
键的值为 my_webhook
,代码结构可能如下所示:- /webhooks/my_webhook.yaml
- /webhooks/my_webhook/index.js
- /webhooks/my_webhook/package.json
YAML 表示法 |
handlers:
- object (Handler )
# Union field webhook_type can be only one of the following:
httpsEndpoint:
object (HttpsEndpoint )
inlineCloudFunction:
object (InlineCloudFunction )
# End of list of possible types for union field webhook_type . |
字段 |
handlers[] |
object (Handler )
此网络钩子的处理程序列表。
|
联合字段 webhook_type 。仅支持一种 webhook 类型。webhook_type 只能是下列其中一项: |
httpsEndpoint |
object (HttpsEndpoint )
自定义 webhook HTTPS 端点。
|
inlineCloudFunction |
object (InlineCloudFunction )
从 webhook 文件夹中的代码部署的 Cloud Functions 函数的元数据。
|
Handler
声明 webhook 处理程序的名称。网络钩子可以注册多个处理程序。这些处理程序可以从 Actions 项目中的多个位置调用。
字段 |
name |
string
必需。处理程序的名称。在 Actions 项目的所有处理程序中必须是唯一的。您可以查看此处理程序的名称,以便在您的执行方式源代码中调用正确的函数。
|
HttpsEndpoint
REST 端点,以在您未使用内嵌编辑器时发出通知。
YAML 表示法 |
baseUrl: string
httpHeaders:
string: string
endpointApiVersion: integer |
字段 |
baseUrl |
string
执行方式端点的 HTTPS 基准网址(不支持 HTTP)。处理程序名称会附加到基准网址路径中的冒号后(遵循 https://cloud.google.com/apis/design/custom_methods) 中的样式指南)。例如,基准网址“https://gactions.service.com/api”会收到带有网址“https://gactions.service.com/api:{method}”的请求。
|
endpointApiVersion |
integer
端点使用的协议的版本。这是所有执行方式类型所共用的协议,并非特定于 Google 执行方式类型。
|
InlineCloudFunction
保存从 webhook 文件夹部署的内嵌 Cloud Functions 函数的元数据。
YAML 表示法 |
executeFunction: string |
字段 |
executeFunction |
string
Cloud Functions 函数入口点的名称。此字段的值应与从源代码导出的方法的名称一致。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eWebhooks use YAML to define metadata for different handler types like HTTPS endpoints and inline Cloud Functions.\u003c/p\u003e\n"],["\u003cp\u003eInline Cloud Functions require source code in a directory matching the \u003ccode\u003eexecuteFunction\u003c/code\u003e value.\u003c/p\u003e\n"],["\u003cp\u003eHandlers specify the webhook's name and can be invoked from various points in your Actions project.\u003c/p\u003e\n"],["\u003cp\u003eHTTPS endpoints define the base URL and optional HTTP headers for external fulfillment.\u003c/p\u003e\n"],["\u003cp\u003eInline Cloud Functions use the \u003ccode\u003eexecuteFunction\u003c/code\u003e field to identify the entry point in your source code.\u003c/p\u003e\n"]]],[],null,["# Webhook\n\n- [YAML representation](#SCHEMA_REPRESENTATION)\n- [Handler](#Handler)\n - [YAML representation](#Handler.SCHEMA_REPRESENTATION)\n- [HttpsEndpoint](#HttpsEndpoint)\n - [YAML representation](#HttpsEndpoint.SCHEMA_REPRESENTATION)\n- [InlineCloudFunction](#InlineCloudFunction)\n - [YAML representation](#InlineCloudFunction.SCHEMA_REPRESENTATION)\n\nMetadata for different types of webhooks. If you're using `inlineCloudFunction`, your source code must be in a directory with the same name as the value for the `executeFunction` key. For example, a value of `my_webhook` for the`executeFunction` key would have a code structure like this: - `/webhooks/my_webhook.yaml` - `/webhooks/my_webhook/index.js` - `/webhooks/my_webhook/package.json`\n\n| YAML representation ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` handlers: - object (/assistant/actionssdk/reference/rest/Shared.Types/Webhook#Handler) # Union field `webhook_type` can be only one of the following: httpsEndpoint: object (/assistant/actionssdk/reference/rest/Shared.Types/Webhook#HttpsEndpoint) inlineCloudFunction: object (/assistant/actionssdk/reference/rest/Shared.Types/Webhook#InlineCloudFunction) # End of list of possible types for union field `webhook_type`. ``` |\n\n| Fields ||\n|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| `handlers[]` | `object (`[Handler](/assistant/actionssdk/reference/rest/Shared.Types/Webhook#Handler)`)` List of handlers for this webhook. |\n| Union field `webhook_type`. Only one webhook type is supported. `webhook_type` can be only one of the following: |||\n| `httpsEndpoint` | `object (`[HttpsEndpoint](/assistant/actionssdk/reference/rest/Shared.Types/Webhook#HttpsEndpoint)`)` Custom webhook HTTPS endpoint. |\n| `inlineCloudFunction` | `object (`[InlineCloudFunction](/assistant/actionssdk/reference/rest/Shared.Types/Webhook#InlineCloudFunction)`)` Metadata for cloud function deployed from code in the webhooks folder. |\n\nHandler\n-------\n\nDeclares the name of the webhoook handler. A webhook can have multiple handlers registered. These handlers can be called from multiple places in your Actions project.\n\n| YAML representation ||\n|----------------------|---|\n| ``` name: string ``` |\n\n| Fields ||\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. Name of the handler. Must be unique across all handlers the Actions project. You can check the name of this handler to invoke the correct function in your fulfillment source code. |\n\nHttpsEndpoint\n-------------\n\nREST endpoint to notify if you're not using the inline editor.\n\n| YAML representation ||\n|---------------------------------------------------------------------------------|---|\n| ``` baseUrl: string httpHeaders: string: string endpointApiVersion: integer ``` |\n\n| Fields ||\n|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `baseUrl` | `string` The HTTPS base URL for your fulfillment endpoint (HTTP is not supported). Handler names are appended to the base URL path after a colon (following the style guide in \u003chttps://cloud.google.com/apis/design/custom_methods)\u003e. For example a base URL of 'https://gactions.service.com/api' would receive requests with URL 'https://gactions.service.com/api:{method}'. |\n| `httpHeaders` | `map (key: string, value: string)` Map of HTTP parameters to be included in the POST request. An object containing a list of `\"key\": value` pairs. Example: `{ \"name\": \"wrench\", \"mass\": \"1.3kg\", \"count\": \"3\" }`. |\n| `endpointApiVersion` | `integer` Version of the protocol used by the endpoint. This is the protocol shared by all fulfillment types and not specific to Google fulfillment type. |\n\nInlineCloudFunction\n-------------------\n\nHolds the metadata of an inline Cloud Function deployed from the webhooks folder.\n\n| YAML representation ||\n|---------------------------------|---|\n| ``` executeFunction: string ``` |\n\n| Fields ||\n|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| `executeFunction` | `string` The name of the Cloud Function entry point. The value of this field should match the name of the method exported from the source code. |"]]