Events
Connect webhooks
- In Foliant, go to Settings › Integrations.
- On Webhooks, click Connect.
-
Fill in the settings:
- Click Connect.
What each request contains
Foliant sends aPOST request with a JSON body:
document.generated data
template: the template’suuidandname.document_type:invoice,credit_note,quote, or empty for other documents.order: itsid,nameandtype(orders or draft orders).refund_idandfulfillment_id, when the document is for a refund or a shipment.document_numberandissued_at, for numbered documents.source: how it was made, such asdownload,admin_download,exportoremail.export: the export’s ID, when it’s part of an export.generated_at.
export.completed data
export: itsuuid,order_type,template_uuids, number oforders,orders_skipped(deleted after they were chosen) anddocuments,requested_by(merchantorcustomer) andcompleted_at.download_url: a link to download the export, anddownload_url_expires_at, when that link stops working.download_expires_at: when the export itself expires.
Headers
Check the signature
The signature is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body (<timestamp>.<body>), using your signing secret as the key. Compute it on your side and compare it with the value after sha256= in X-Foliant-Signature. Use the raw body exactly as received.
Responses and retries
- Any 2xx response counts as delivered.
- If your endpoint returns a 5xx error, 408 or 429, or doesn’t answer within 10 seconds, Foliant tries again later, waiting longer each time, up to 5 attempts.
- Other 4xx responses are final: Foliant doesn’t retry them.
- Each event is delivered once per document or export. Retries never send it twice after a success.