POST /api/send-alert Content-Type: application/json

Accepts an alert payload, looks up the monitor config by id, builds the notification message template, and dispatches it via WhatsApp and Email to the contacts stored in the master record. Updates last_whatsapp_sent_time and last_email_sent_time on success.

Request Parameters
Parameter Type Required Description
id integer Required Master record ID — must exist in tbl_monitoring_master
alert string Required Alert severity level:
Info Low Moderate High Critical
info string Optional Dynamic info message included in the notification body
error_line string Required Dynamic error message included in the notification body
Example Request
// POST /api/send-alert — 3 inputs, 17 template params dispatched { "id": 1, "alert": "Critical", "error_line": "RemoteC ServerA is Down" } // WA Template: npav_server_monitoring_alert (UTILITY, en_US) // 1 Alert Level 2 Title 3 Info 4 SA // 5 WebApp 6 WebRTID 7 WebDev 8 WebTest // 9 SrvEXE 10 SrvRTID 11 SrvDev 12 SrvTest // 13 CliEXE 14 CliRTID 15 CliDev 16 CliTest // 17 ErrorLines (1=SRV8... 2=itpro...)
Success Response (200)
{ "success": true, "message": "Alert processed successfully", "record_id": 1, "title": "srv14 EPSClient is down", "alert_level": "Critical", "whatsapp": { "success": true, "sent_to": ["+919876543210"], "count": 1 }, "email": { "success": true, "sent_to": ["admin@npav.com"], "subject": "[Critical] srv14 EPSClient is down", "count": 1 }, "timestamp": "2025-01-21T14:30:00+05:30" }
Validation Error (422)
{ "message": "The alert field is required.", "errors": { "alert": ["The alert field is required."] } }
WhatsApp Message Template

*NPAV Server Monitor Alert*

*Alert Level:* {alert}

*Server: Title:* {title}

*Info:* {info}

*WebApp:* {web_app_name} | RTID: {web_rt_id} | Dev: {devloper} | Test: {Tester}

*ServerEXE:* {server_exe_name} | RTID: {server_rt_id} | Dev: {devloper} | Test: {Tester}

*ClientEXE:* {client_exe_name} | RTID: {client_rt_id} | Dev: {devloper} | Test: {Tester}

*Error Lines:* SRV8.computerkolkata.com port 0077 xxABC PRO

Team NPAV

Live Test Panel
cURL / PowerShell Examples

cURL

curl -X POST "https://servermonitor.os2.in/api/send-alert" \ -H "Content-Type: application/json" \ -d '{"id":1,"alert":"Critical","error_line":"EPSClient down"}'

PowerShell

$body = @{ id = 1 alert = "Critical" error_line = "EPSClient is down" } | ConvertTo-Json Invoke-RestMethod "https://servermonitor.os2.in/api/send-alert" ` -Method POST ` -ContentType "application/json" ` -Body $body