Webhook

不同類型 Webhook 的中繼資料。如果您使用 inlineCloudFunction,原始碼所在的目錄必須與 executeFunction 鍵的值相同。舉例來說,如果值為 my_webhook,代表「executeFunction」鍵的程式碼結構如下:- /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 的處理常式清單。

聯集欄位 webhook_type。系統僅支援一種 Webhook 類型。webhook_type 只能是下列其中一項:
httpsEndpoint

object (HttpsEndpoint)

自訂 Webhook HTTPS 端點。

inlineCloudFunction

object (InlineCloudFunction)

從 Webhook 資料夾中的程式碼部署的 Cloud 函式中繼資料。

Handler

宣告 webhoook 處理常式的名稱。一個 Webhook 可以註冊多個處理常式。這些處理常式可在 Actions 專案中從多個位置呼叫。

YAML 表示法
name: string
欄位
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}」的要求。

httpHeaders

map (key: string, value: string)

要包含在 POST 要求中的 HTTP 參數對應。

這個物件中包含 "key": value 組合的清單,範例:{ "name": "wrench", "mass": "1.3kg", "count": "3" }

endpointApiVersion

integer

端點使用的通訊協定版本。這是所有執行要求類型共用的通訊協定,並非專指 Google 執行要求類型。

InlineCloudFunction

保留從 Webhook 資料夾部署的內嵌 Cloud 函式中繼資料。

YAML 表示法
executeFunction: string
欄位
executeFunction

string

Cloud 函式進入點的名稱。這個欄位的值應與從原始碼匯出的方法名稱相符。