🚨 Urgent Notifier Bot

A Telegram bot for managing urgent notifications and alerts

This bot helps you manage and distribute urgent notifications through Telegram channels. It provides a simple and efficient way to send important messages to multiple recipients quickly.

✨ Key Features

🚀 Quickstart Guide

Get started with Urgent Notifier Bot in just a few simple steps:

  1. Register in Telegram bot: https://t.me/urgent_notifier_bot
  2. Create your API key: Use the /start command in the bot
  3. Create a Telegram group: Where the bot should send notifications
  4. Add the bot to your group: Add @urgent_notifier_bot to your group. Upon successful invitation, the bot will tell you the group ID to use later
  5. Send your first notification: Make a POST request to https://urgent.oxton.ru/api/notification with a body like this:
{
  "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 Requirements
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.

📚 Examples

Practical examples showing different ways to use the notification API:

1. Minimal Notification (Direct to User)

Bot will send this notification directly to the user who created the API key

POSThttps://urgent.oxton.ru/api/notification
{
  "api_key": "your_api_key_here",
  "name": "My Service",
  "text": "Hello, this is a test notification"
}
2. Notification to Telegram Group

Bot will send this notification to the specified Telegram group

POSThttps://urgent.oxton.ru/api/notification
{
  "api_key": "your_api_key_here",
  "name": "My Service",
  "group_id": -1234567890,
  "text": "Hello, this is a test notification"
}
3. Minimal Heartbeat (Direct to User)

Bot will monitor this service and alert you if no notifications arrive within the specified time

POSThttps://urgent.oxton.ru/api/notification
{
  "api_key": "your_api_key_here",
  "name": "My Service",
  "alert_after_minutes": 5
}
4. Notification with Heartbeat to Group

Bot will send the notification to the group and also monitor for service health

POSThttps://urgent.oxton.ru/api/notification
{
  "api_key": "your_api_key_here",
  "name": "My Service",
  "group_id": -1234567890,
  "text": "Hello, this is a test notification",
  "alert_after_minutes": 5
}

🔌 API Documentation

The bot provides a RESTful API for programmatic access to send notifications.

Base URL

https://urgent.oxton.ru/

Authentication

All API requests require a valid API key that must be included in the request body.

Response Format

All API responses follow this standard format:

{
  "error": false,
  "message": "Success message",
  "data": null,
  "server_time": "2024-01-01T12:00:00Z"
}

Endpoints

GET/api/ping

Health check endpoint to verify server status

Response Example
{
  "error": false,
  "message": "Pong",
  "data": null,
  "server_time": "2024-01-01T12:00:00Z"
}
POST/api/notification

Send an urgent notification to Telegram channels

Request Body Fields
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
Service Monitoring with alert_after_minutes

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.

  • If set to 0 or empty: No monitoring alerts will be sent
  • If set to a positive number (e.g., 5): The system will wait for that many minutes after receiving a notification. If no new notification arrives within that time window, an alert will be sent to notify you that your service may be down
  • Use case example: If your application normally sends a heartbeat every 2 minutes, you could set alert_after_minutes: 5 to get alerted if your app stops sending heartbeats for more than 5 minutes
JSON Payload Example
{
  "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 Request Example
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"
  }'
Success Response
{
  "error": false,
  "message": "Notification received",
  "data": null,
  "server_time": "2024-01-01T12:00:00Z"
}
Error Responses
Invalid API Key (400)
{
  "error": true,
  "message": "Invalid request data",
  "data": "invalid API key",
  "server_time": "2024-01-01T12:00:00Z"
}
Rate Limit Exceeded (429)
{
  "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"
}
Server Error (500)
{
  "error": true,
  "message": "Failed to save notification",
  "data": "database connection error",
  "server_time": "2024-01-01T12:00:00Z"
}
📝 Important Notes
  • Rate Limiting: Maximum 1 notification per second per API key
  • API Key Format: Must be a valid UUID (e.g., 550e8400-e29b-41d4-a716-446655440000)
  • Content-Type: All POST requests must use application/json
  • Error Handling: Always check the "error" field in responses
  • Server Time: All responses include server timestamp in RFC3339 format
  • Default Recipient: If no group_id is provided, notifications are sent to the Telegram user who created the API key
  • Service Monitoring: Use alert_after_minutes to get notified when your service stops sending notifications

Code Examples

JavaScript/Node.js
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);
  }
};
Python
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}")