Skip to content
AffilStack Developers

Webhooks

Set a webhook URL and choose events on your listing. When a customer connects your app, AffilStack sends you those events for their account — only the ones their permissions cover.

Events

  • generation.completed — needs content:read
  • crm_contact.created — needs crm:read
  • referral.converted — needs referrals:read
  • earning.recorded — needs earnings:read

Delivery

Each event is a JSON POST:

Body
{
    "event": "crm_contact.created",
    "data": {
        "id": 123,
        "email": "buyer@example.com"
    }
}

Headers include X-AffilStack-Event and X-AffilStack-Signature, an HMAC-SHA256 of the raw body using your app's webhook signing secret (on your add-on's page). Always check it:

PHP
$expected = hash_hmac('sha256', $rawBody, $webhookSecret);
if (! hash_equals($expected, $_SERVER['HTTP_X_AFFILSTACK_SIGNATURE'] ?? '')) {
    http_response_code(401);
    exit;
}

Reply with any 2xx within a few seconds. Failed deliveries are retried up to 5 times over several hours.

Your webhook URL must be a public https:// address.