Webhook 事件與欄位
事件類型
type | 送出時機 | data 另帶 |
|---|---|---|
appointment.created | 預約建立 | actor_type |
appointment.confirmed | 預約確認 | previous_status、actor_type |
appointment.cancelled | 預約取消 | previous_status、actor_type |
appointment.completed | 預約完成 | previous_status、actor_type |
appointment.no_show | 標記為爽約 | previous_status、actor_type |
appointment.rescheduled | 預約開始時間改變 | previous、actor_type |
appointment.updated | 預約的其他內容改變,例如服務、人員、金額、付款、訂金或顧客 | 無 |
customer.created | 顧客新增,或取消封存 | customer,沒有 appointment |
customer.updated | 顧客的姓名、Email、電話或偏好語系改變 | customer,沒有 appointment |
customer.deleted | 顧客封存或刪除 | customer,沒有 appointment |
service.created | 服務新增,或還原已刪除的服務 | service,沒有 appointment |
service.updated | 服務的內容改變,例如名稱、時長、價格、分類、人員或排序 | service,沒有 appointment |
service.deleted | 服務刪除,包括刪除分類時一併刪除的服務 | service,沒有 appointment |
staff.created | 人員加入商家 | staff,沒有 appointment |
staff.updated | 人員的姓名改變 | staff,沒有 appointment |
staff.deleted | 人員被移除、離開商家,或刪除帳號 | staff,沒有 appointment |
payment.created | 預約記下一筆收款 | payment,沒有 appointment |
refund.created | 預約記下一筆退款 | refund,沒有 appointment |
ping | 在後台選 [傳送測試事件] | 無,data 是 {} |
- 端點只收到它訂閱的事件。
ping不用訂閱。 - 建立時就自動確認的預約,會送出兩則事件:先
appointment.created,再appointment.confirmed(previous_status是pending)。appointment.created的created_at不晚於appointment.confirmed。 - 預約開始時間沒變時不送
appointment.rescheduled。 - 改期時一併更換人員,只送
appointment.rescheduled,它的data.appointment已含新的人員。 appointment.updated只在預約內容(updated_at除外)和這筆預約的前一則事件不同時送出。前一則事件不分型別,端點沒訂閱的型別也算。- 商家變更幣別或時區時不送事件,用
GET /merchant取得目前的設定。 - 批次確認、完成、標記爽約或取消時,每筆預約各送一則事件。
- 多時段與系列預約,每一筆預約各送一則
appointment.created。 - 顧客的其他資料(例如備註、標籤)改變,或顧客已封存時,不送
customer.updated。 service.updated、staff.updated只在內容和同一個服務或人員的前一則事件不同時送出(服務的updated_at除外)。分類改名時,分類內每個服務各送一則service.updated。- 人員離開商家時,除了
staff.deleted,指派給這位人員的服務各送一則service.updated(staff_ids改變)。 - 服務已刪除時改內容,不送
service.updated。 - 一次結帳同時用現金與點數時,兩筆收款各送一則
payment.created。 - 收款或退款讓預約內容改變(例如已付金額、付款狀態)時,另依上面的規則送
appointment.updated。
內容格式
json
{
"id": "0198d2a0-0000-7000-8000-000000000001",
"object": "event",
"api_version": "v1",
"type": "appointment.rescheduled",
"created_at": "2026-11-15T06:30:02Z",
"data": {
"appointment": { "…": "見下方" },
"previous": { "start_at": "2026-11-19T02:00:00Z" },
"actor_type": "merchant_user"
}
}| 欄位 | 型別 | 說明 |
|---|---|---|
id | string | 事件 ID,與 webhook-id 標頭相同。同一則事件重試與重新傳送時不變 |
object | string | 固定是 event |
api_version | string | 內容格式的版本,目前是 v1,記在端點上。同一版本內只做向下相容的變更:新增欄位、事件類型或列舉值 |
type | string | 事件類型,見事件類型 |
created_at | string | 這則事件記下的時間,ISO 8601 UTC |
data | object | 事件內容 |
data 裡的欄位:
| 欄位 | 型別 | 說明 |
|---|---|---|
appointment | object | 預約,欄位見預約欄位。只在 appointment.* |
customer | object | 只在 customer.*:顧客,只有 id 與 object,見顧客 |
service | object | 只在 service.*:服務,見服務 |
staff | object | 只在 staff.*:人員,見人員 |
payment | object | 只在 payment.created:收款,見收款與退款 |
refund | object | 只在 refund.created:退款,見收款與退款 |
previous_status | string | 只在 appointment.confirmed、appointment.cancelled、appointment.completed、appointment.no_show:變更前的預約狀態 |
previous.start_at | string | 只在 appointment.rescheduled:原本的開始時間,ISO 8601 UTC |
actor_type | string | 操作者的類型,見操作者。只在 appointment.*,appointment.updated 沒有 |
data.appointment 是事件記下時讀到的預約內容。解析時略過不認得的欄位。
預約欄位
json
{
"id": "0198c5f1-0000-7000-8000-000000000001",
"object": "appointment",
"reference": "7K3M9Q",
"series_id": null,
"status": "confirmed",
"source": "web",
"start_at": "2026-11-20T02:00:00Z",
"end_at": "2026-11-20T03:00:00Z",
"timezone": "Asia/Taipei",
"local_date": "2026-11-20",
"local_start_time": "10:00",
"local_end_time": "11:00",
"party_size": 1,
"total_price": "1800",
"currency": "TWD",
"payment_status": "unpaid",
"deposit": {
"amount": "500",
"paid": "0",
"due_at": "2026-11-18T15:59:59Z",
"reported_at": null
},
"status_reason": null,
"customer": {
"id": "0198c5f3-0000-7000-8000-000000000001",
"object": "customer"
},
"items": [
{
"service": { "id": "0198c5f4-0000-7000-8000-000000000001", "name": "體驗課" },
"staff": { "id": "0198c5f5-0000-7000-8000-000000000001", "name": "範例老師" },
"start_at": "2026-11-20T02:00:00Z",
"end_at": "2026-11-20T03:00:00Z",
"duration_minutes": 60,
"quantity": 1,
"unit_price": "1800",
"pricing_basis": "per_booking",
"line_total": "1800"
}
],
"created_at": "2026-11-15T06:29:40Z",
"updated_at": "2026-11-15T06:29:40Z"
}| 欄位 | 型別 | 說明 |
|---|---|---|
id | string | 預約 ID(UUID) |
object | string | 固定是 appointment |
reference | string 或 null | 預約編號 |
series_id | string 或 null | 系列 ID |
status | string | pending、confirmed、completed、cancelled、no_show |
source | string 或 null | 預約來源:web、line_liff、line_conversation、merchant_panel |
start_at | string | 開始時間,ISO 8601 UTC |
end_at | string | 服務結束時間,ISO 8601 UTC |
timezone | string | 商家時區(IANA 名稱) |
local_date | string | 商家時區的日期,YYYY-MM-DD |
local_start_time | string | 商家時區的開始時間,HH:mm |
local_end_time | string | 商家時區的結束時間,HH:mm |
party_size | number | 人數 |
total_price | string | 總金額,幣別主要單位的數值字串,不含千分位與符號(1800、12.50) |
currency | string | 幣別代碼 |
payment_status | string | unpaid、partially_paid、fully_paid |
deposit | object 或 null | 訂金,沒有訂金時是 null,欄位見訂金 |
status_reason | string 或 null | 取消或爽約時填寫的原因,其他情況與沒填寫時是 null |
customer | object 或 null | 顧客,欄位見顧客 |
items | array | 預約品項,欄位見品項 |
created_at | string 或 null | 預約建立時間,ISO 8601 UTC |
updated_at | string 或 null | 預約最後更新時間,ISO 8601 UTC |
訂金
| 欄位 | 型別 | 說明 |
|---|---|---|
amount | string | 訂金金額,主要單位的數值字串 |
paid | string | 已付訂金,主要單位的數值字串 |
due_at | string 或 null | 訂金期限,ISO 8601 UTC |
reported_at | string 或 null | 顧客回報已付款的時間,ISO 8601 UTC |
顧客
| 欄位 | 型別 | 說明 |
|---|---|---|
id | string | 顧客 ID(UUID) |
object | string | 固定是 customer |
姓名、電話、Email 用 GET /v1/customers/{id} 取得(金鑰要有 customers:read),見〈API 資源與欄位〉。封存或刪除的顧客回 404。
服務
欄位與 GET /v1/services/{id} 相同,見〈API 資源與欄位〉。service.deleted 帶的是刪除當下的內容,之後 GET /v1/services/{id} 回 404。
人員
欄位與 GET /v1/staff/{id} 相同(id、object、name),見〈API 資源與欄位〉。staff.deleted 帶的是離開當下的姓名,之後 GET /v1/staff/{id} 回 404。
收款與退款
data.payment 的欄位與 GET /v1/payments/{id} 相同,data.refund 的欄位與 GET /v1/refunds/{id} 相同,見〈API 資源與欄位〉。所屬的預約在 appointment_id,用 GET /v1/appointments/{id} 取得(金鑰要有 appointments:read)。
品項
| 欄位 | 型別 | 說明 |
|---|---|---|
service.id | string | 服務 ID |
service.name | string 或 null | 服務名稱 |
staff | object 或 null | 人員。沒有指定人員時是 null;有值時含 id、name(name 可為 null) |
start_at | string 或 null | 品項開始時間,ISO 8601 UTC |
end_at | string 或 null | 品項的服務結束時間,ISO 8601 UTC |
duration_minutes | number | 服務時長(分鐘) |
quantity | number | 人數 |
unit_price | string | 單價,主要單位的數值字串 |
pricing_basis | string | per_booking(整組定價)或 per_person(依人數計價) |
line_total | string | 這個品項的金額,主要單位的數值字串。per_person 是單價乘以人數,per_booking 等於單價 |
操作者
actor_type 只給操作者的類型,不給身分。
| 值 | 說明 |
|---|---|
merchant_user | 店家人員 |
customer | 顧客 |
system | 沒有操作者 |
appointment.created 依預約來源判斷:web、line_liff、line_conversation 是 customer,merchant_panel 是 merchant_user,沒有來源是 system。