Theme
Webhooks to Odoo
QBO Connect informs the Odoo module of changes by sending signed POST requests to the instance's callback_url. It sends one in each of these cases:
- records changed in a connected QuickBooks company;
- a connection must be resynchronised;
- a connection needs reauthorisation or was disconnected.
A webhook only says what changed. It never carries accounting data, tokens or secrets. Odoo reads the data itself, through the QuickBooks API proxy.
Webhooks are not Postman requests: QBO Connect sends them and Odoo receives them. The collection has one related request, Confirm resync.
How a QuickBooks change reaches Odoo
- A record changes in QuickBooks. Intuit notifies QBO Connect. One Intuit notification can hold events of several companies.
- QBO Connect checks Intuit's signature and stores each event once, by Intuit's event id, so Intuit's retries are dropped. It then answers Intuit at once.
- A queue worker takes every connection to the company (
realm_id). It skips connections that are disconnected or belong to the other QuickBooks environment.- If the customer may receive changes, it creates one
qbo.entities_changedwebhook for the connection. - If a restriction applies, it creates no webhook and marks the connection for a resync.
- If the customer may receive changes, it creates one
- QBO Connect checks the restrictions again before every attempt, including retries.
- Odoo checks the signature, stores the webhook and answers
2xx. Later it reads the changed records through the proxy.
Business rules
- Webhooks go only to the
callback_urlgiven in Register an instance.- It must have the same scheme, host and port as
base_url. - QBO Connect checks it again before every attempt.
- It must have the same scheme, host and port as
- An instance without a
callback_urlgets no webhooks, and QBO Connect records nothing for it. - Redirects are not followed. A
3xxanswer counts as a failure. - One webhook can carry several changes. Their order is not guaranteed, and neither is Intuit's: sort by
occurred_at.
The webhook request
Every webhook is a POST with a JSON body, signed with the instance secret.
Headers
| Header | Value |
|---|---|
X-QBO-Event | The event type, the same as event in the body. |
X-QBO-Delivery | The webhook id: whd_ + 26 characters, the same as id in the body. Retries of a webhook keep its id. |
X-QBO-Timestamp | Unix time in seconds when this attempt was sent. Each attempt has a new one. |
X-QBO-Signature | v1= + hex HMAC-SHA256 of X-QBO-Timestamp + . + the raw body, keyed with the instance secret. |
Content-Type | application/json |
User-Agent | QBO-Connect/ + QBO Connect's version |
Body
Every body is a JSON object. It starts with three attributes that all events share, followed by the event's own attributes.
| Attribute | Type | Description |
|---|---|---|
id | String | The webhook id, as in X-QBO-Delivery. |
event | String | The event type, as in X-QBO-Event. |
occurred_at | String (ISO 8601) | When QBO Connect created the webhook. Retries keep it. When a QuickBooks record changed is in events[].occurred_at. |
Event types
event | Sent when |
|---|---|
qbo.entities_changed | Records changed in the QuickBooks company. |
qbo.sync_required | Changes could not be forwarded and Odoo must resynchronise the connection. |
connection.reauth_required | QuickBooks no longer accepts the connection's tokens. |
connection.disconnected | The connection was disconnected without the instance asking for it. |
Answer 2xx to event types you do not handle, and ignore them. New types may be added.
The bodies below are formatted for reading. QBO Connect sends compact JSON, and the signature covers those exact bytes.
The attribute order is not fixed. The samples show the order QBO Connect sends today: MySQL stores each payload as JSON and reorders its keys. Read attributes by name, never by position.
| Request | |
|---|---|
| Request URL | POST{callback_url} |
| Sent by | QBO Connect |
| Content type | application/json |
| Authentication | X-QBO-Signature, keyed with the instance secret (see Verify the signature) |
| Timeout | 10 seconds |
Verify the signature
Check every webhook before you use it:
- Read the raw body bytes before parsing the JSON.
- Do not parse and serialise the JSON again before checking: the result can differ from the bytes that were signed. For example, QBO Connect writes
/as\/.
- Do not parse and serialise the JSON again before checking: the result can differ from the bytes that were signed. For example, QBO Connect writes
- Reject the request if
X-QBO-Timestampis more than 300 seconds from your clock. This also stops replays. - Compute
"v1=" + hex(HMAC_SHA256(key = instance secret, message = X-QBO-Timestamp + "." + raw body)). - Compare it with
X-QBO-Signaturein constant time.
If the check fails, answer 401 and do nothing else. A wrong instance secret makes every webhook fail. After a rotation, store the new secret before the next webhook arrives.
Python
The function needs only the standard library and works with any Python 3 used by Odoo:
python
import hashlib
import hmac
import time
MAX_SKEW_SECONDS = 300
def verify_qbo_connect_webhook(secret, headers, raw_body, now=None):
"""True when QBO Connect signed this request with the instance secret.
headers: the request headers (a case-insensitive mapping, such as Odoo's request.httprequest.headers)
raw_body: the exact bytes received (bytes); never parse and re-serialise the JSON before checking
"""
timestamp = headers.get("X-QBO-Timestamp", "")
signature = headers.get("X-QBO-Signature", "")
try:
sent_at = int(timestamp)
except ValueError:
return False
current = time.time() if now is None else now
if abs(current - sent_at) > MAX_SKEW_SECONDS:
return False # too old or too far in the future: a replay, or the server clock is wrong
message = timestamp.encode() + b"." + raw_body
expected = "v1=" + hmac.new(secret.encode(), message, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected.encode(), signature.encode())The function compares bytes, not str, because hmac.compare_digest raises TypeError on a str that contains non-ASCII characters. A crafted header could then turn the check into a server error.
In an Odoo controller, the route is the path of the callback_url the module registered. The Odoo module uses /quickbook_online_connector/webhook. The sketch below shows the order of the steps; storing and processing the webhooks is up to the module:
python
from odoo import http
from odoo.http import Response, request
class QboConnectWebhookController(http.Controller):
@http.route("/quickbook_online_connector/webhook", type="http", auth="public", methods=["POST"], csrf=False)
def qbo_connect_webhook(self, **kwargs):
raw_body = request.httprequest.get_data() # the exact bytes; parse the JSON only after the check
headers = request.httprequest.headers
secret = load_instance_secret(request.env) # wherever the module keeps it; never log it
if not verify_qbo_connect_webhook(secret, headers, raw_body):
return Response(status=401)
# Store X-QBO-Delivery, X-QBO-Event and the body, unless that delivery id is already stored
# (for qbo.sync_required, keep the newest body instead). A scheduled action processes them later.
return Response(status=204)A standalone receiver can read the secret from the environment, for example os.environ["QBO_CONNECT_INSTANCE_SECRET"]. Never put the secret in code or logs.
Test values
Your verification should accept this request when now is the timestamp:
| Input | Value |
|---|---|
| Instance secret | docs-example-secret |
X-QBO-Timestamp | 1796205605 |
| Raw body | The line below: 245 bytes, no line break at the end |
X-QBO-Signature | v1=80b9956da50815e670c76b4eb99a919cfd30af7ef0af99dfb0923ac6a1642256 |
json
{"id":"whd_01kbx9q3m5n7p9r1s3t5v7w9y1","event":"connection.reauth_required","occurred_at":"2026-12-02T10:00:00Z","reason":"invalid_grant","status":"reauth_required","realm_id":"9341455012345678","connection_id":"conn_01kbx7a2c9d4e6f8g0h1j3k5m7"}Respond and retries
- Answer
2xxwithin 10 seconds. Store the webhook and process it later. Any other status, a redirect, or no answer within 10 seconds counts as a failure. - Deduplicate. A webhook is retried after a failure, including when Odoo processed it but answered too late. A repeated
X-QBO-Deliveryis a webhook you already have: answer2xxand skip it. The exception isqbo.sync_required, where a retry carries the latest count (see below). - Retries. After a failure QBO Connect tries again, at most 8 attempts in all:
| Attempt | Sent |
|---|---|
| 1 | When the webhook is created (within seconds, from the queue) |
| 2 | 10 seconds after attempt 1 failed |
| 3 | 30 seconds after attempt 2 failed |
| 4 | 2 minutes after attempt 3 failed |
| 5 | 5 minutes after attempt 4 failed |
| 6 | 15 minutes after attempt 5 failed |
| 7 | 30 minutes after attempt 6 failed |
| 8 | 60 minutes after attempt 7 failed |
- Checked again before each attempt. QBO Connect checks the restrictions, the connection and the
callback_urlagain before every attempt, including retries. A webhook that may no longer be sent is cancelled, and no further attempt is made. - When all attempts fail. The webhook is marked failed. Changes in a failed
qbo.entities_changedare not lost: the connection is marked for a resync (reasondelivery_failed), and Odoo later getsqbo.sync_required. - Lost queue jobs. If a queue job is lost, for example because a worker crashed, QBO Connect queues the webhook again within about 15 minutes. The webhook keeps its id.
Restrictions
Before it forwards changes, and again before every attempt, QBO Connect checks that the customer may still receive them. Each restriction has the same error code that the QuickBooks API proxy returns in that situation. There is no point telling Odoo about changes it is not allowed to read.
| Reason | When |
|---|---|
instance_suspended | Webkul suspended the instance. |
license_inactive | The licence is not active: expired, cancelled, suspended or revoked, or its end date has passed. |
connection_reauth_required | The connection needs reauthorisation. |
quota_exceeded | The licence has used its monthly QuickBooks API quota. |
While a restriction applies:
- Odoo gets no
qbo.entities_changedfor the connection. - QBO Connect marks the connection for a resync. It counts the missed changes and keeps the time of the earliest one.
connection.*webhooks are still sent. They concern the connection itself, not QuickBooks data.
Forwarding a webhook uses no API quota. Under quota_exceeded, changes are held back only because Odoo could not read the changed records anyway.
qbo.entities_changed
Records changed in the QuickBooks company of the connection.
| Attribute | Type | Description |
|---|---|---|
connection_id | String | The connection the changes belong to (conn_…). |
realm_id | String | The QuickBooks company id. |
events | Array | The changes, in no particular order. |
events[].event_id | String | Intuit's event id. Events in Intuit's older format have no id, so QBO Connect makes one: legacy- + 40 hex characters. |
events[].entity | String | The entity name from Intuit, in lower case: invoice, customer, item, payment, salesreceipt, … |
events[].entity_id | String | The record's QuickBooks id. Keep it as a string: Intuit ids can have leading zeros. |
events[].operation | String | The operation from Intuit, in lower case. See below. |
events[].occurred_at | String (ISO 8601) or null | When the change happened, as Intuit reports it. The precision varies from seconds to nanoseconds. |
events[].deleted_id | String or null | Merges only: the id of the record that was merged into entity_id and no longer exists. |
Operations
- Intuit's webhooks can report Create, Update, Delete, Merge, Void and Emailed. Not every operation exists for every entity.
- Intuit's documentation confirms the names
created,updatedandmerged. It does not yet confirm the names for delete, void and emailed (likelydeleted,voidedandemailed). - Intuit's older format sends
create,update,merge, and so on.
QBO Connect passes the operation on unchanged, in lower case. Treat it as a hint, and do not fail on a name you do not know. Which entities arrive depends on the webhook subscriptions of Webkul's Intuit app.
Example
The body below shows an invoice update, a customer merge, a new item and a new payment:
json
{
"id": "whd_01kbx9t5v7w9y1a3c5e7g9j1m3",
"event": "qbo.entities_changed",
"occurred_at": "2026-12-02T10:00:03Z",
"events": [
{
"entity": "invoice",
"event_id": "5c0a8f3e-2d41-4b7a-9e6f-1a2b3c4d5e6f",
"entity_id": "145",
"operation": "updated",
"deleted_id": null,
"occurred_at": "2026-12-02T09:59:41Z"
},
{
"entity": "customer",
"event_id": "0e4f6a8c-1b3d-4e5f-8a9b-2c4d6e8f0a1b",
"entity_id": "123",
"operation": "merged",
"deleted_id": "27",
"occurred_at": "2026-12-02T09:59:44Z"
},
{
"entity": "item",
"event_id": "7a9c1e3f-5b7d-4f9a-8c2e-4a6c8e0b2d4f",
"entity_id": "38",
"operation": "created",
"deleted_id": null,
"occurred_at": "2026-12-02T09:59:50.512Z"
},
{
"entity": "payment",
"event_id": "3d5f7b9e-1a2c-4b6d-9e8f-0a1c3e5b7d9f",
"entity_id": "212",
"operation": "created",
"deleted_id": null,
"occurred_at": "2026-12-02T09:59:58Z"
}
],
"realm_id": "9341455012345678",
"connection_id": "conn_01kbx7a2c9d4e6f8g0h1j3k5m7"
}What Odoo does
- Check the signature, store the webhook and answer
2xx. - Skip any
event_idyou have already processed. Reading a record twice is harmless. - Read each changed record through the proxy, for example Read an invoice for
invoice145. Take the data from QuickBooks: the webhook only says that something changed. If several changes concern one record, sort them byoccurred_at. - For
merged, move Odoo's links from the recorddeleted_idtoentity_id, then readentity_id. - To find deleted records, use CDC. It returns them with
"status": "Deleted". - Keep the time of your last successful sync for each connection. A resync starts from it.
qbo.sync_required
QBO Connect could not forward some changes of a connection. Odoo must resynchronise the connection from since.
When the connection is marked
- Changes arrived while a restriction applied.
- A
qbo.entities_changedwebhook failed all its attempts, or could not be sent at all, for example because thecallback_urlis no longer allowed. The reason isdelivery_failed.
When the notice is sent
- QBO Connect sends the notice once the connection is active and no restriction applies. It checks every 5 minutes.
- Each connection has at most one notice on its way at a time.
- If a notice fails all its attempts, the next one is sent 6 hours later.
- If more changes are missed after a notice was delivered, Odoo gets a new notice with the higher count.
| Attribute | Type | Description |
|---|---|---|
connection_id | String | The connection to resynchronise (conn_…). |
realm_id | String | The QuickBooks company id. |
since | String (ISO 8601) | When the earliest missed change happened, in whole seconds. If Intuit sent no time, it is when QBO Connect recorded the change. |
reason | String | Why the most recent changes were missed: one of the restriction reasons, or delivery_failed. |
missed_events | Integer | How many changes were missed since since. Send it back with Confirm resync. |
Each attempt carries the current values, so a retry can show a higher missed_events than the first attempt.
Example
json
{
"id": "whd_01kbxb2d4f6h8k0m2p4r6t8v0w",
"event": "qbo.sync_required",
"occurred_at": "2026-12-02T11:05:00Z",
"since": "2026-12-01T08:14:09Z",
"reason": "quota_exceeded",
"realm_id": "9341455012345678",
"connection_id": "conn_01kbx7a2c9d4e6f8g0h1j3k5m7",
"missed_events": 17
}What Odoo does
- Check the signature, store the notice and answer
2xx. Schedule one resync for the connection. If a resync is already scheduled, update it with the newest notice. Do not skip a notice because you have seen itsX-QBO-Delivery. - Resynchronise from the earlier of
sinceand your own last successful sync for this connection:- If that time is within the last 30 days, use CDC.
- CDC returns at most 1,000 objects per request, so use shorter windows when needed.
- CDC does not cover JournalCode, TimeActivity, TaxAgency, TaxCode and TaxRate.
- If it is older than 30 days, CDC cannot reach it: do a full reconciliation.
- If that time is within the last 30 days, use CDC.
- When the resync is complete, send Confirm resync with the
missed_eventsof the notice you acted on. - If the response still contains
sync_required, more changes were missed in the meantime. Resynchronise again and confirm the new count.
Answering the notice with 2xx does not clear anything. Only Confirm resync with the current count does.
Until then, the connection shows sync_required in List connections and Read a connection. Odoo can therefore also find a pending resync by reading its connections, for example when it starts or once a day.
connection.reauth_required and connection.disconnected
The connection's status changed. These webhooks are sent even while a restriction applies.
| Attribute | Type | Description |
|---|---|---|
connection_id | String | The connection (conn_…). |
realm_id | String | The QuickBooks company id. |
status | String | The new status: reauth_required or disconnected. |
reason | String or null | Why it changed, as in the connection's status_reason. Examples: invalid_grant; revoked_by_support, purged_by_support, license_inactive, retention. |
connection.reauth_required: QuickBooks no longer accepts the connection's tokens, for example afterinvalid_grant. Show Reconnect, which runs Start a reconnection.connection.disconnected: the connection was disconnected without the instance asking for it:- Webkul support disconnected or purged it (
revoked_by_support,purged_by_support); - it ended with the licence (
license_inactive); - it needed reauthorisation for longer than the retention period (
retention).
QBO Connect sends none for the instance's own Disconnect.
- Webkul support disconnected or purged it (
Example
json
{
"id": "whd_01kbx9q3m5n7p9r1s3t5v7w9y1",
"event": "connection.reauth_required",
"occurred_at": "2026-12-02T10:00:00Z",
"reason": "invalid_grant",
"status": "reauth_required",
"realm_id": "9341455012345678",
"connection_id": "conn_01kbx7a2c9d4e6f8g0h1j3k5m7"
}Delivery status
Webkul staff see every webhook in the admin panel under Webhook deliveries, with its status and reason. Connections waiting for a resync are listed under Connections, with the filter Odoo must resync.
| Status | Meaning |
|---|---|
| Pending | Waiting for its next attempt. |
| Delivered | Odoo answered 2xx. |
| Failed | All attempts failed (http_<status>, connection_failed), or the webhook could not be sent (callback_url_not_allowed, secret_unavailable). |
| Cancelled | Not sent, on purpose. The reason is a restriction; connection_disconnected, connection_deleted or environment_mismatch; or, for a resync notice, sync_not_required, because the resync was already confirmed. |
Responsibilities
| QBO Connect | Odoo module |
|---|---|
| Receives Intuit's webhooks, checks Intuit's signature, stores each event once and answers Intuit. | Registers a callback_url on the instance's own origin and answers 2xx within 10 seconds. |
| Checks the instance, licence, connection and quota before every attempt; holds back changes for restricted customers. | Checks X-QBO-Signature and X-QBO-Timestamp; never logs the instance secret. |
| Signs each webhook; retries up to 8 attempts; requeues lost jobs. | Deduplicates on X-QBO-Delivery and event_id; answers 2xx to unknown event types. |
| Sends references only: entity, id, operation, time. | Reads the records through the proxy and maps them to Odoo; handles merges and deletions. |
Marks a connection for a resync and sends qbo.sync_required once access is restored. | Keeps its last successful sync time per connection; runs CDC or a full reconciliation. |
| Keeps the resync marker until Odoo confirms the current count. | Sends Confirm resync after a complete resync, and resyncs again if sync_required remains. |
Verification
- Feature tests cover the behaviour on this page, with Intuit and Odoo MOCKED:
tests/Feature/Webhooksandtests/Feature/Api/ConnectionsApiTest.php. - The headers and bodies on this page were compared on 2026-12-02 with requests captured from QBO Connect's own delivery code on MySQL (Odoo MOCKED). The Python function above verified each of them.
- Duplicate notifications, parallel delivery workers and the queue order were tested with real parallel processes on MySQL and Redis:
tests/Feature/Concurrency. - No Intuit sandbox webhook has been delivered end to end yet.
- For local tests, mock Odoo checks and logs every webhook it receives.