Guide

How to send a message with the Telegram Bot API

sendMessage step by step: the request URL, curl, Python and JavaScript examples, chat_id for users, groups and channels, formatting, limits and errors.

AdminHub

Connect an agent today

Connect an agent in the bot

TL;DR. One request sends a message: https://api.telegram.org/bot<token>/sendMessage with chat_id and text. It works as a GET in a browser or as a POST with JSON. To a person: they must press Start in your bot first. To a channel: add the bot as an administrator with the right to post messages; chat_id is @channel or -100…. Text: up to 4,096 characters, formatting with parse_mode=HTML or MarkdownV2. Limits: about 1 message per second per chat, 20 per minute in a group, ~30 per second in total.

With AdminHub: publish posts to your channels from an AI assistant over MCP or in the post editor, with no code — details at the end.

Sending a message is the most common thing a bot does, and the Bot API makes it one HTTP request. This guide shows the request in a browser, in curl, in Python and in JavaScript, and explains the details that make it fail: the chat ID, permissions, formatting and limits.

What you need

  1. A bot token from @BotFather. If you don’t have one, see how to get a bot token.
  2. A chat ID — where the message goes. A person’s ID, a group’s ID or a channel’s @username. See how to find a chat ID, or let the bot token and chat ID tool list the chats that wrote to your bot.
  3. Permission to write there:
    • a person must start the conversation. Telegram says it directly: bots can’t start conversations with users. The person opens your bot and presses Start, or sends it a message;
    • a group — someone adds the bot to the group, and the bot needs permission to send messages there;
    • a channel — add the bot to the channel as an administrator with the right to post messages.

The simplest way: a browser

Every Bot API request has the form https://api.telegram.org/bot<token>/METHOD. Telegram accepts GET and POST, so you can send a message by opening an address in a browser:

https://api.telegram.org/bot<token>/sendMessage?chat_id=123456789&text=Hello

Replace <token> with your token and 123456789 with the chat ID. Spaces and special characters in the text must be URL-encoded — Hello%20world for “Hello world”. For anything longer than a test, use POST.

curl

curl -X POST "https://api.telegram.org/bot<token>/sendMessage" \
     -H "Content-Type: application/json" \
     -d '{"chat_id": 123456789, "text": "Hello from my bot"}'

Telegram accepts parameters in four ways: in the URL query string, as application/x-www-form-urlencoded, as application/json and as multipart/form-data. JSON is the most convenient for text; multipart/form-data is needed only to upload files.

Python

With the requests library:

import os
import requests

TOKEN = os.environ["BOT_TOKEN"]
url = f"https://api.telegram.org/bot{TOKEN}/sendMessage"

response = requests.post(url, json={
    "chat_id": 123456789,
    "text": "Hello from my bot",
})
print(response.json())

The token comes from an environment variable, not from the code — code gets shared, and anyone who has the token controls the bot.

JavaScript

In Node.js 18 or newer, fetch is built in. Save the code as send.mjs, so that await works at the top level, and run node send.mjs:

const token = process.env.BOT_TOKEN;

const response = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ chat_id: 123456789, text: "Hello from my bot" }),
});
console.log(await response.json());

Do not call the Bot API from a web page in the browser: the token would be visible to every visitor.

What Telegram answers

Every answer is JSON with an ok field:

  • "ok": true — the message was sent, and result contains it, with its message_id.
  • "ok": false — the request failed. description explains why in words, error_code gives a number. Telegram warns that the meaning of error_code may change in the future, so read description.

Some errors have a parameters field with one of two values:

  • retry_after — the bot sent too many messages; wait this many seconds before the next try;
  • migrate_to_chat_id — the group became a supergroup and has a new ID; use the new one.

The main parameters

ParameterWhat it does
chat_idwhere to send: a numeric ID, or @username of a public channel, supergroup or bot
textthe text, 1–4,096 characters after entities parsing
parse_modeHTML or MarkdownV2 for formatting; Markdown is a legacy mode
link_preview_optionsswitch off the link preview, or choose which link it shows and how
disable_notificationsends silently: people get a notification without sound
protect_contentthe message cannot be forwarded or saved
reply_markupbuttons under the message or a keyboard
message_thread_idthe topic in a group with topics
reply_parameterswhich message to reply to

Formatting

With parse_mode=HTML:

{"chat_id": 123456789, "parse_mode": "HTML",
 "text": "<b>Bold</b>, <i>italic</i> and <a href=\"https://example.com\">a link</a>"}

With parse_mode=MarkdownV2 the same is *Bold*, _italic_ and [a link](https://example.com). In MarkdownV2 many characters — for example ., -, !, ( and ) — must be escaped with a backslash when they are plain text. A missed backslash is a frequent reason a formatted message fails. HTML is easier to get right. The free text formatter converts formatted text to MarkdownV2 or HTML with all the escaping done.

The 4,096-character limit applies to the text after parsing: the tags themselves do not count.

Sending to a channel or a group

  • A public channel: "chat_id": "@channelname".
  • A private channel or a group: the numeric ID. For channels and supergroups it starts with -100.
  • A topic in a group: add message_thread_id.

Add the bot to the channel as an administrator with the right to post messages. In a group the bot must be a member with permission to send messages — Telegram’s tutorial says sending to groups and channels works “assuming you have the relevant permissions”.

Limits

From Telegram’s bot FAQ:

  • in one chat, avoid more than one message per second — Telegram may allow short bursts above this, but a bot that keeps going over eventually gets 429 errors;
  • in a group, no more than 20 messages per minute;
  • for bulk notifications, about 30 messages per second in total.

When a bot goes over a limit, Telegram answers with error 429 and retry_after. To send to many people, spread the messages over time — Telegram suggests 8–12 hours for large mailings. Paid broadcasts raise the limit to 1,000 messages per second for 0.1 Stars per message above the free 30 per second. They are available to bots with at least 100,000 Stars on their balance and at least 100,000 monthly active users.

When sending fails

What you seeUsual reason
every method fails at once, whatever the chatthe token is wrong or was revoked — see the token guide
the description says the chat was not foundthe chat_id is wrong, or the person has never started the bot
the description says the bot was blockedthe person blocked your bot; it cannot write to them
the description mentions parsing entitiesa formatting error, usually a character not escaped in MarkdownV2
429 and retry_aftertoo many messages; wait and slow down
migrate_to_chat_idthe group became a supergroup; use the new ID

Without code: AdminHub

If the goal is to publish posts in your channels, you may not need the Bot API at all. AdminHub publishes through your own bot:

  • in the post editor — with formatting, media, buttons, scheduling and several channels at once;
  • from an AI assistant over MCP — Claude, ChatGPT or Cursor can create a post, schedule it or publish it now with the create_post tool.

MCP publishes only to the channels connected to your AdminHub, where your bot is an administrator. It does not message subscribers or other people privately.


Sources, checked November 2026: Telegram Bot API — Making requests, sendMessage, Formatting options, ResponseParameters; Telegram bots — how bots are different from users; Bot tutorial — sending messages; Bots FAQ — limits and paid broadcasts; Bot API: ChatAdministratorRights — the right to post in a channel.

What people usually ask

How do I send a message with the Telegram Bot API?
Call the sendMessage method with your bot token, a chat_id and a text: https://api.telegram.org/bot<token>/sendMessage?chat_id=123456789&text=Hello. It works as a GET request in a browser or as a POST request with JSON. Telegram answers with ok: true and the sent message.
Why can't my bot send a message to a user?
A bot cannot start a conversation. The person must open the bot and press Start, or send it a message, first. Also check the chat_id: it must be the ID of that person's chat with your bot, and the person may have blocked the bot since.
How do I send a message to a Telegram channel with a bot?
Add the bot to the channel as an administrator with the right to post messages. Then use the channel's @username as chat_id for a public channel, or its numeric ID, which starts with -100, for a private one.
What is the maximum length of a Telegram message sent by a bot?
4,096 characters after entities parsing. Formatting tags in HTML or MarkdownV2 do not count, because they become formatting, not text. A longer text must be split into several messages.
How many messages can a bot send per second?
Telegram's bot FAQ says: in one chat, avoid more than one message per second; in a group, no more than 20 messages per minute; for bulk notifications, about 30 messages per second. Above that the bot gets 429 errors with a retry_after value in seconds. Paid broadcasts raise the bulk limit to 1,000 messages per second.
How do I make text bold in a message sent by a bot?
Add parse_mode=HTML and write <b>bold</b>, or parse_mode=MarkdownV2 and write *bold*. In MarkdownV2 special characters such as . - ! ( ) must be escaped with a backslash; a missed backslash is a frequent reason for a formatting error.