QuickBooks Online webhooks: signature verification and event parsing.
Signature. Intuit signs each delivery with the app's verifier
token (Developer portal, your app, Webhooks): the intuit-signature
header is the base64 HMAC-SHA256 of the raw request body keyed with
that token. verify-request recomputes it over
::hot::http/raw-body and compares in constant time. An unset or
empty verifier never verifies.
Replay. Intuit signs no timestamp, so a captured delivery can be
replayed. Treat events as hints: dedupe on the event id (CloudEvents)
or entity id + last-updated, and re-read the entity before acting.
Payload formats. Intuit moved webhooks to the CloudEvents format
in 2026 (migration deadline May 2026): a JSON array of events with
type: "qbo.invoice.created.v1", intuitaccountid (the realm id) and
intuitentityid. The legacy format is {eventNotifications: [{realmId, dataChangeEvent: {entities: [{name, id, operation, lastUpdated}]}}]}. parse-events reads both and returns the same
record shape, so a handler works across the switch.
Respond within a few seconds with a 2xx; Intuit retries failed
deliveries. Do the work after acknowledging (send a Hot event), and
use ::quickbooks::cdc to catch up on anything missed.
quickbooks-webhook
meta {webhook: {service: "quickbooks", path: "/quickbooks/webhook"}}
fn (request) {
received ::quickbooks::webhooks/receive(request)
if(received.verified,
for-each(received.events, (e) { ::hot::event/send("quickbooks:changed", e) }),
null)
received.response
}
Context Vars
quickbooks.webhook.verifier
Values
EXTRA_ENTITY_NAMES
EXTRA_ENTITY_NAMES: Map {
purchaseorder: "PurchaseOrder",
refundreceipt: "RefundReceipt",
vendorcredit: "VendorCredit",
timeactivity: "TimeActivity",
budget: "Budget",
currency: "Currency",
paymentmethod: "PaymentMethod",
term: "Term",
attachable: "Attachable"
}
OPERATIONS
OPERATIONS: Map {
created: "Create",
updated: "Update",
deleted: "Delete",
merged: "Merge",
voided: "Void",
emailed: "Emailed"
}
Functions
construct-events
fn (request: Map): Vec
fn (request: Map, verifier: Str): Vec
Verify the request (see verify-request) and return its parsed events,
or an Err when the signature is invalid.
Example
request {headers: {intuit-signature: "c2lnbmF0dXJl"}, body-raw: "[]"}
verifier ::hot::ctx/get("quickbooks.webhook.verifier")
events ::quickbooks::webhooks/construct-events(request, verifier)
if(is-err(events), 0, length(events))
entity-name
fn (name: Str): Str
The canonical entity name for a webhook's entity ("invoice" or
"Invoice" gives "Invoice"); unknown names pass through unchanged.
Example
::quickbooks::webhooks/entity-name("invoice") // "Invoice"
::quickbooks::webhooks/entity-name("purchaseorder") // "PurchaseOrder"
::quickbooks::webhooks/entity-name("Widget") // "Widget"
from-cloud-event
fn (e: Map): Map
Normalise one CloudEvents event (type: "qbo.{entity}.{verb}.v1").
Example
event {
id: "evt-1",
type: "qbo.invoice.created.v1",
intuitaccountid: "9341453",
intuitentityid: "130",
time: "2026-11-01T12:00:00Z"
}
record ::quickbooks::webhooks/from-cloud-event(event)
record.entity // "Invoice"
record.operation // "Create"
record.realm-id // "9341453"
from-legacy
fn (body: Map): Vec
Normalise a legacy eventNotifications payload into one record per
changed entity.
Example
body {eventNotifications: [{realmId: "9341453", dataChangeEvent: {entities: [
{name: "invoice", id: "130", operation: "Update", lastUpdated: "2026-11-01T12:00:00Z"}
]}}]}
record first(::quickbooks::webhooks/from-legacy(body))
record.entity // "Invoice"
record.operation // "Update"
operation-name
fn (verb: Str): Str
The legacy-style operation for a CloudEvents verb: created gives
Create, updated Update, deleted Delete, merged Merge,
voided Void, emailed Emailed.
Example
::quickbooks::webhooks/operation-name("created") // "Create"
::quickbooks::webhooks/operation-name("archived") // "Archived"
parse-events
fn (body: Any): Vec
Parse a webhook body (a decoded Map/Vec, or the raw Str/Bytes) in either format into records:
format-"cloudevents"or"legacy"realm-id- the companyentity- canonical entity name ("Invoice")id- the entity idoperation-Create,Update,Delete,Merge,Void,Emailedlast-updated- the change timeevent-id,type,data- CloudEvents only;deleted-id- legacy merges
Returns [] for an empty or unrecognised body, and an Err for
invalid JSON.
Example
body {eventNotifications: [{realmId: "9341453", dataChangeEvent: {entities: [
{name: "invoice", id: "130", operation: "Update", lastUpdated: "2026-11-01T12:00:00Z"}
]}}]}
map(::quickbooks::webhooks/parse-events(body), %.format) // ["legacy"]
::quickbooks::webhooks/parse-events("[]") // []
is-err(::quickbooks::webhooks/parse-events("not json")) // true
receive
fn (request: Map): Map
fn (request: Map, verifier: Str): Map
Verify and parse a delivery in one step: {verified, events, response}. response is the HttpResponse to return: 200 when the
signature is valid, 401 when it is not (events are then []).
Example
request {headers: {intuit-signature: "c2lnbmF0dXJl"}, body-raw: "[]"}
verifier ::hot::ctx/get("quickbooks.webhook.verifier")
received ::quickbooks::webhooks/receive(request, verifier)
if(received.verified, length(received.events), 0)
// Return this from the webhook handler
received.response
verify-request
fn (request: Map): Bool
fn (request: Map, verifier: Str): Bool
True when the request's intuit-signature is the base64 HMAC-SHA256
of its raw body under the verifier token (constant-time compare).
The 1-arity form reads quickbooks.webhook.verifier and fails the
run when it is unset; an explicit empty verifier returns false.
Example
request {headers: {intuit-signature: "c2lnbmF0dXJl"}, body-raw: "[]"}
verifier ::hot::ctx/get("quickbooks.webhook.verifier")
if(::quickbooks::webhooks/verify-request(request, verifier), "ok", "rejected")
quickbooks.webhook.verifier