Skip to main content
The Webhooks integration is for developers. It sends a JSON event to an HTTPS address you choose whenever something happens in Foliant, so your own system can react, for example by filing each invoice PDF or picking up a finished export. Webhooks is in beta. If you don’t see it in Settings › Integrations, it isn’t offered to your store yet. Contact support to ask about access.

Events

Connect webhooks

  1. In Foliant, go to Settings › Integrations.
  2. On Webhooks, click Connect.
  3. Fill in the settings:
  4. Click Connect.
You can change the URL, secret and events later in Settings on the integration’s page.

What each request contains

Foliant sends a POST request with a JSON body:

document.generated data

  • template: the template’s uuid and name.
  • document_type: invoice, credit_note, quote, or empty for other documents.
  • order: its id, name and type (orders or draft orders).
  • refund_id and fulfillment_id, when the document is for a refund or a shipment.
  • document_number and issued_at, for numbered documents.
  • source: how it was made, such as download, admin_download, export or email.
  • export: the export’s ID, when it’s part of an export.
  • generated_at.

export.completed data

  • export: its uuid, order_type, template_uuids, number of orders, orders_skipped (deleted after they were chosen) and documents, requested_by (merchant or customer) and completed_at.
  • download_url: a link to download the export, and download_url_expires_at, when that link stops working.
  • download_expires_at: when the export itself expires.
Events contain IDs and counts, not customer email addresses.

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.
Every delivery shows in Activity on the integration’s page, where you can Retry a failed one. See Integration activity.