Skip to main content
Webhooks push events to your server as they happen, so you don’t have to poll GET /api/v2/get. You register an endpoint, pick the events you care about, and Escrybe POSTs a JSON payload to it. Endpoints are managed in the panel under Configurações → Webhooks (/opcoes/webhooks), where you can also see every delivery attempt, its response and retry a failed one.

Events

Envelope

Every delivery has the same top-level shape:
data is additive: new fields may appear over time. Read the fields you need and ignore the rest rather than validating against a closed schema.

Environment

environment tells you which Escrybe environment produced the event: It is also sent as the X-Webhook-Environment header, so you can route or drop an event before parsing the body.
If you point both environments at the same endpoint, branch on this field. Homolog orders can be advanced through their whole lifecycle by hand, so they produce the same events as production — environment is what tells them apart.

Headers

Verifying the signature

When you set a secret, each delivery is signed with HMAC-SHA256 over the raw request body. Compare with a constant-time function, and read the body before any JSON parsing or middleware rewrites it.

Delivery and retries

  • Your endpoint must answer 2xx within 30 seconds.
  • A failed delivery is retried up to 3 times with exponential backoff: 5, 10 and 20 minutes.
  • After 3 consecutive failures on real events the endpoint is paused automatically and you get an e-mail. Resume it in the panel.
  • The response body is stored (up to 10,000 characters) so you can see what your server answered.
  • Manual test deliveries are never retried and never count toward the pause.
Deliveries are at-least-once. A retry can land after your server already processed the event — for instance when it answered late. Key your processing on delivery_id, or make the handler idempotent per order id and status.

Payloads

order.created

Letter, telegram and e-Carta orders:
Registered e-mail orders carry type: "email" and a different data:

order.status_updated

For type: "email" the body carries opened and date_opened instead of tracking and files. Status values for letters, telegrams and e-Carta: Status values for registered e-mail:

tracking.updated

event_detail_type is new_tracking_code when the code is first assigned and new_tracking_record when Correios reports new events. tracking_records is the Correios object as returned by them, newest event first. status_delivery is empty, delivered, going_back_to_sender or delivered_to_sender.

rr.created

rr_type is rr for a scanned physical receipt and rr_electronic for the one Correios returns digitally. file is null when the document could not be read.
This payload embeds the whole document in base64 and is much larger than the others. Make sure your endpoint accepts a body of a few megabytes.

webhook.test

Testing against homolog

homolog.escrybe.com.br is a full copy of the platform with its own database and credentials. Orders there let you exercise every event without posting anything real: on the orders page you can move an order through its statuses by hand and add tracking events, and each one fires the same webhook production would, tagged environment: "homolog".
Registered e-mail and WhatsApp are delivered for real from homolog, so recipients must first be registered in Whitelist de homologação (/homolog-whitelist). Anything not on the list is refused and the order is marked as failed with the reason.
Ask support for homolog access.