Skip to content
Webhook最後更新

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"
  }
}
欄位型別說明
idstring事件 ID,與 webhook-id 標頭相同。同一則事件重試與重新傳送時不變
objectstring固定是 event
api_versionstring內容格式的版本,目前是 v1,記在端點上。同一版本內只做向下相容的變更:新增欄位、事件類型或列舉值
typestring事件類型,見事件類型
created_atstring這則事件記下的時間,ISO 8601 UTC
dataobject事件內容

data 裡的欄位:

欄位型別說明
appointmentobject預約,欄位見預約欄位。只在 appointment.*
customerobject只在 customer.*:顧客,只有 id 與 object,見顧客
serviceobject只在 service.*:服務,見服務
staffobject只在 staff.*:人員,見人員
paymentobject只在 payment.created:收款,見收款與退款
refundobject只在 refund.created:退款,見收款與退款
previous_statusstring只在 appointment.confirmed、appointment.cancelled、appointment.completed、appointment.no_show:變更前的預約狀態
previous.start_atstring只在 appointment.rescheduled:原本的開始時間,ISO 8601 UTC
actor_typestring操作者的類型,見操作者。只在 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"
}
欄位型別說明
idstring預約 ID(UUID)
objectstring固定是 appointment
referencestring 或 null預約編號
series_idstring 或 null系列 ID
statusstringpending、confirmed、completed、cancelled、no_show
sourcestring 或 null預約來源:web、line_liff、line_conversation、merchant_panel
start_atstring開始時間,ISO 8601 UTC
end_atstring服務結束時間,ISO 8601 UTC
timezonestring商家時區(IANA 名稱)
local_datestring商家時區的日期,YYYY-MM-DD
local_start_timestring商家時區的開始時間,HH:mm
local_end_timestring商家時區的結束時間,HH:mm
party_sizenumber人數
total_pricestring總金額,幣別主要單位的數值字串,不含千分位與符號(1800、12.50)
currencystring幣別代碼
payment_statusstringunpaid、partially_paid、fully_paid
depositobject 或 null訂金,沒有訂金時是 null,欄位見訂金
status_reasonstring 或 null取消或爽約時填寫的原因,其他情況與沒填寫時是 null
customerobject 或 null顧客,欄位見顧客
itemsarray預約品項,欄位見品項
created_atstring 或 null預約建立時間,ISO 8601 UTC
updated_atstring 或 null預約最後更新時間,ISO 8601 UTC

訂金 ​

欄位型別說明
amountstring訂金金額,主要單位的數值字串
paidstring已付訂金,主要單位的數值字串
due_atstring 或 null訂金期限,ISO 8601 UTC
reported_atstring 或 null顧客回報已付款的時間,ISO 8601 UTC

顧客 ​

欄位型別說明
idstring顧客 ID(UUID)
objectstring固定是 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.idstring服務 ID
service.namestring 或 null服務名稱
staffobject 或 null人員。沒有指定人員時是 null;有值時含 id、name(name 可為 null)
start_atstring 或 null品項開始時間,ISO 8601 UTC
end_atstring 或 null品項的服務結束時間,ISO 8601 UTC
duration_minutesnumber服務時長(分鐘)
quantitynumber人數
unit_pricestring單價,主要單位的數值字串
pricing_basisstringper_booking(整組定價)或 per_person(依人數計價)
line_totalstring這個品項的金額,主要單位的數值字串。per_person 是單價乘以人數,per_booking 等於單價

操作者 ​

actor_type 只給操作者的類型,不給身分。

值說明
merchant_user店家人員
customer顧客
system沒有操作者

appointment.created 依預約來源判斷:web、line_liff、line_conversation 是 customer,merchant_panel 是 merchant_user,沒有來源是 system。