Incentable

Webhooks

Receive real-time notifications when events occur in your incentive program.

Webhooks

Webhooks allow your application to receive real-time notifications when events occur in Incentable.

Setting Up Webhooks

  1. Go to SettingsWebhooks in your admin dashboard
  2. Click Add Endpoint
  3. Enter your endpoint URL
  4. Select the events you want to receive
  5. Save and copy your webhook secret

Webhook Payload

All webhooks are sent as POST requests with a JSON payload:

{
  "id": "evt_abc123",
  "type": "points.awarded",
  "created_at": "2024-06-15T14:30:00Z",
  "data": {
    // Event-specific data
  }
}

Verifying Webhooks

Every webhook includes a signature in the X-Incentable-Signature header. Verify this to ensure the webhook came from Incentable.

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}
Always verify webhook signatures in production to prevent unauthorized requests.

Available Events

Points Events

EventDescription
points.awardedPoints were added to a member's balance
points.deductedPoints were removed from a member's balance
points.expiredPoints expired due to inactivity

Example: points.awarded

{
  "id": "evt_abc123",
  "type": "points.awarded",
  "created_at": "2024-06-15T14:30:00Z",
  "data": {
    "transaction_id": "txn_def456",
    "member_id": "mem_abc123",
    "points": 500,
    "reason": "Q2 Sales Target",
    "new_balance": 5500
  }
}

Member Events

EventDescription
member.createdA new member was added
member.updatedMember details were changed
member.tier_changedMember moved to a different tier

Example: member.tier_changed

{
  "id": "evt_xyz789",
  "type": "member.tier_changed",
  "created_at": "2024-06-15T14:30:00Z",
  "data": {
    "member_id": "mem_abc123",
    "previous_tier": "Silver",
    "new_tier": "Gold",
    "reason": "Points threshold reached"
  }
}

Reward Events

EventDescription
reward.redeemedA member redeemed a reward
order.shippedA physical reward was shipped
order.deliveredA reward was delivered

Example: reward.redeemed

{
  "id": "evt_order123",
  "type": "reward.redeemed",
  "created_at": "2024-06-15T14:35:00Z",
  "data": {
    "order_id": "ord_789xyz",
    "member_id": "mem_abc123",
    "reward_id": "rwd_001",
    "reward_name": "Amazon Gift Card $25",
    "points_spent": 2500
  }
}

Leaderboard Events

EventDescription
leaderboard.position_changedA member's ranking changed
leaderboard.period_endedA competition period ended

Retry Policy

If your endpoint returns an error (non-2xx status code), we'll retry the webhook:

AttemptDelay
1Immediate
25 minutes
330 minutes
42 hours
524 hours

After 5 failed attempts, the webhook will be marked as failed and you'll receive an email notification.

Testing Webhooks

Use the Send Test Event button in your dashboard to send sample payloads to your endpoint during development.

You can also use tools like ngrok to expose your local development server for webhook testing.