Skip to main content

Webhooks

Instead of polling, register a URL and DawaTrack sends each event to it as it happens: new orders, deliveries, shipment confirmations, returns and recalls.

How it works

  1. You register a URL and the events you want.
  2. When one of those events happens, DawaTrack sends an HTTPS POST to your URL with a JSON body.
  3. Your endpoint checks the signature and answers with any 2xx status.

Register a URL

Needs the webhooks:manage scope.

cURL
curl -X POST https://api.dawatrack.com/partner-api/v1/webhooks/ \
  -H "Authorization: Bearer $DAWATRACK_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"target_url": "https://your-system.example.com/dawatrack-webhooks", "event_types": ["order.created", "recall.issued"]}'

The response includes a secret for checking signatures. Save it: it isn't shown again.

The URL must be a public internet address. Private, loopback and link-local addresses, internal host names, and URLs with a username or password are rejected.

Send a test event

Before a real event arrives, send yourself a signed webhook.test event:

cURL
curl -X POST https://api.dawatrack.com/partner-api/v1/webhooks/7/test/ \
  -H "Authorization: Bearer $DAWATRACK_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"

The request we send

Request
POST /dawatrack-webhooks HTTP/1.1
Content-Type: application/json
X-Dawatrack-Event-Type: order.created
X-Dawatrack-Event-Id: 3f2b8c1e-7a41-4d2b-9a0e-6c5d8b1f2a30
X-Dawatrack-Timestamp: 1794067200
X-Dawatrack-Signature: sha256=5c0e2b...

{ "order_id": 318, "po_number": "PO-000317", ... }
HeaderMeaning
X-Dawatrack-Event-TypeThe event, such as order.created.
X-Dawatrack-Event-IdA unique ID for this event. It stays the same across retries.
X-Dawatrack-TimestampWhen the delivery was signed, in Unix seconds.
X-Dawatrack-SignatureAn HMAC-SHA256 of the timestamp, a full stop and the body, made with your secret. Verify it, and check the timestamp is recent (Verifying webhooks).

Responding

  • Answer with a 2xx status within 10 seconds. Do slow work after you respond.
  • Any other status, a timeout, or a redirect counts as a failure. Redirects aren't followed.

Retries

A failed delivery is retried. In all, DawaTrack tries up to 5 times, waiting 5 minutes, 30 minutes, 2 hours, 12 hours between attempts. After the last failure the delivery is marked FAILED and not retried.

Because of retries, the same event can arrive more than once. Store X-Dawatrack-Event-Id and ignore an ID you have already processed.

Every attempt is listed by GET /webhooks/{id}/deliveries/, including deliveries that failed for good.

Orders and returns

These events go only to credentials linked to the supplier account the order belongs to. To receive them, ask us to link your API credential to your DawaTrack supplier account.

Partner API v1. The API reference is generated from the API's own code.