Events
| Event | When | data |
|---|---|---|
campaign.approved | The halal review approved a whole campaign (it can now run) | campaignId, autoApproved? |
campaign.rejected | The halal review rejected a campaign (its budget goes back) | campaignId, reason |
campaign.paused | A campaign was paused — by you, by HalalAdz, or because money ran out | campaignId, previousStatus |
campaign.budget_spent | A campaign used its whole budget | campaignId, billing |
creative.approved | A HalalAdz reviewer approved a creative | creativeId, campaignId |
creative.rejected | A creative was rejected | creativeId, campaignId, reason |
campaign.goal_reached | A goal campaign delivered everything it bought and ended | campaignId |
wallet.low_balance | The advertising balance is low, or a campaign paused for lack of money | currency, balanceMicros, pausedCampaignId? |
payout.approved | Publishers: HalalAdz approved a withdrawal | payoutId, currency, amountMicros |
payout.sent | Publishers: the money was sent | payoutId, currency, amountMicros, reference |
earnings.finalised | Publishers: a month's earnings are final (the monthly statement) | statementId, month, currency, netMicros |
property.approved | Publishers: a site, app or channel was approved | propertyId |
property.rejected | Publishers: a site, app or channel was rejected | propertyId, reason |
report.daily_ready | Advertisers and publishers: yesterday's numbers are final (once a day, 06:00 or later in your account's time zone) | day, timezone, reports |
test.ping | You pressed "Send a test message" in the dashboard | message, endpointId |
Set them up in Settings → Webhooks (advertiser and publisher accounts, each with its own events, up to 10 addresses). Choose the events per address and whether it gets real events or test events only (from test keys).
The message
A POST with Content-Type: application/json:
{
"id": "evt_n918273",
"type": "creative.approved",
"created": "2026-11-26T08:15:02.000Z",
"livemode": true,
"accountId": 42,
"data": { "creativeId": 5521, "campaignId": 123 }
}
| Header | Value |
|---|---|
X-HalalAdz-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")> |
X-HalalAdz-Event | The event type, e.g. creative.approved |
X-HalalAdz-Delivery | The event id (same as body.id) |
livemode is false for sandbox events and test messages. The same event is never queued twice for one address, but a retry repeats it: use id to skip one you already handled.
Check the signature
Compute HMAC-SHA256 of <t>.<raw body> with your signing secret (whsec_…), compare it with v1 in constant time, and refuse a timestamp older than 5 minutes (replay protection). Always use the raw body bytes, not re-encoded JSON.
Node.js
import crypto from "node:crypto";
import express from "express";
const app = express();
const signingSecret = process.env.HALALADZ_WEBHOOK_SECRET; // whsec_…
// Verify the RAW body, before any JSON parsing.
app.post("/halaladz/webhook", express.raw({ type: "application/json" }), (req, res) => {
const header = req.get("X-HalalAdz-Signature") || "";
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
const t = Number(parts.t);
if (!t || !parts.v1 || Math.abs(Date.now() / 1000 - t) > 300) return res.sendStatus(400);
const want = crypto.createHmac("sha256", signingSecret).update(`${t}.${req.body}`).digest();
const got = Buffer.from(parts.v1, "hex");
if (got.length !== want.length || !crypto.timingSafeEqual(got, want)) return res.sendStatus(400);
const event = JSON.parse(req.body.toString("utf8"));
// Use event.id to ignore a repeat you already handled.
res.sendStatus(200); // answer fast; do slow work afterwards
});
PHP
<?php
$secret = getenv('HALALADZ_WEBHOOK_SECRET'); // whsec_…
$body = file_get_contents('php://input');
$header = $_SERVER['HTTP_X_HALALADZ_SIGNATURE'] ?? '';
$parts = [];
foreach (explode(',', $header) as $p) { [$k, $v] = array_pad(explode('=', $p, 2), 2, ''); $parts[$k] = $v; }
$t = (int)($parts['t'] ?? 0);
if (!$t || abs(time() - $t) > 300) { http_response_code(400); exit; }
$want = hash_hmac('sha256', $t . '.' . $body, $secret);
if (!hash_equals($want, $parts['v1'] ?? '')) { http_response_code(400); exit; }
$event = json_decode($body, true);
http_response_code(200);
Answer and retries
- Answer with any 2xx within 10 seconds. Do slow work after answering.
- Anything else (also a timeout, a network error, or a redirect: redirects are never followed) is retried with backoff: 1 minute, 2, 4, 8 … at most 6 hours apart.
- After 8 tries the message is not delivered (the dead-letter list). The sending log in Settings → Webhooks shows every try with its status; fix your server and press Send again.
- A turned-off address keeps its queued messages until you turn it on again.
Security
- Only https on the default port, with a public host name. IP addresses, localhost, internal names and hosts that resolve to private, loopback or link-local networks are refused when you save the address and again at every send (the connection is pinned to the checked address).
- The signing secret is shown once, when you add the address. HalalAdz stores it encrypted. New secret makes a new one; the old one stops at once, so update your server right away.
Webhooks in the sandbox
Events of your test campaigns (approved, rejected, paused, budget spent, creative approved / rejected) go to your test-events addresses only, with livemode false. With a hz_test_ key these helpers send extra test events (a review decision is never simulated: a HalalAdz person reviews test ads too):
POST /sandbox/campaigns/{id}/goal-reached
curl -X POST https://api.halaladz.com/api/v1/sandbox/campaigns/9000/goal-reached -H "Authorization: Bearer $HZ_TEST_KEY" -H "Idempotency-Key: $(uuidgen)"
POST /sandbox/low-balance
curl -X POST https://api.halaladz.com/api/v1/sandbox/low-balance -H "Authorization: Bearer $HZ_TEST_KEY" -H "Idempotency-Key: $(uuidgen)"
Each answers webhooksQueued: how many messages went into the queue (they go out within a minute). Event names: campaign.approved, campaign.rejected, campaign.paused, campaign.budget_spent, creative.approved, creative.rejected, campaign.goal_reached, wallet.low_balance, payout.approved, payout.sent, earnings.finalised, property.approved, property.rejected, report.daily_ready.