cardinal

Webhooks

Send an HTTP request to another system when a Record changes.

A Webhook calls a URL when a Record of one RecType hits an event, such as a save or a submit. Only a System Manager creates webhooks, at /desk/webhook/new.

The request goes out after the save commits. If the save rolls back, nothing is sent.

Example: post submitted orders to a warehouse system

FieldValue
RecTypeSales Order
Doc Eventon_submit
Conditiondoc.grand_total > 40000
Request URLhttps://wms.acme.com/hooks/orders
Request MethodPOST
Request StructureJSON
Enable Securityticked, with a Webhook Secret

JSON Request Body:

{ "order": "{{ doc.name }}", "customer": "{{ doc.customer }}", "total": "{{ doc.grand_total }}" }

Events

Doc EventFires after
after_insertA new Record is saved
on_updateAny save
on_submitSubmit
on_cancelCancel
on_trashDelete
on_update_after_submitA change to a submitted Record
on_changeAny change, including docstatus moves

RecType and Doc Event cannot change after the first save.

Request

FieldUse
ConditionAn expression. Empty sends on every event
Request URLhttp or https. Private, loopback and link-local addresses are refused
Is Dynamic URL?Render the URL as a Jinja template, such as https://crm.acme.com/orders/{{ doc.name }}
Request TimeoutSeconds, 1 to 30. 5 by default
Request StructureForm URL-Encoded uses the Data table. JSON uses the JSON template. Both send a JSON body
HeadersExtra headers, such as Authorization
DataRows of a key and the Record field it takes

Signatures

With Enable Security on, each request carries:

X-Cardinal-Signature: t=1795000000,v1=<hex HMAC-SHA256 of "<t>.<body>">

The receiver recomputes the HMAC with the shared secret over the timestamp, a dot and the raw body, and compares.

Retries and logs

A request that fails or gets a non-2xx answer is tried 3 times in all, after 5 and 20 seconds. Each attempt writes a Webhook Request Log with the URL, headers, body, status and response. Logs are kept 30 days.

Disabling or deleting the webhook stops pending retries.

For several steps, branches or waits, use an automation. Its Call webhook step sends a saved Webhook's request.

On this page