Skip to content

Generic Webhook Output

The Generic Webhook output allows you to forward notifications to another HTTP endpoint. This enables you to chain Relaye with other systems or custom applications, extending its functionality to integrate with virtually any service that accepts HTTP requests.

How It Works

When you create a Generic Webhook output, you specify a destination URL. When a notification is sent:

  1. Relaye formats the message according to your template
  2. The formatted message is packaged into a JSON payload
  3. Relaye sends an HTTP POST request to your configured destination URL
  4. The receiving system processes the webhook
  5. Relaye logs the delivery status and response

This output type provides maximum flexibility for integrating with custom systems or third-party services.

Setting Up Webhook Output

To set up a Generic Webhook output:

  1. Go to the Outputs section
  2. Click New Output
  3. Select Generic Webhook as the output type
  4. Enter the destination URL where notifications should be sent
  5. (Optional) Configure advanced settings:
  6. JSON Mode: Enable to parse the template as JSON
  7. Give your output a name (e.g., "API Endpoint")
  8. Click Save

Webhook Payload Format

By default, the Generic Webhook output sends a JSON payload with this structure:

{
  "payload": {
    "message": "Your formatted message from the template"
  }
}

If JSON Mode is enabled, your template is expected to generate valid JSON that will be used as the payload directly.

Including Files

If your input includes files or images, they can be included in the webhook request as multipart form data:

payload={"message": "Your formatted message"}
[email protected]
[email protected]
[email protected]

This allows you to forward files along with your notifications to systems that support multipart form data.

Advanced Configuration

JSON Mode

When JSON Mode is enabled, your template is expected to generate valid JSON. This allows you to create complex, structured payloads for systems that require specific JSON formats.

Example template with JSON Mode enabled:

{
  "alert": {
    "name": "{{ alert_name }}",
    "severity": "{{ severity }}",
    "timestamp": "{{ timestamp }}",
    "message": "{{ message | json_escape }}"
  },
  "metadata": {
    "source": "relaye",
    "version": "1.0"
  }
}

Warning

When using JSON Mode, ensure your template generates valid JSON. Invalid JSON will cause webhook delivery failures.

Testing Your Webhook Output

To test your Webhook output:

  1. Go to the output's details page
  2. Click Test
  3. Relaye will send a test request to your configured URL
  4. Check the response status and body in the logs

For development and testing, you can use services like Webhook.site or RequestBin to create temporary endpoints that display incoming requests.

Common Uses

Generic Webhook outputs are frequently used for:

  • Custom Integrations: Connect to internal systems or APIs
  • Serverless Functions: Trigger AWS Lambda, Azure Functions, or Google Cloud Functions
  • Workflow Automation: Initiate workflows in tools like Zapier or Make (formerly Integromat)
  • Event Processing: Send events to event processing systems
  • Data Collection: Forward data to analytics or logging platforms
  • Chaining Services: Connect multiple webhook-based services together

Troubleshooting

Common Issues

Connection Failures

If your webhook isn't connecting:

  1. Verify the destination URL is correct and accessible
  2. Check if the destination server is online and responding
  3. Verify any firewall or network restrictions
  4. Check for SSL/TLS certificate issues

Request Rejections

If your requests are being rejected:

  1. Verify the payload format meets the destination's requirements
  2. Check authentication headers if required
  3. Ensure the destination server is configured to accept POST requests
  4. Check for rate limiting or IP restrictions

Viewing Webhook Request Logs

You can view all outgoing webhook requests by:

  1. Going to the Outputs section
  2. Clicking on your Webhook output
  3. Navigating to the Outgoing Logs tab

This will show you all sent requests, their status, response codes, and response bodies.

Best Practices

  • Secure your destination endpoint with appropriate authentication
  • Use HTTPS URLs for secure communication
  • Set up retry mechanisms on the receiving end for reliability
  • Include correlation IDs in your payloads for tracking
  • Validate incoming webhooks on the receiving end
  • Keep payload sizes reasonable for faster delivery
  • Implement timeouts for webhook processing
  • Monitor webhook delivery logs regularly
  • Document your webhook format for easier maintenance