Telegram 403: Forbidden: bot can't initiate conversation with a user — how to fix it
Telegram bots cannot write first. The user you are sending to has never started a private chat with your bot: you got their id from a group, a shared contact or another system, not from their own /start. Send them your bot's t.me link with a start parameter, save their chat id when the /start arrives, and on this 403 mark the user as unreachable instead of retrying.
By Livops team, the people who build and run LivopsUpdated
The error, as the Telegram Bot API returns it with error code 403[6][7]:
Forbidden: bot can't initiate conversation with a user
Each library wraps it in its own words:
| Library | What you see |
|---|---|
| aiogram 3 | TelegramForbiddenError: Telegram server says - Forbidden: bot can't initiate conversation with a user[8][9] |
| python-telegram-bot | telegram.error.Forbidden: Forbidden: bot can't initiate conversation with a user[10][11] |
| grammY | GrammyError: Call to 'sendMessage' failed! (403: Forbidden: bot can't initiate conversation with a user)[12] |
| Telegraf | TelegramError: 403: Forbidden: bot can't initiate conversation with a user[13] |
This page explains the rule behind the error, how it differs from chat not found and bot was blocked by the user, where the ids that cause it usually come from, and how to get users to start the bot, store their chat id at the right moment, and handle the 403 — on any host, and on Livops.
What does the error mean?
Telegram’s rule is short: bots can’t start conversations with users. A user must either add the bot to a group or send it a message first; people find a bot by its username or open it through its t.me/bot_username link[1].
The error is that rule enforced. The Bot API runs on top of Telegram’s tdlib library[5]. When a bot sends to a user it has no conversation with, Telegram rejects the peer, and tdlib reports the rejection for a bot writing to a user as 403 Bot can't initiate conversation with a user[6]. The Bot API server adds the Forbidden: prefix and lowercases the first letter[7], which gives the message above.
Nothing is broken and the id may be perfectly correct. The user simply has not started your bot yet.
How it differs from the errors next to it
Three errors show up when a bot cannot write to a person, and each asks for a different fix:
| Error | What it means | What to do |
|---|---|---|
Bad Request: chat not found (400) |
The Bot API server cannot find that chat for this bot at all, or the target is a person’s @username[7] | Fix the id or the token — see chat not found |
Forbidden: bot can't initiate conversation with a user (403) |
The user exists, but has never started a conversation with this bot[1][6] | Get the user to press Start, then send |
Forbidden: bot was blocked by the user (403) |
The user did start the bot, and later blocked it[3][7] | Mark them inactive until they unblock — see bot was blocked by the user |
The last two look alike in a broadcast log, and both mean “skip this user for now”. The difference is in what you can do next: a blocked user has to unblock the bot, while a user who never started it only has to open it once. Telegram tells the bot when a user blocks or unblocks it, with a my_chat_member update in the private chat[3]; there is no such update for a user who simply never came.
Where the ids that cause it come from
1. Group members
The bot sees a user in a group — they sent a command, joined, or were mentioned — and the code saves from.id and later sends a private message to it. The id is real, but a group is not a private conversation, so the send fails until the user opens the bot.
2. Users and contacts shared with the bot
A user can pick other people with a request_users button, or send a contact card. The ids that arrive are real Telegram user ids[3], but the Bot API warns that for a shared user “the bot may not have access to the user”, unless the bot already knows them some other way[3]. A shared Contact may carry the person’s user_id[3]. Neither turns into a conversation with that person.
3. Ids from outside Telegram
A sign-up form, a CRM, an import from another bot, or an id a user typed in. Even when the number is right, this bot has never talked to that person.
4. Phone numbers and usernames
The Bot API has no way to send to a phone number: chat_id is a numeric id, or an @username of a bot, supergroup or channel[3]. A person’s @username fails earlier, with chat not found[7]. Either way, the fix is the same as here: the person has to start the bot, and you use the chat id that start gives you.
How to fix it
Send users a deep link
Every bot has a link that opens a chat with it, https://t.me/<bot_username>, and you can add a start parameter to it[2]:
https://t.me/your_bot?start=order_1842
When someone opens the chat through that link, the bot receives /start order_1842[2]. The parameter may use A-Z, a-z, 0-9, _ and -, up to 64 characters; base64url is recommended for anything else[2]. Use it to tie the Telegram user to whatever brought them — an order, a sign-up, an account on your site — and then send them the message you could not send before.
Put the link where the person already is: on your site after a form, in an email, or as a button in the group the bot shares with them. In a group, ?startgroup= is a different thing — it asks the user to pick a group to add the bot to[2].
Save the chat id when /start arrives
Only an id that arrived in a private chat with the bot is an id you can write to. Save it there:
aiogram 3:
from aiogram import Router
from aiogram.filters import CommandObject, CommandStart
from aiogram.types import Message
router = Router()
@router.message(CommandStart())
async def start(message: Message, command: CommandObject) -> None:
await save_user(
user_id=message.from_user.id,
chat_id=message.chat.id,
payload=command.args, # "order_1842", or None
)
await message.answer("You're in. We'll message you here.")
python-telegram-bot:
from telegram import Update
from telegram.ext import CommandHandler, ContextTypes
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
payload = context.args[0] if context.args else None
await save_user(
user_id=update.effective_user.id,
chat_id=update.effective_chat.id,
payload=payload,
)
await update.message.reply_text("You're in. We'll message you here.")
app.add_handler(CommandHandler("start", start))
A table for it, in PostgreSQL:
CREATE TABLE users (
user_id BIGINT PRIMARY KEY,
chat_id BIGINT, -- set only by /start
started_at TIMESTAMPTZ,
inactive_at TIMESTAMPTZ -- set on a 403, cleared on the next /start
);
Ids can have more than 32 significant bits, at most 52[5], so keep them as BIGINT. Send only to rows where chat_id is set and inactive_at is empty.
Or ask for permission to write
Two other ways give the bot the right to message a user without a /start[3][4]:
- A Mini App can call
requestWriteAccess, which shows a native popup asking the user to let the bot message them.WebAppUser.allows_write_to_pmis true for a user who already did[4]. - A login button (
LoginUrl) can passrequest_write_access: trueto ask for the same permission[3].
When a user grants it from a Mini App, the bot receives a write_access_allowed service message in its chat with them[3]: save the chat id from it as you would from /start.
Handle the 403: mark the user, do not retry
The error does not go away on retry. Catch it, record it, and move on — the same handling as for a blocked user. Every library raises a 403 as its own error type:
aiogram 3 — TelegramForbiddenError[8][9]:
from aiogram.exceptions import TelegramForbiddenError
try:
await bot.send_message(chat_id, text)
except TelegramForbiddenError as e:
await mark_inactive(chat_id, reason=e.message)
python-telegram-bot — telegram.error.Forbidden[10][11]:
from telegram.error import Forbidden
try:
await bot.send_message(chat_id, text)
except Forbidden as e:
await mark_inactive(chat_id, reason=e.message)
grammY — a GrammyError with error_code 403[12]:
import { GrammyError } from "grammy";
try {
await bot.api.sendMessage(chatId, text);
} catch (err) {
if (err instanceof GrammyError && err.error_code === 403) {
await markInactive(chatId, err.description);
} else {
throw err;
}
}
Telegraf — a TelegramError with code 403[13]:
const { TelegramError } = require('telegraf');
try {
await telegram.sendMessage(chatId, text);
} catch (err) {
if (err instanceof TelegramError && err.code === 403) {
await markInactive(chatId, err.description);
} else {
throw err;
}
}
Keep the description in the row. bot can't initiate conversation tells you to send the user a link; bot was blocked by the user tells you to wait for them to unblock. When the user’s /start or first message arrives, clear inactive_at.
On Livops
Livops does not change who your bot may write to; the rule is Telegram’s, and the handling above is in your code. What Livops gives you is the place to run it:
- The bot as a service. A Telegram bot is its own service type,
bot: always running, no public URL needed. Its/starthandler and the 403s it logs are on the project’s Logs page and in the terminal withlivops logs <service> -f. - The users table in PostgreSQL. Add PostgreSQL under Databases, and
DATABASE_URLis written into every service in the environment, including services added later. Keep the chat ids from/startthere; a broadcast sender in another service of the same environment reads the same table. - Staging starts empty. A new environment such as
staginggets its own empty database for each database type in production; no data is copied. Its bot has no saved chat ids until users press Start there. - A broadcast as a worker. A sender that only reads the table and sends can run as a
workerservice: an always-on background process with no public URL. See Cron and workers.
A bot or worker costs 19 credits a month (19,000 so’m). One 500 MB database per team is free; see Pricing.
Questions
Can a Telegram bot send the first message to a user?
No. Bots cannot start conversations with users. The user has to send the bot a message, press Start, or add it to a group first. Until then, a message to that user fails, usually with this 403.
The user is in my group with the bot. Why can't the bot message them privately?
Because being in the same group is not a private conversation. The bot can answer the user in the group, but a private message needs the user to open the bot and press Start. Post the bot's t.me link with a start parameter in the group.
Can I message a user by their phone number or username?
No. The Bot API takes a numeric chat id, or an @username only for a bot, a supergroup or a channel. A person's @username or phone number cannot be used, and fails earlier with Bad Request: chat not found.
How is this different from bot was blocked by the user?
Blocked means the user did start the bot and later blocked it. Can't initiate means the user never started a conversation with it at all. Both are 403s, and both are handled the same way in a broadcast: skip the user and stop retrying.
Will retrying later help?
Only after the user writes to the bot. Nothing on your side changes the answer, so mark the user as unreachable and send again when their /start or first message arrives.
Can a Mini App or a login button give my bot permission to write?
Yes. A Mini App can call requestWriteAccess, and a login button can set request_write_access. When a user grants it from a Mini App, the bot also gets a write_access_allowed service message with their chat.
Where do I keep track of who started the bot?
In a database table: one row per user, with the chat id saved in the /start handler and a column for when sends stopped working. Send only to rows that have a chat id and no such mark.
Sources
- Telegram — Bots, an introduction for developers (core.telegram.org). Checked .
- Telegram — Bot features (deep linking, chat and user selection) (core.telegram.org). Checked .
- Telegram Bot API — sendMessage, Update, UsersShared, Contact, WriteAccessAllowed, LoginUrl (core.telegram.org). Checked .
- Telegram Mini Apps — requestWriteAccess, WebAppUser (core.telegram.org). Checked .
- Telegram — Bot API dialog IDs (core.telegram.org). Checked .
- TDLib source — td/telegram/MessageQueryManager.cpp (raw.githubusercontent.com). Checked .
- Telegram Bot API server source — telegram-bot-api/Client.cpp (raw.githubusercontent.com). Checked .
- aiogram source — aiogram/exceptions.py (raw.githubusercontent.com). Checked .
- aiogram source — aiogram/client/session/base.py (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/error.py (raw.githubusercontent.com). Checked .
- python-telegram-bot source — telegram/request/_baserequest.py (raw.githubusercontent.com). Checked .
- grammY source — src/core/error.ts (raw.githubusercontent.com). Checked .
- Telegraf source — src/core/network/error.ts (raw.githubusercontent.com). Checked .
Put your project online today
Connect GitHub or drop a folder. No card is asked for.
Deploy your botRelated
- Telegram 400: Bad Request: chat not found — how to fix itThe bot asked Telegram for a chat it does not know. Either the chat_id is wrong (a typo, a channel id without its -100 prefix, a user's @username, an id cut to 32 bits), or it is right but this bot has never been in that chat: the user never pressed Start, the bot was never added to the group or channel, or the token belongs to a different bot.
- Telegram 403: Forbidden: bot was blocked by the user — how to handle itThe user blocked the bot, and Telegram refuses every message the bot sends them. Nothing is broken and a retry will not help: catch the 403, mark that user as inactive in your database, skip them in broadcasts, and mark them active again when they write to the bot.
- Telegram 400: Bad Request: group chat was upgraded to a supergroup chat — how to fix itThe group your bot writes to was upgraded to a supergroup, and the supergroup has a new chat id: the old one no longer takes messages. The error carries the new id in parameters.migrate_to_chat_id. Save it in place of the old id and send again, and handle the migrate_to_chat_id service message so the id is updated before the next send fails.
- Telegram 429: Too Many Requests, flood control: retry after N — how to fix itTelegram flood control (429 Too Many Requests) is telling your bot to slow down: wait the number of seconds in retry_after, then send the same request again. It comes from sending too fast — more than about one message a second to one chat, 20 a minute to a group, or about 30 a second in a broadcast. Wait and retry in code, and send broadcasts from one queue at a steady pace.
- Telegram bot hosting in 2026: the options comparedA Telegram bot needs a process that never stops, or a public HTTPS address for a webhook. On Livops it runs from a GitHub push for 19 credits a month (19,000 so'm). Here is how a VPS, Railway, Render, Fly.io and Vercel compare.
- Telegram Mini App hosting: the web app, its API and the bot togetherA Telegram Mini App is a web page Telegram opens from an HTTPS address, usually with an API behind it and a bot in front. On Livops one repository with all three starts in one click, the Mini App's /api reaches the backend on its own, the site is free and the bot is 19 credits a month. Here is how that compares with a VPS, Vercel, Railway and Render.
- aiogram bot hosting: how to deploy an aiogram 3 botAn aiogram 3 bot needs one process that never stops, the token in an environment variable, state kept outside memory and a clean exit on SIGTERM. On Livops you push a repository with bot.py and requirements.txt, and it runs for 19 credits a month (19,000 so'm), polling or webhook.
- python-telegram-bot hosting: deploying a v22 botA python-telegram-bot bot runs as one Application: run_polling() for polling, run_webhook() with the webhooks extra for a webhook. Both stop cleanly on SIGTERM. On Livops it runs from a push with bot.py and requirements.txt for 19 credits a month (19,000 so'm).
- grammY bot deploy: polling, webhooks and hostingDeploy a grammY bot as one always-on Node.js process: bot.start() for polling, or webhookCallback() behind an HTTP server, with bot.stop() on SIGTERM. On Livops a repository with grammy in package.json runs as a bot from every push, for 19 credits a month (19,000 so'm).
- Telegraf bot hosting: deploying a Telegraf 4 bot on Node.jsA Telegraf bot is one Node.js process: bot.launch() for polling, or bot.webhookCallback() behind an HTTP server for a webhook, with bot.stop() on SIGTERM. On Livops a repository with telegraf in package.json is run as a bot from every push, for 19 credits a month (19,000 so'm).
- Telegram 400: Bad Request: PEER_ID_INVALID — what it means and how to fix itBad Request: PEER_ID_INVALID is Telegram's own error code, passed on unchanged by the Bot API server: Telegram's servers did not accept the user or chat id in the request. For a bot it usually means a user id the bot has never received in an update, such as a user who never wrote to this bot or an id taken from another bot or account, or an id that is not the one you meant. Use ids from your own bot's updates, check the id's shape, and catch the error where one bad id should not stop the rest.