Skip to main content

Telegram

Send and reply to Telegram alerts via the Alerta v2 API.

Endpoints

MethodEndpointPurpose
POST/v2/telegram/sendSend a Telegram alert
POST/v2/telegram/replyReply to a Telegram alert

POST /v2/telegram/send

Send an alert to a connected Telegram channel.

Required Fields

  • channelRef — your Alerta channel reference (e.g. TG_ALT_xxxxx)
  • message — the alert body

Optional Fields

  • title — short summary shown above the message
  • severity — e.g. Critical, High, Medium, Low, Info
  • category — label for the alert type (e.g. payments, infra)
  • metadata — key/value object for extra context

Request Example

curl -X POST https://api.alerta.encrisoft.com/v2/telegram/send \
-H "Content-Type: application/json" \
-H "x-api-key: $ALERTA_API_KEY" \
-H "x-api-secret: $ALERTA_API_SECRET" \
-d '{
"channelRef": "TG_ALT_xxxxx",
"title": "Payment Alert",
"message": "Suspicious transaction spike detected.",
"severity": "Critical",
"category": "payments",
"metadata": {
"incidentId": "INC-1192"
}
}'

Sample Response

{
"statusCode": 200,
"message": "Message sent successfully",
"data": {
"requestRef": "TGR_ALT_xxxxx",
"requestId": 123
}
}

Save requestRef or requestId from the response if you need to reply to this alert later.

Idempotent Send

Add x-idempotency-key to prevent duplicate deliveries on retry:

curl -X POST https://api.alerta.encrisoft.com/v2/telegram/send \
-H "Content-Type: application/json" \
-H "x-api-key: $ALERTA_API_KEY" \
-H "x-api-secret: $ALERTA_API_SECRET" \
-H "x-idempotency-key: incident-1192-alert-1" \
-d '{
"channelRef": "TG_ALT_xxxxx",
"message": "Suspicious transaction spike detected."
}'

POST /v2/telegram/reply

Reply to a previously sent Telegram alert.

Using requestRef

  • requestRef — the requestRef value returned when the original alert was sent
  • message — the reply body

Using requestId

Alternatively, use the numeric requestId from the original send response:

  • requestId — the numeric ID returned when the original alert was sent
  • message — the reply body

Optional Fields

  • title — short summary
  • severity — e.g. Info, Medium, High
  • category — alert category label

Request Example

curl -X POST https://api.alerta.encrisoft.com/v2/telegram/reply \
-H "Content-Type: application/json" \
-H "x-api-key: $ALERTA_API_KEY" \
-H "x-api-secret: $ALERTA_API_SECRET" \
-d '{
"requestRef": "TGR_ALT_xxxxx",
"title": "Update",
"message": "Engineering is investigating.",
"severity": "Info",
"category": "payments"
}'

Sample Response

{
"statusCode": 200,
"message": "Reply sent successfully"
}