A Telegram bot for managing urgent notifications and alerts
Get started with Urgent Notifier Bot in just a few simple steps:
/start command in the bot@urgent_notifier_bot to your group. Upon successful invitation, the bot will tell you the group ID to use later{
"api_key": "your_api_key_that_bot_gave_you",
"name": "Name of your service",
"text": "The message that you wish bot should send to Telegram group",
"group_id": -1234567890,
"alert_after_minutes": 5
}
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | string | Required | Your authentication key from the bot |
| name | string | Required | Name of your service for identification |
| group_id | int | Optional | If provided, bot will use this group to notify. If not - bot will send notifications to you directly. It is however advised to use groups if you have multiple services to keep things organized. |
| text | string | Optional | If text is omitted bot will not post anything to Telegram. Sending empty text is useful if you wish to establish a "heartbeat" of sorts for your service, so that bot will notify you when this "heartbeat" stops after set amount of minutes (see alert_after_minutes) |
| alert_after_minutes | int | Optional | Tells bot to notify you if it hasn't received any notification (even with blank "text") from your service in more than this amount of minutes |
| time_stamp | string | Optional | Any timestamp for the notification |
💡 Pro Tip: The alert_after_minutes field is optional but powerful! Set it to 5 (or any number) and the bot will notify you if it doesn't receive any message from your service with that specific name within the specified time. This way you'll be automatically alerted if your service goes down.
Practical examples showing different ways to use the notification API:
Bot will send this notification directly to the user who created the API key
{
"api_key": "your_api_key_here",
"name": "My Service",
"text": "Hello, this is a test notification"
}
Bot will send this notification to the specified Telegram group
{
"api_key": "your_api_key_here",
"name": "My Service",
"group_id": -1234567890,
"text": "Hello, this is a test notification"
}
Bot will monitor this service and alert you if no notifications arrive within the specified time
{
"api_key": "your_api_key_here",
"name": "My Service",
"alert_after_minutes": 5
}
Bot will send the notification to the group and also monitor for service health
{
"api_key": "your_api_key_here",
"name": "My Service",
"group_id": -1234567890,
"text": "Hello, this is a test notification",
"alert_after_minutes": 5
}
The bot provides a RESTful API for programmatic access to send notifications.
https://urgent.oxton.ru/
All API requests require a valid API key that must be included in the request body.
All API responses follow this standard format:
{
"error": false,
"message": "Success message",
"data": null,
"server_time": "2024-01-01T12:00:00Z"
}
Health check endpoint to verify server status
{
"error": false,
"message": "Pong",
"data": null,
"server_time": "2024-01-01T12:00:00Z"
}
Send an urgent notification to Telegram channels
| Field | Type | Required | Description |
|---|---|---|---|
| api_key | string | Yes | Valid UUID API key for authentication |
| name | string | No | Name or identifier for the notification |
| group_id | int64 | No | Telegram group/channel ID. If not provided, notification will be sent to the Telegram user who created this API key |
| text | string | No | Notification message content |
| alert_after_minutes | int | No | Minutes to wait before sending alert if notifications stop coming (service monitoring) |
| time_stamp | string | No | Custom timestamp for the notification |
The alert_after_minutes field enables service monitoring functionality. It's designed to detect when your service or application stops sending notifications, which may indicate that it's down or experiencing issues.
alert_after_minutes: 5 to get alerted if your app stops sending heartbeats for more than 5 minutes{
"api_key": "550e8400-e29b-41d4-a716-446655440000",
"name": "Server Alert",
"text": "Critical system failure detected!",
"group_id": 123456789,
"alert_after_minutes": 5,
"time_stamp": "2024-01-01T12:00:00Z"
}
curl -X POST https://urgent.oxton.ru/api/notification \
-H "Content-Type: application/json" \
-d '{
"api_key": "550e8400-e29b-41d4-a716-446655440000",
"name": "Server Alert",
"text": "Critical system failure detected!",
"group_id": 123456789,
"alert_after_minutes": 5,
"time_stamp": "2024-01-01T12:00:00Z"
}'
{
"error": false,
"message": "Notification received",
"data": null,
"server_time": "2024-01-01T12:00:00Z"
}
{
"error": true,
"message": "Invalid request data",
"data": "invalid API key",
"server_time": "2024-01-01T12:00:00Z"
}
{
"error": true,
"message": "Rate limit exceeded",
"data": "rate limit exceeded. You may send next notification in 45ms (1 notification per 1s)",
"server_time": "2024-01-01T12:00:00Z"
}
{
"error": true,
"message": "Failed to save notification",
"data": "database connection error",
"server_time": "2024-01-01T12:00:00Z"
}
const sendNotification = async (apiKey, message) => {
try {
const response = await fetch('https://urgent.oxton.ru/api/notification', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
api_key: apiKey,
text: message,
name: 'System Alert'
})
});
const result = await response.json();
if (result.error) {
console.error('Error:', result.message, result.data);
} else {
console.log('Success:', result.message);
}
} catch (error) {
console.error('Request failed:', error);
}
};
import requests
import json
def send_notification(api_key, message):
url = 'https://urgent.oxton.ru/api/notification'
data = {
'api_key': api_key,
'text': message,
'name': 'System Alert'
}
try:
response = requests.post(url, json=data)
result = response.json()
if result['error']:
print(f"Error: {result['message']} - {result['data']}")
else:
print(f"Success: {result['message']}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")