Developer docs
Webhooks
Signed events for attributed orders, alerts, daily summaries and spend syncs.
New to the API? Start with the introduction.
Events
Under Settings › API › Webhooks, subscribe an https URL to events (up to a limit per store). ROASaurus POSTs JSON { "id", "type", "created_at", "store": { "id", "domain", "currency" }, "data": { … } }:
order.attributed | An order was recorded and matched to its clicks (last click, first click, number of touches) |
daily_summary.ready | Yesterday's revenue, orders, ad spend, MER and net profit, each morning |
alert.raised | A new alert: orders or ROAS drop, spend spike, tracking outage, failed deliveries, spend sync |
spend.synced | Ad spend was synced, with spend per platform for the synced days and any errors |
Payloads carry ids, amounts and attribution, never personal data.
Verifying a delivery
Each request carries X-Roasaurus-Signature: t=<unix time>,v1=<hex>: v1 is the HMAC-SHA256 of "<t>.<raw body>" with the endpoint's signing secret, shown on its card. Compare in constant time and reject timestamps older than 5 minutes.
// Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = createHmac('sha256', secret).update(`${parts.t}.${rawBody}`).digest('hex');
return timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ''));
}
Retries and the delivery log
Answer with a 2xx within 10 seconds. Other answers are retried after 1 minute, 5 minutes, 30 minutes, 2, 6, 12 and 24 hours, then marked failed. Every attempt is in the delivery log, where a delivery can be sent again and a test event sent with Send test event. The same event id is never delivered twice to one endpoint unless you resend it, so store the ids you processed.