Browse Notifications

stable · guide · 0.1.0

送出 Notification Intent

準備通知資源

請 Platform Operator 在 sandbox 建立並核准 Sender Profile、template 與已驗證的 Delivery Endpoint。Project Credential 需要 notifications:write scope;marketing lane 另需該 endpoint 對指定 purpose 的有效 consent。

Email template 的 {{variable}} 一律做 HTML escaping。只有 template owner 明確寫成 {{{variable}}} 時,該 body variable 才會當成 project-owned HTML;subject 不允許 raw variable。若 Project Backend 傳入完整 HTML email,template 應以 {{{body}}} 明確宣告這個信任邊界。

建立 email Intent

同一業務通知在結果不明時必須沿用原本的 Idempotency-Key 與完全相同的 body。

Shell example
: "${MINICENTER_PROJECT_CREDENTIAL:?set the sandbox Project Credential}"
: "${MINICENTER_URL:=https://sandbox.minicenter.otus.tw}"
curl --fail-with-body \
  --request POST \
  --header "Authorization: Bearer ${MINICENTER_PROJECT_CREDENTIAL}" \
  --header "Idempotency-Key: docs-notification-1" \
  --header "Content-Type: application/json" \
  --data '{"sender_profile_id":"81000000-0000-4000-8000-000000000001","template_key":"sandbox-welcome","locale":"zh-TW","endpoint_id":"82000000-0000-4000-8000-000000000001","variables":{"display_name":"Sandbox user"}}' \
  "${MINICENTER_URL}/api/v1/notification-intents"

回應的 intent_iddelivery_id 是穩定識別碼。status 是建立當下的 delivery 狀態,不應被解讀為已送達證明。

建立 FCM、APNs、LINE 或 Web Push Intent

非 email channel 使用相同的 credential 與 idempotency 規則,但呼叫 POST /channel-notification-intents,並提供已驗證 endpoint 的 purpose。建立後可用回應中的 delivery_id 查詢 outcome。