Outreach Webhooks
Get every outreach change pushed to your server: new opportunities, approvals needed, live links, declines, ledger rows and low balance.
Webhooks send outreach results to your server as they happen, so that you do not have to poll. Register one HTTPS endpoint with POST /api/v1/outreach/webhooks. AIclicks then sends a POST request to it for every event you subscribe to.
Events
| Event | When AIclicks sends it |
|---|---|
opportunity.created | A source you sent, or a page AIclicks found, became an opportunity. |
opportunity.status_changed | The status of an opportunity changed. Sent for every change. |
opportunity.action_needed | An opportunity waits for your approval. Also sent as opportunity.status_changed. |
opportunity.completed | The link is live. The payload has placement.live_url and placement.placed_at. |
opportunity.declined | You or the publisher declined the opportunity. The payload has declined_by (client or publisher) and decline_reason. |
transaction.created | A top-up, spend, refund or adjustment was written to the ledger. |
campaign.balance_low | After a settled transaction, balance_cents is below low_balance_threshold_cents. |
opportunity.action_needed, opportunity.completed and opportunity.declined are sent in addition to opportunity.status_changed, so that you can subscribe only to the events you need.
Payload
Every event has the same envelope. data holds the full object at the time of the event, in the same shape as the read endpoints. You do not have to call the API again to get the details. The exceptions are position, cited_by and citation: they come from AI answer data, so read them with List Opportunities and Get Opportunity.
{
"id": "evt_8a7b6c5d4e3f2a1b",
"type": "opportunity.completed",
"created_at": "2026-12-03T15:20:11.000Z",
"api_version": "v1",
"team_id": "2b1f8c3d-4a5e-4f10-9c21-3d8e5a6b7c90",
"campaign_id": "5e7a1c2d-8b4f-4a6e-9d3c-1f2e3a4b5c6d",
"campaign_external_id": "client_4821",
"data": {
"id": "0b9c8d7e-6f5a-4b3c-8d2e-1a0b9c8d7e6f",
"external_id": "opp_99121",
"url": "https://www.techradar.com/vpn/best-vpn",
"title": "The best VPN service 2026: tested and ranked",
"status": "completed",
"previous_status": "approved",
"action_required": false,
"estimated_price_cents": 35000,
"final_price_cents": 33000,
"currency": "USD",
"placement": {
"live_url": "https://www.techradar.com/vpn/best-vpn#streaming",
"placed_at": "2026-12-03T15:12:00.000Z",
"target_url": "https://yourbrand.com/vpn",
"anchor_text": "Your Brand VPN"
}
}
}
An opportunity.action_needed event:
{
"id": "evt_1f2e3d4c5b6a7980",
"type": "opportunity.action_needed",
"created_at": "2026-12-02T08:02:55.000Z",
"api_version": "v1",
"team_id": "2b1f8c3d-4a5e-4f10-9c21-3d8e5a6b7c90",
"campaign_id": "5e7a1c2d-8b4f-4a6e-9d3c-1f2e3a4b5c6d",
"campaign_external_id": "client_4821",
"data": {
"id": "0b9c8d7e-6f5a-4b3c-8d2e-1a0b9c8d7e6f",
"external_id": "opp_99121",
"url": "https://www.techradar.com/vpn/best-vpn",
"title": "The best VPN service 2026: tested and ranked",
"status": "action_needed",
"previous_status": "outreached",
"action_required": true,
"action_reason": "approval_required",
"estimated_price_cents": 35000,
"currency": "USD",
"latest_update": {
"text": "Publisher quoted $350 for a mention in the 'Best VPN for streaming' section.",
"created_at": "2026-12-02T08:02:55.000Z"
}
}
}
A campaign.balance_low event:
{
"id": "evt_0a1b2c3d4e5f6a7b",
"type": "campaign.balance_low",
"created_at": "2026-12-10T12:00:00.000Z",
"api_version": "v1",
"team_id": "2b1f8c3d-4a5e-4f10-9c21-3d8e5a6b7c90",
"campaign_id": "5e7a1c2d-8b4f-4a6e-9d3c-1f2e3a4b5c6d",
"campaign_external_id": "client_4821",
"data": {
"balance_cents": 42000,
"reserved_cents": 70000,
"low_balance_threshold_cents": 50000,
"currency": "USD"
}
}
Request headers
| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | AIclicks-Webhooks/1.0 |
X-AIclicks-Event | The event type, for example opportunity.completed. |
X-AIclicks-Event-Id | The event id. Use it to drop duplicates. |
X-AIclicks-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256>. See below. |
Verify the signature
Each webhook endpoint has a secret that starts with whsec_. AIclicks returns it once, when you create the endpoint.
To verify a request:
- Read
tandv1from theX-AIclicks-Signatureheader. - Build the string
"{t}.{raw request body}". - Compute the HMAC-SHA256 of that string with your secret, as lowercase hex.
- Compare it with
v1in constant time. - Reject the request if
tis more than 5 minutes old.
import hashlib, hmac, time
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
signed = f"{parts['t']}.".encode() + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
fresh = abs(time.time() - int(parts["t"])) < 300
return fresh and hmac.compare_digest(expected, parts["v1"])
import crypto from "node:crypto";
export function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
Verify the signature against the raw request body. If your framework parses the JSON first and you serialize it again, the bytes change and the signature does not match.
Delivery and retries
- Return any
2xxstatus within 10 seconds. Do the slow work after you reply. - If AIclicks gets a non-
2xxstatus or a timeout, it retries with exponential backoff: after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours. - After the last failed retry, the event is marked as failed. You can still read the current state from the API at any time.
- If an endpoint fails for 3 days without one success, AIclicks disables it. Its
statusbecomesdisabledin List Webhook Endpoints. Create a new endpoint to start again. - Delivery is at least once. Use
X-AIclicks-Event-Idto drop duplicates. - Events can arrive out of order, for example after a retry. Use
created_atandprevious_statusto order them, or read the current state with Get Opportunity. - AIclicks checks for new events every 15 seconds.
Test your endpoint
AIclicks sends a ping event when you create an endpoint. If your server does not answer the ping with a 2xx status, the endpoint is not created. To test the full flow, ask support@aiclicks.io for a test campaign. The AIclicks team then moves a test opportunity through every status, so that your handler gets each event.