Webhook
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Siêu dữ liệu về các loại webhook. Nếu bạn đang sử dụng inlineCloudFunction
, mã nguồn của bạn phải nằm trong một thư mục có cùng tên với giá trị của khoá executeFunction
. Ví dụ: giá trị my_webhook
cho khoá executeFunction
sẽ có cấu trúc mã như sau: – /webhooks/my_webhook.yaml
– /webhooks/my_webhook/index.js
– /webhooks/my_webhook/package.json
Trình bày theo 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 . |
Trường |
handlers[] |
object (Handler )
Danh sách trình xử lý cho webhook này.
|
Trường kết hợp webhook_type . Chỉ hỗ trợ một loại webhook. webhook_type chỉ có thể là một trong những trạng thái sau đây: |
httpsEndpoint |
object (HttpsEndpoint )
Điểm cuối HTTPS của webhook tuỳ chỉnh.
|
inlineCloudFunction |
object (InlineCloudFunction )
Siêu dữ liệu cho chức năng đám mây được triển khai từ mã trong thư mục webhook.
|
Trình xử lý
Khai báo tên của trình xử lý webhoook. Một webhook có thể được đăng ký nhiều trình xử lý. Bạn có thể gọi những trình xử lý này từ nhiều vị trí trong dự án Actions (Hành động).
Trình bày theo YAML |
name: string |
Trường |
name |
string
Bắt buộc. Tên của trình xử lý. Phải là duy nhất trên tất cả trình xử lý của dự án Actions. Bạn có thể kiểm tra tên của trình xử lý này để gọi đúng hàm trong mã nguồn thực hiện đơn hàng của mình.
|
HttpsEndpoint
Điểm cuối REST để thông báo nếu bạn không sử dụng trình chỉnh sửa cùng dòng.
Trình bày theo YAML |
baseUrl: string
httpHeaders:
string: string
endpointApiVersion: integer |
Trường |
baseUrl |
string
URL cơ sở HTTPS cho điểm cuối thực hiện của bạn (không hỗ trợ HTTP). Tên trình xử lý được thêm vào đường dẫn URL cơ sở sau dấu hai chấm (theo hướng dẫn về quy tắc trong https://cloud.google.com/apis/design/custom_methods). Ví dụ: URL cơ sở là "https://gHành động.service.com/api" sẽ nhận được yêu cầu có URL "https://gHành động.service.com/api:{method}".
|
endpointApiVersion |
integer
Phiên bản của giao thức mà điểm cuối sử dụng. Đây là giao thức dùng chung của tất cả các phương thức thực hiện và không dành riêng cho phương thức thực hiện của Google.
|
InlineCloudFunction
Lưu giữ siêu dữ liệu của một Chức năng đám mây cùng dòng được triển khai từ thư mục webhook.
Trình bày theo YAML |
executeFunction: string |
Trường |
executeFunction |
string
Tên của điểm truy cập Hàm đám mây. Giá trị của trường này phải khớp với tên của phương thức được xuất từ mã nguồn.
|
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\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. |"]]