DMaticKnowledge Base Open app
Home / Developers

Webhooks and signatures

Events, payloads and verifying signatures.

▶ Video tutorial coming soon

Add an endpoint in Integrations → Webhooks (public HTTPS) or via POST /webhooks. You get a whsec_... secret.

Events

EventWhen
lead.createdNew lead captured
comment.receivedComment on a post, reel or Live
message.receivedIncoming DM
store.order.createdOrder placed, not paid yet
store.order.paidOrder confirmed paid

Payload

{
  "id": "evt_9f2c...",
  "type": "store.order.paid",
  "created_at": "2026-11-20T10:15:00.000Z",
  "tenant_id": 42,
  "data": { "order_id": "...", "product_title": "...", "amount_paise": 49900,
           "buyer_name": "...", "buyer_email": "...", "utr": "..." }
}

Headers

X-DMatic-Event, X-DMatic-Event-Id, X-DMatic-Delivery, X-DMatic-Signature: t=<unix>,v1=<hex>

Verify (Node.js)

const crypto = require('crypto');
function verify(rawBody, header, secret) {
  const [t, v1] = header.split(',').map(p => p.split('=')[1]);
  const mine = crypto.createHmac('sha256', secret).update(t + '.' + rawBody).digest('hex');
  return crypto.timingSafeEqual(Buffer.from(mine), Buffer.from(v1))
    && Math.abs(Date.now()/1000 - Number(t)) < 300;
}

Verify (Python)

import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str) -> bool:
    t, v1 = [p.split('=')[1] for p in header.split(',')]
    mine = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(mine, v1) and abs(time.time() - int(t)) < 300

Delivery rules

  • Reply with 2xx within 10 seconds.
  • Failures retry with backoff (1 min, 5 min, 30 min, 2 h, 6 h, 12 h).
  • Reply 410 Gone to unsubscribe. An endpoint that keeps failing is disabled.
  • Use X-DMatic-Event-Id to ignore duplicates.