Zabbix supports custom webhook media types that execute JavaScript to send notifications. This lets you POST directly to Alert24's incidents API without any external middleware.
Before you start
You'll need:
- An Alert24 API key with
writeorincidentsscope (Settings → API Keys) - Zabbix 5.0+ (webhook media types require Zabbix 4.4+)
- Admin access to Zabbix
Create the webhook media type
In Zabbix, go to Administration → Media types
Click Create media type
Set Name to
Alert24Set Type to Webhook
Add the following Parameters:
Name Value alert24_api_keyak_live_YOUR_KEYevent_id{EVENT.ID}trigger_name{TRIGGER.NAME}hostname{HOST.NAME}severity{TRIGGER.SEVERITY}status{EVENT.STATUS}message{ALERT.MESSAGE}Set the Script to:
var params = JSON.parse(value);
var severity_map = {
'Disaster': 'critical',
'High': 'high',
'Average': 'medium',
'Warning': 'high',
'Information': 'info',
'Not classified': 'medium'
};
var payload = {
title: params.hostname + ': ' + params.trigger_name,
description: params.message,
severity: severity_map[params.severity] || 'medium',
alias: 'zabbix-' + params.event_id,
source: 'zabbix',
tags: ['zabbix', params.hostname]
};
var req = new HttpRequest();
req.addHeader('Content-Type: application/json');
req.addHeader('Authorization: Bearer ' + params.alert24_api_key);
var response = req.post(
'https://app.alert24.net/api/v1/incidents',
JSON.stringify(payload)
);
if (req.getStatus() !== 200 && req.getStatus() !== 201) {
throw 'Alert24 API error: ' + req.getStatus() + ' ' + response;
}
return 'Incident created: ' + response;
- Click Add to save
Create a user and assign the media type
- Go to Administration → Users
- Create a new user (e.g.,
alert24-notifier) or use an existing notification user - Under Media, click Add and select the
Alert24media type - Set Send to to any value (it's not used by the webhook but required by Zabbix)
- Save the user
Add to an action
- Go to Configuration → Actions → Trigger actions
- Create a new action or edit an existing one
- Under Operations, add an operation:
- Operation type: Send message
- Send to users: your alert24-notifier user
- Send only to: Alert24
- Save the action
Tips
- Deduplication: The
aliasuses{EVENT.ID}— Zabbix's stable event identifier. Alert24 deduplicates on this so re-notifications don't create duplicate incidents. - Recovery: To auto-resolve Alert24 incidents, add a Recovery operations step in the action that calls a second media type pointing to
PUT /api/v1/incidentswithstatus: resolved, using the same alias to find the incident. - Zabbix 6+: In Zabbix 6, the webhook script interface is the same but you can also use the built-in Zabbix webhook templates as a reference for how to structure the JavaScript.