Webhooks

Send monitor events to your custom HTTP endpoints. Build powerful integrations and automate incident response workflows.

What are Webhooks?

Webhooks allow Uptime Monitor to send HTTP POST requests to your endpoints when monitor events occur. This enables real-time integration with:

  • Your custom applications and internal systems
  • Third-party incident management platforms
  • Custom dashboards and reporting tools
  • Automation and workflow platforms
  • Any service that accepts HTTP POST requests

Setting Up Webhooks

  1. 1

    Create Webhook Endpoint

    Set up an HTTP endpoint on your server that can receive POST requests

  2. 2

    Add Webhook Contact

    Go to Settings → Contacts and select "Webhook" as the contact type

  3. 3

    Configure Webhook

    Enter the webhook URL and a name for the contact

  4. 4

    Save Contact

    Click save to add the webhook contact

  5. 5

    Assign to Monitors

    Add the webhook contact to monitors that should trigger notifications

Webhook Payload Format

All monitor webhooks are sent as POST requests with a JSON payload. The format varies by monitor type:

HTTPS Monitor Example

{
  "monitor_id": "507f1f77bcf86cd799439011",
  "monitor_name": "Production API",
  "monitor_settings": {
    "https": {
      "url": "https://api.example.com/health",
      "check_certificate_expiration": true,
      "http_method": "GET",
      "follow_redirect": true,
      "http_statuses": "200,201-204"
    }
  },
  "timestamp": 1705330335,
  "status": "down",
  "error": "Connection timeout after 10000ms"
}

TCP Monitor Example

{
  "monitor_id": "507f1f77bcf86cd799439012",
  "monitor_name": "Database Connection",
  "monitor_settings": {
    "tcp": {
      "url": "tcp://database.example.com:5432"
    }
  },
  "timestamp": 1705330400,
  "status": "up",
  "error": "Connection refused"
}

Ping Monitor Example

{
  "monitor_id": "507f1f77bcf86cd799439013",
  "monitor_name": "Google DNS",
  "monitor_settings": {
    "ping": {
      "url": "ping://8.8.8.8"
    }
  },
  "timestamp": 1705330500,
  "status": "down",
  "error": "Destination host unreachable"
}

Common Payload Fields

monitor_idMongoDB ObjectId of the monitor (24-character hex string)
monitor_nameUser-defined name of the monitor
monitor_settingsMonitor configuration object (structure varies by type)
timestampUnix timestamp (seconds) of the event
status"up" or "down" - current monitor status
errorError message (present for both down and recovery events)

Note: The monitor_settings structure depends on the monitor type. HTTPS monitors include fields like http_method, headers, and expected responses. TCP and Ping monitors only include the URL.

Webhook Security

Since webhooks don't support custom headers, secure your endpoint by:

  • Using a unique, hard-to-guess webhook URL with a token parameter
  • Implementing IP allowlisting for Uptime Monitor's servers
  • Validating the payload structure and required fields
  • Using HTTPS to encrypt data in transit
  • Adding rate limiting to prevent abuse

Example secure URL:
https://api.example.com/webhooks/uptime?token=secret-token-here

Certificate Expiration Webhooks

SSL certificate expiration alerts use a different payload format:

{
  "host": "example.com",
  "port": 443,
  "period": "7_days",
  "message": "example.com certificate will expire in 7 days!"
}

Period Values

  • EXPIRED - Certificate has already expired
  • a day - Expires tomorrow
  • a week - Expires in 7 days
  • 2 weeks - Expires in 14 days
  • 30 days - Expires in 30 days

Delivery Policy

Webhook Delivery

  • Webhooks are sent immediately when events occur
  • 30-second timeout for webhook responses
  • Success is any 2xx HTTP status code
  • Single delivery attempt per event

Important: Webhooks are delivered once without automatic retries. Ensure your endpoint is reliable and implements its own error handling if needed.

Common Webhook Use Cases

Custom Notification Systems

Build webhook receivers that process events and route notifications to your preferred communication channels or internal messaging systems.

Workflow Automation

Trigger automated workflows when monitors go down - restart services, scale infrastructure, or create tickets in your issue tracking system.

Data Collection & Analytics

Collect uptime data in your own databases for custom reporting, SLA calculations, or integration with business intelligence tools.

Status Page Updates

Automatically update your custom status pages or third-party status page services when monitors change state.

Webhook Best Practices

  • Use secure webhook URLs

    Include a secret token in your webhook URL to authenticate requests

  • Respond quickly

    Process webhooks asynchronously and return 200 OK immediately

  • Implement idempotency

    Use the monitor_id and timestamp to handle potential duplicate events

  • Use HTTPS endpoints

    Always use SSL/TLS encrypted endpoints for security

  • Log webhook data

    Keep logs of received webhooks for debugging and auditing

Example Webhook Receiver

Simple Node.js Express webhook receiver:

const express = require('express');
const app = express();

app.use(express.json());

app.post('/webhook', (req, res) => {
  // Verify webhook token from URL
  if (req.query.token !== 'your-secret-token') {
    return res.status(401).send('Unauthorized');
  }

  // Process webhook payload
  const { 
    monitor_id,
    monitor_name,
    monitor_settings,
    timestamp,
    status,
    error
  } = req.body;
  
  console.log(`Monitor: ${monitor_name} (${monitor_id})`);
  console.log(`Status: ${status}`);
  console.log(`Time: ${new Date(timestamp * 1000).toISOString()}`);
  
  if (status === 'down' && error) {
    console.log(`Error: ${error}`);
    // Trigger your alert logic here
  } else if (status === 'up') {
    console.log(`Monitor recovered (last error: ${error})`);
    // Handle recovery logic here
  }
  
  // Respond immediately with success
  res.status(200).send('OK');
});

app.listen(3000, () => {
  console.log('Webhook receiver listening on port 3000');
});

Troubleshooting Webhooks

Common Issues

  1. Webhooks not received:
    • • Check webhook URL is correct and publicly accessible
    • • Verify no firewall blocking our IPs
    • • Ensure webhook is assigned to monitors
  2. Authentication failures:
    • • Verify the webhook URL includes a secret token
    • • Check token validation logic on your endpoint
    • • Ensure the token in URL matches your validation
  3. Timeouts:
    • • Process webhooks asynchronously
    • • Return 200 OK immediately
    • • Handle heavy processing in background