Webhooks
AirFone sends an HTTP POST to your endpoint for each event you subscribed to.
Event shape
Section titled “Event shape”{ "id": "0192a3b4-5c6d-7e8f-9a0b-1c2d3e4f5a6b", "object": "event", "type": "knowledge.connection.synced", "created": 1791443564, "workspace_id": "0192a3b4-0000-7000-8000-000000000001", "data": { "connection_id": "0192a3b4-1111-7000-8000-000000000002", "status": "active", "failures": 0, "next_sync_at": "2026-10-15T09:12:44Z", "stats": { "seen": 42, "new": 2, "changed": 1, "unchanged": 39, "gone": 0, "facts": 18, "passages": 51, "failed": 0, "partial": false }, "error": null }}Events can arrive more than once and out of order. Use id to skip ones you have handled.
Events
Section titled “Events”Subscribe an endpoint to the types you want, or to a group such as knowledge.*. The common ones:
| Event | When |
|---|---|
call.started, call.ended | A call began or finished. |
call.missed | A call was not answered. |
message.received, message.sent | A customer wrote, or AirFone replied. |
conversation.needs_person | The assistant handed a conversation to your team. |
knowledge.connection.synced, knowledge.connection.failed | A website sync finished, or failed and will retry. |
Every type, with when it fires, is in Event types.
Signature
Section titled “Signature”Every request carries:
AirFone-Signature: t=1791364364,v1=5f2b...e1v1 is the hex HMAC-SHA256 of t + "." + raw body, keyed with your endpoint’s signing secret. While you roll a secret, the header carries two v1 values. Accept the request if either matches.
Reject the request if t is more than 5 minutes from your clock. That stops replays.
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(rawBody, header, secret, toleranceSeconds = 300) { const items = header.split(',').map((p) => p.split('=')); const t = items.find(([k]) => k === 't')?.[1]; const sigs = items.filter(([k]) => k === 'v1').map(([, v]) => v); if (!t || Math.abs(Date.now() / 1000 - Number(t)) > toleranceSeconds) return false; const expected = Buffer.from(createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex')); return sigs.some((s) => s.length === expected.length && timingSafeEqual(Buffer.from(s), expected));}Python
Section titled “Python”import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool: items = [p.split("=", 1) for p in header.split(",")] t = next((v for k, v in items if k == "t"), None) sigs = [v for k, v in items if k == "v1"] if t is None or abs(time.time() - int(t)) > tolerance: return False expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest() return any(hmac.compare_digest(expected, s) for s in sigs)function airfone_verify(string $rawBody, string $header, string $secret, int $tolerance = 300): bool { $t = null; $sigs = []; foreach (explode(',', $header) as $part) { [$k, $v] = array_pad(explode('=', $part, 2), 2, ''); if ($k === 't') $t = $v; if ($k === 'v1') $sigs[] = $v; } if ($t === null || abs(time() - (int)$t) > $tolerance) return false; $expected = hash_hmac('sha256', $t . '.' . $rawBody, $secret); foreach ($sigs as $s) if (hash_equals($expected, $s)) return true; return false;}// $raw = file_get_contents('php://input');Retries
Section titled “Retries”Answer with any 2xx within 10 seconds. Anything else, or a timeout, is retried with backoff for up to 3 days: after 1 minute, 5 minutes, 30 minutes, 2 hours, then every 6 hours.
After 3 days of failures the endpoint is disabled and the organization’s admins get an email. Re-enable it in the console. Every delivery, with your server’s status code and the first 2 KB of its answer, is kept for 30 days under Webhooks, where you can send any delivery again.
Allow-listing
Section titled “Allow-listing”Requests come from the addresses listed at https://app.airfone.app/v1/webhook-ips. The signature is the real check. Use the list only as an extra layer.