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:
- Relaye formats the message according to your template
- The formatted message is packaged into a JSON payload
- Relaye sends an HTTP POST request to your configured destination URL
- The receiving system processes the webhook
- 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:
- Go to the Outputs section
- Click New Output
- Select Generic Webhook as the output type
- Enter the destination URL where notifications should be sent
- (Optional) Configure advanced settings:
- JSON Mode: Enable to parse the template as JSON
- Give your output a name (e.g., "API Endpoint")
- Click Save
Webhook Payload Format¶
By default, the Generic Webhook output sends a JSON payload with this structure:
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:
- Go to the output's details page
- Click Test
- Relaye will send a test request to your configured URL
- 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:
- Verify the destination URL is correct and accessible
- Check if the destination server is online and responding
- Verify any firewall or network restrictions
- Check for SSL/TLS certificate issues
Request Rejections
If your requests are being rejected:
- Verify the payload format meets the destination's requirements
- Check authentication headers if required
- Ensure the destination server is configured to accept POST requests
- Check for rate limiting or IP restrictions
Viewing Webhook Request Logs¶
You can view all outgoing webhook requests by:
- Going to the Outputs section
- Clicking on your Webhook output
- 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