Skip to main content

Webhooks

Subscribe to real-time updates from Mile Madness. Get notified instantly when mistake fares are posted, transfer bonuses go live, or your tracked points balances change.

How It Works

  1. 1.Provide a URL endpoint that can receive POST requests
  2. 2.Select which events you want to subscribe to
  3. 3.We'll send JSON payloads to your endpoint when events occur
  4. 4.Verify webhooks using the secret key we provide

Available Events

article.published

Fired when a new article is published

{ "title": "...", "url": "...", "category": "..." }
deal.posted

Fired when a new deal or mistake fare is posted

{ "type": "mistake_fare|transfer_bonus", "route": "...", "url": "..." }
alert.triggered

Fired when a user alert matches new availability

{ "alert_id": "...", "route": "...", "seats_available": 2 }
points.changed

Fired when tracked points balance changes

{ "account": "...", "program": "...", "old_balance": 10000, "new_balance": 15000 }

Configure Webhook

Example: Verifying a webhook in Node.js

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(JSON.stringify(payload))
    .digest('hex');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

// In your webhook handler:
app.post('/webhook/milemadness', (req, res) => {
  const signature = req.headers['x-milemadness-signature'];
  
  if (!verifyWebhook(req.body, signature, process.env.WEBHOOK_SECRET)) {
    return res.status(401).send('Invalid signature');
  }
  
  // Process the webhook
  console.log('Event:', req.body.event);
  console.log('Data:', req.body.data);
  
  res.status(200).send('OK');
});

Pricing

Webhooks are included with all paid plans. Free tier includes up to 100 webhooks/month.

Tracker

100/month

Community

Unlimited

API

10,000/month