跳到主要內容

上報一次 Embedded Signup 工作階段事件

POST/v1/onboarding/es-events

上報一次 Embedded Signup 工作階段事件(客戶放棄在哪一個畫面、或客戶自助回報錯誤)。恆 202。

驗證

請求標頭攜帶 Authorization: Bearer <API_KEY>,所需 scope:onboarding:write。API Key 的可存取資源由目前授權範圍決定。

請求​

Base URL:https://api.bluehola.com

請求本文​

請求本文為必填。

請求本文欄位​

欄位類型必填說明
portfolioIdstring否這次流程針對的 Business Portfolio,bm_...。與 customerEntityId 二選一(恰好一個)
customerEntityIdstring否客戶主體 ID,cust_...。依客戶發起接入時使用,此時授權前還沒有 Portfolio。與 portfolioId 二選一(恰好一個)
eventstring是ES message 事件的 event 值:FINISH* / CANCEL / ERROR
esVersionv2 | v3 | v4否發起時用的 ES 版本
currentStepstring否放棄時所在的畫面,如 PHONE_NUMBER_SETUP
errorCodestring否客戶在流程裡自助回報錯誤時 Meta 給的錯誤代碼
errorMessagestring否同上,展示給客戶的那句錯誤文案
metaSessionIdstring否Meta 的 session_id——找 Meta 支援時必須提供
timestampinteger否Meta 給的 unix 秒(僅回報錯誤事件才有)

Content-Type:application/json 範例:

{
"customerEntityId": "cust_x",
"event": "CANCEL",
"currentStep": "PHONE_NUMBER_SETUP",
"esVersion": "v4"
}

Schema:

{
"type": "object",
"properties": {
"portfolioId": {
"type": "string",
"description": "string · 選填 — 這次流程針對的 Business Portfolio,bm_...。與 customerEntityId 二選一(恰好一個)"
},
"customerEntityId": {
"type": "string",
"description": "string · 選填 — 客戶主體 ID,cust_...。依客戶發起接入時使用,此時授權前還沒有 Portfolio。與 portfolioId 二選一(恰好一個)"
},
"event": {
"type": "string",
"description": "string · 必填 — ES message 事件的 event 值:FINISH* / CANCEL / ERROR"
},
"esVersion": {
"type": "string",
"description": "v2 | v3 | v4 · 選填 — 發起時用的 ES 版本"
},
"currentStep": {
"type": "string",
"description": "string · 選填 — 放棄時所在的畫面,如 PHONE_NUMBER_SETUP"
},
"errorCode": {
"type": "string",
"description": "string · 選填 — 客戶在流程裡自助回報錯誤時 Meta 給的錯誤代碼"
},
"errorMessage": {
"type": "string",
"description": "string · 選填 — 同上,展示給客戶的那句錯誤文案"
},
"metaSessionId": {
"type": "string",
"description": "string · 選填 — Meta 的 session_id——**找 Meta 支援時必須提供**"
},
"timestamp": {
"type": "string",
"description": "integer · 選填 — Meta 給的 unix 秒(僅回報錯誤事件才有)"
}
},
"required": [
"event"
],
"example": {
"customerEntityId": "cust_x",
"event": "CANCEL",
"currentStep": "PHONE_NUMBER_SETUP",
"esVersion": "v4"
}
}

回應​

狀態碼說明
202Accepted
4xx用戶端錯誤

通用錯誤信封及處理建議見錯誤代碼。

補充說明​

為什麼要有這個 API​

Embedded Signup 的工作階段資訊(session info logging,ES v3 起預設開啟)只在瀏覽器的一次 message 事件裡出現,Graph API 上查不到。裡面有兩樣東西丟了就再也拿不回來:客戶在哪一個畫面放棄(唯一的導入漏斗資料),以及客戶自助回報錯誤時的 session_id(找 Meta 支援的憑證)。

它是排查資料,不是業務寫入​

恆回傳 202,不驗證業務語意,落地儲存失敗也只記日誌。前端應當 fire-and-forget:一次上報失敗絕不能變成客戶畫面上的錯誤。請求內容是 .strict() 的,多傳欄位會 400——尤其不要把 code 傳進來,那是 30 秒有效的憑證,不進這張表。