Webhook

不同 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 的處理常式清單。

聯集欄位 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 函式進入點的名稱。這個欄位的值應與從原始碼匯出的方法名稱相符。