Guide

How to Send Telegram Notifications from Your App

Set up Telegram notifications in under 15 minutes. Send alerts, updates, and messages to any Telegram user or group directly from your application using One-Ping's simple API.

Why Use Telegram for App Notifications?

Telegram is one of the most popular messaging platforms for developers and technical teams. With over 800 million active users, it offers instant delivery, rich formatting support, and a powerful Bot API that makes it ideal for application notifications. Unlike email, Telegram messages are read almost immediately, with open rates exceeding 80%.

Whether you need to monitor server health, track new user signups, receive payment confirmations, or alert your team about errors, Telegram notifications provide a fast and reliable channel. And with One-Ping, you can set it up in minutes without dealing with the Telegram Bot API directly.

What you will need: A Telegram account, a One-Ping account (free tier works), and about 15 minutes. No prior experience with the Telegram Bot API is required.

Step-by-Step Setup

Create a Telegram Bot with BotFather

Open Telegram and search for @BotFather, the official bot for creating other bots. Start a conversation and send the /newbot command. BotFather will ask you for two things: a display name for your bot (e.g., "My App Alerts") and a username that must end in "bot" (e.g., "myapp_alerts_bot"). Once created, BotFather will give you an API token that looks like 123456789:ABCdefGhIjKlmNoPQRstUvWxYz. Copy and save this token securely. You will need it to configure One-Ping in the next steps.

Get Your Chat ID

To send messages, you need the chat ID of the recipient. If you want to receive notifications yourself, open a conversation with your new bot and send any message. Then open this URL in your browser, replacing TOKEN with your actual bot token: https://api.telegram.org/botTOKEN/getUpdates. In the JSON response, look for "chat":{"id":XXXXXXXXX} -- that number is your chat ID. For group notifications, add the bot to a group, send a message in the group, and check the same URL. Group chat IDs are negative numbers (e.g., -1001234567890).

Configure Telegram in One-Ping

Log in to your One-Ping dashboard and navigate to Channels. Click Add Channel and select Telegram. Paste your bot API token in the configuration field, and optionally set a default chat ID for quick sends. Click Test Connection to verify everything works. You should receive a test message in your Telegram chat. Once confirmed, save the configuration. One-Ping will now handle all the API communication with Telegram on your behalf.

Send Your First Notification

Now that Telegram is configured, grab your One-Ping API key from the API Keys section of your dashboard. You can test sending a notification right from the terminal, your browser, or any HTTP client. See the code examples below for cURL, JavaScript, and Python.

Integrate into Your Application

Add the API call to your application code wherever you want to trigger a notification. Common integration points include: after a new user registers, when a payment succeeds or fails, when a background job completes, when an error threshold is hit, or when specific business events occur. Because One-Ping uses a standard REST API, it works with any programming language or framework.

Code Examples

Here are complete, copy-paste-ready examples for sending Telegram notifications through One-Ping. Replace YOUR_API_KEY with your actual API key and adjust the chat ID as needed.

cURL

# Send a Telegram notification with One-Ping
curl -X POST https://api.one-ping.com/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "New order received: #1234 - $49.99",
    "channels": ["telegram"],
    "recipient": "CHAT_ID"
  }'

JavaScript (Node.js / Browser)

const response = await fetch('https://api.one-ping.com/send', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'New order received: #1234 - $49.99',
    channels: ['telegram'],
    recipient: 'CHAT_ID'
  })
});

const data = await response.json();
console.log(data);
// { success: true, messageId: "msg_abc123" }

Python

import requests

response = requests.post(
    'https://api.one-ping.com/send',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'message': 'New order received: #1234 - $49.99',
        'channels': ['telegram'],
        'recipient': 'CHAT_ID'
    }
)

print(response.json())
# {'success': True, 'messageId': 'msg_abc123'}

Sending to Groups and Channels

One-Ping supports sending Telegram notifications to individual users, groups, and public channels. For groups, use the group chat ID (starts with a negative number) as the recipient. For public channels, you can use the channel username prefixed with @ (e.g., @mychannel). Make sure your bot is added as an administrator in the group or channel with permission to send messages.

Pro tip: You can send the same notification to multiple Telegram recipients by making a single API call with multi-channel notifications. Combine Telegram with email or Slack to ensure your messages are always seen.

Formatting Your Messages

Telegram supports rich text formatting through HTML and Markdown. When sending through One-Ping, you can include basic HTML tags in your message body for formatted notifications:

This makes Telegram particularly useful for technical alerts where you want to include server names, error codes, or clickable links to your dashboard. For example, an error alert could read: <b>Error Alert</b>\nServer: <code>prod-web-01</code>\nStatus: 503\n<a href="https://dashboard.example.com">View details</a>.

Common Use Cases

Developers and teams use Telegram notifications with One-Ping for a wide range of purposes. Here are some of the most popular use cases:

Troubleshooting

Bot not sending messages?

The most common issue is that the user has not started a conversation with the bot. In Telegram, a bot cannot initiate a conversation; the user must send the first message. Ask your recipients to open a chat with the bot and press "Start" before you send notifications.

Wrong chat ID?

Double-check that you are using the correct chat ID. Individual user IDs are positive numbers, while group IDs are negative. If you recently migrated a group to a supergroup, the chat ID will have changed. Use the getUpdates endpoint to fetch the latest chat ID.

Rate limits?

Telegram has built-in rate limits: roughly 30 messages per second to different chats, and 1 message per second to the same chat. One-Ping automatically handles rate limiting and queuing for you, so you do not need to worry about this for most use cases.

Need help? If you run into issues, check the One-Ping documentation or reach out to our support team. We are happy to help you get your Telegram notifications running smoothly.

Ready to send Telegram notifications?

Start free with 100 messages/month. No credit card required.

Get started free