Inspector Toolbelt Help Center
参考

Webhook 事件

每个 webhook 事件、触发时机以及它发送的确切数据负载。

面向高级用户

本页是为构建 ITB webhook 集成的开发者提供的技术参考。如果您只是想设置一个 webhook 端点,请从Webhooks 指南开始。

事件信封

每次 webhook 投递都是一个带有 JSON 正文的 HTTP POST请求。所有事件共享同一个顶层信封:

字段类型说明
idstring唯一事件 ID,前缀为evt_(32 位十六进制字符)。可用作幂等键——同一事件可能被投递多次
typestring事件名称,例如order.approved
apiVersionstring基于日期的负载版本。当前为2026-07-01
createdAtstring事件发生的时间(ISO 8601)
account.uidstring该事件所属账户(所有者)的 ID
account.companyNamestring您的公司名称(如果已设置)
dataobject该事件所涉及资源的快照(见下方各事件小节)
changesobject仅部分事件包含:发生变更字段的previous和current值
{
  "id": "evt_9f2c4b7a1d3e5f60718293a4b5c6d7e8",   // idempotency key
  "type": "order.approved",                        // event name
  "apiVersion": "2026-07-01",
  "createdAt": "2026-07-28T14:30:00.000Z",
  "account": {
    "uid": "abc123",
    "companyName": "Acme Home Services"
  },
  "data": { /* resource snapshot, see below */ },
  "changes": {                                     // only on some events
    "previous": { "status": "new" },
    "current": { "status": "approved" }
  }
}

每次投递还会在webhook-event请求头中携带事件名称,以及Webhooks 指南中描述的签名请求头(webhook-id、webhook-timestamp、webhook-signature)。

事件索引

事件名称何时发送
order.createdOrder已创建创建了新的order。
order.approvedOrder已批准order已批准。
order.completedOrder已完成order被标记为完成。
order.rescheduledOrder已重新安排已批准order的预约改到新时间。清除预约不会发送此事件。
order.cancelledOrder已取消order已取消。
order.paidOrder已付款整个order已付清。
order.status_changedOrder状态已更改order的状态发生任何变化。旧状态和新状态在 changes.status 中。
order.updatedOrder已更新order数据中的某个字段发生变化,且没有其他order事件涵盖此变化。
invoice.paid发票已支付一张发票已全额支付。数据为order加上该发票。
invoice.created发票已创建开具了一张发票。
invoice.voided发票已作废已开具的发票被作废或取消。
report.publishedReport已发布发布了report。
contact.created联系人已创建创建了联系人。
contact.updated联系人已更新联系人已更改。

关于部分事件何时触发的更多说明:

  • order.created 会在仪表盘、移动应用或在线预约页面创建Orders时触发。
  • order.approved 也会在创建时即为已批准的Order上触发。
  • order.status_changed 会在任何方向的状态变化时触发。
  • order.paid 会在所有发票都已付款,或Order被标记为已付款时触发。
  • invoice.created 不会在草稿发票上触发。它在发票开具时触发。
  • invoice.voided 也会在带有非 Stripe 开具徽章的未付款发票被取消时触发。
  • contact.updated 会在联系人负载中的某个字段发生变化时触发。

data 中包含什么:

  • 每个 order.* 事件和 invoice.paid:订单负载。invoice.paid 会额外加上一个 invoice 对象。
  • invoice.created 和 invoice.voided:发票,外加一个 order 对象。参见发票负载。
  • report.published:订单负载,外加报告的链接。参见下面的 report.published 负载。
  • contact.created 和 contact.updated:联系人。参见联系人负载。

删除Order、发票或联系人不会发送事件。

导入的记录不会发送任何事件

通过数据导入带入的Orders、发票和联系人从不发送 webhook,无论日期在过去还是未来。之后您对它们所做的更改也不会发送 webhook。

负载中的状态值是原始存储值(draft、new、read、approved、complete、archived)。请参阅订单状态。

字段名称在各行业间不会改变

负载字段名称在所有行业中都是相同的。例如,Inspection Type始终以名为inspectionType的字段发送,无论您的行业在界面上如何称呼它。

一次变更可能发送多个事件

一次变更可能匹配多个事件。每个事件都是独立的投递,有各自的id:

  • 批准一个Order会发送order.status_changed和order.approved。创建时即为已批准的订单还会发送order.created。
  • 完成一个订单会发送order.status_changed和order.completed。
  • 取消一个订单会发送order.cancelled;如果其状态发生变化,还会发送order.status_changed。
  • 支付最后一张未付发票会发送invoice.paid和order.paid。

只有当其他订单事件都没有触发时,才会触发order.updated,所以您不会收到重复事件。状态变化后由系统写入的日期(approvedDateTime、completedDateTime)本身不会触发order.updated。

只订阅您需要的事件,或在接收端检查type。

订单负载

所有order.*事件都会在data中发送这个Order快照。它的字段与 API 中的GET /v1/orders/{id}相同:

{
  "id": "req_abc123",                              // order ID
  "status": "approved",                            // see Order Statuses reference
  "appointmentDateTime": "2026-08-01T13:00:00.000Z",
  "appointmentTime": "8:00 AM",
  "inspectionType": "Buyer Inspection",            // your service category name
  "streetAddress": "123 Main St",
  "extendedAddress": "Unit 4",
  "city": "Springfield",
  "region": "IL",
  "postalCode": "62701",
  "country": "US",
  "timezone": "America/Chicago",
  "contactName": "Jane Buyer",
  "contactEmail": "jane@example.com",
  "contactPhone": "(555) 123-4567",
  "contactType": "client",
  "buyerAgentName": "Sam Agent",                   // also buyerAgentEmail, buyerAgentPhone
  "listingAgentName": "Lee Lister",                // also listingAgentEmail, listingAgentPhone
  "propertySizeName": "2,000 - 2,999 sq ft",
  "propertyTypeName": "Single Family",
  "yearBuilt": 1998,
  "propertySizeArea": 2400,
  "clientNotes": "Gate code 1234",
  "referralSource": "Google",
  "totalPrice": 450,
  "totalTime": 120,                                // duration in minutes
  "paid": false,
  "paymentState": "partial",                       // "paid", "partial" or "unpaid"
  "agreementSigned": true,
  "cancelled": false,
  "assignedInspectors": ["uid1", "uid2"],          // assigned team member IDs
  "requestDateTime": "2026-07-20T09:15:00.000Z",   // when the order was created
  "approvedDateTime": "2026-07-21T10:00:00.000Z",
  "completedDateTime": "2026-08-01T16:30:00.000Z",
  "lineItems": [ /* services, add-ons and fees */ ],
  "addServices": [ /* additional services */ ],
  "coupon": { "code": "SPRING10" },
  "deposit": { "amount": 100, "refunded": 0, "held": 100 }
}
  • **paid和paymentState**与该订单的发票保持一致,所以与仪表盘显示的相符。只有订单已全额付款时,paid才为true。
  • **cancelled**对已取消的订单为true,同时包含cancelledAt和cancelReason。仅凭已取消订单的status无法判断它已被取消。
  • **始终包含价格。**Webhook 端点属于账户,所以即使变更由看不到价格的团队成员做出,负载中也会包含价格。

日期字段为 ISO 8601 字符串。没有值的字段会从负载中省略,而不是发送为null。

每个订单事件对应的changes

  • order.approved、order.completed、order.status_changed:changes.previous.status和changes.current.status。
  • order.rescheduled:changes.previous.appointmentDateTime和changes.current.appointmentDateTime(ISO 8601 字符串)。
  • order.cancelled:status和cancelled的前后值,以及current中的cancelledAt和cancelReason。
  • order.paid:changes.previous.paid为false,changes.current.paid为true。
  • order.updated:每个发生变化的字段及其前后值。被清空的字段,其当前值为null。
  • order.created:没有changes字段。

发票负载

invoice.paid

每张全额付款的发票触发一次。只有一张发票的Order,这就是订单被付清的时刻。有补充发票的订单,每张发票各触发一次。如果您只关心订单是否已全额付款,请使用order.paid。

data是上面完整的Order负载,外加一个invoice对象:

{
  "id": "req_abc123",
  "status": "complete",
  "paid": true,
  // …all other order fields
  "invoice": {
    "id": "inv_789",
    "displayNumber": "INV-1042",
    "status": "PAID",
    "total": 450,
    "amountPaid": 450,
    "amountDue": 0,
    "currency": "usd",
    "paidAt": "2026-08-01T17:05:00.000Z"
    // …all other invoice fields
  }
}

changes.previous.status是该发票付款前的状态。

旧的集成仍可继续使用

2026 年 11 月之前,invoice.paid在整个Order变为已付款时触发,且只包含订单字段。这些字段仍然全部在data中,所以现有集成可以继续使用。区别在于多了invoice对象,而且有多张发票的订单会为每张发票各发送一个事件。

invoice.created和invoice.voided

data是发票,字段与 API 中的GET /v1/invoices相同,外加一个order对象;当发票属于某个订单时,它包含该Order的负载:

{
  "id": "inv_789",
  "invoiceNumber": 1042,
  "displayNumber": "INV-1042",
  "status": "OPEN",                       // VOID or CANCELLED on invoice.voided
  "requestId": "req_abc123",              // the order it belongs to
  "clientName": "Jane Buyer",
  "clientEmail": "jane@example.com",
  "lineItems": [ /* description, amount, quantity, … */ ],
  "subtotal": 450,
  "tax": 0,
  "total": 450,
  "amountPaid": 0,
  "amountDue": 450,
  "currency": "usd",
  "createdAt": "2026-07-21T10:00:00.000Z",
  "dueDate": "2026-08-01T00:00:00.000Z",
  "paymentUrl": "https://…",
  "parentInvoiceId": "inv_456",           // only on a supplemental invoice
  "voidedAt": "2026-07-25T12:00:00.000Z", // only once voided
  "voidReason": "Duplicate",
  "order": { /* the order payload */ }
}

在invoice.voided中,changes包含status的前后值,如果给出了作废原因,还包含voidReason。丢弃草稿发票不会发送任何事件,因为它从未被报告为已创建。

report.published负载

每次Report成功发布时触发,包括重新发布。data是完整的Order负载,外加报告的链接:

{
  "orderId": "req_abc123",                 // the order this report belongs to
  "id": "req_abc123",                      // same as orderId
  "status": "complete",
  // …all other order fields
  "inspectionId": "insp_456",              // the report's own ID
  "requestId": "req_abc123",               // same as orderId
  "reportUrl": "https://…",                // the published report page
  "pdfUrl": "https://…"                    // the report PDF, when one was made
}

有多个Report的Order会为每个报告各发送一个事件,各自带有自己的inspectionId。不会发送changes字段。

联系人负载

contact.created和contact.updated发送联系人,字段与 API 中的GET /v1/contacts/{id}相同:

{
  "id": "con_123",
  "email": "jane@example.com",
  "name": "Jane Buyer",
  "firstName": "Jane",
  "lastName": "Buyer",
  "phone": "(555) 123-4567",
  "contactType": ["client"],
  "dateAdded": "2026-07-20T09:15:00.000Z",
  "dateUpdated": "2026-07-28T14:30:00.000Z"
}

在contact.updated中,changes列出每个发生变化的字段及其前后值。

测试事件:webhook.test

有两种方式发送 webhook.test 事件,它们在签名上有所不同。

从仪表盘

点击设置集成上某个端点菜单中的测试,会发送:

{
  "id": "evt_test_5f0e…",        // prefixed evt_test_
  "type": "webhook.test",
  "apiVersion": "2026-07-01",
  "createdAt": "2026-07-28T14:30:00.000Z",
  "account": { "uid": "abc123" },
  "data": {
    "message": "This is a test webhook event.",
    "timestamp": "2026-07-28T14:30:00.000Z"
  }
}

这个测试不带签名。它携带的是 X-Webhook-Test: true 请求头,而不是签名请求头。您的接收端应该在不进行签名验证的情况下接受它,或者识别该请求头,只在测试时跳过验证。

从 API

POST /v1/webhooks/{endpointId}/test 会发送一个带签名的 webhook.test 事件,签名请求头与真实投递相同,且没有 X-Webhook-Test 请求头。它的 data 里只有一个 message。可用它来检查您的接收端是否验证签名。

响应投递

  • 在10 秒内以任意2xx状态码响应,即可确认收到投递。
  • 5xx响应和超时会被视为临时性失败——该次投递会被重试。
  • 其他4xx响应会被视为永久性失败——该次投递不会被重试。
  • 响应410 Gone会告知 ITB 停止发送:该端点会立即被禁用。

端点数量限制、连续失败后的自动禁用、投递历史和签名验证请参阅Webhooks 指南。

相关内容

  • Webhooks —— 设置端点、密钥和投递历史
  • 连接应用到 API —— API 密钥和 OAuth 应用(例如 Zapier)
  • 集成 —— 集成选项卡上的所有内容
  • 订单状态 —— 出现在负载中的状态值

On this page