API
POST /api/notify
POST /api/notify
This endpoint is used to send notifications via WhatsApp to users based on the action type.
Query Parameters
token: The webhook authentication token. Get the token by registering your WhatsApp number in the web app.
Request Body
The request body uses a discriminated union based on the type field. Each type has different required fields:
1. Start/Terminate Actions
{
"type": "start" | "terminate",
"ip_address": "127.0.0.1"
}Fields:
type: Must be either"start"or"terminate"ip_address: The IP address associated with the action
2. Incident/Recovery Actions
{
"type": "incident" | "recovery" | "incident-symon" | "recovery-symon",
"alert": "High CPU usage detected",
"url": "https://example.com/monitoring",
"time": "2024-01-15T10:30:00Z",
"monika": "production-monitor-01"
}Fields:
type: Must be one of"incident","recovery","incident-symon", or"recovery-symon"alert: Description of the incident or recovery eventurl: URL to the monitoring dashboard or relevant pagetime: Timestamp of the eventmonika: Identifier for the monitoring instance
3. Status Update Actions
{
"type": "status",
"status": "online" | "offline",
"url": "https://example.com/monitoring",
"time": "2024-01-15T10:30:00Z",
"monika": "production-monitor-01"
}Fields:
type: Must be"status"status: Must be either"online"or"offline"url: URL to the monitoring dashboard or relevant pagetime: Timestamp of the eventmonika: Identifier for the monitoring instance
Response
The response is a JSON object with the following fields:
error: The error message if anymessage: The message to be sent to WhatsAppstatus: The status code of the response
Notes
- The type of the received monika notification (status-update, incident, recovery, start, terminate) is stored in the database after the message is sent to WhatsApp.