Introducing Livops 2.0! Promo codeCEOgives you 8,000 so‘m on your balance.What’s new

Telegram 400: Bad Request: not enough rights to send text messages to the chat — how to fix it

Bad Request: not enough rights to send text messages to the chat means the bot is in the group, but its permissions there do not allow this kind of message: the group's default permissions turn sending off for members, or the bot itself was restricted. Make the bot an administrator, or turn the permission back on; check with getChatMember for the bot's own id. In a channel the bot needs to be an administrator that can post.

By Livops team, the people who build and run LivopsUpdated

The error, as the Telegram Bot API returns it with error code 400[2][3]:

Bad Request: not enough rights to send text messages to the chat

Each library wraps it in its own words:

Library What you see
aiogram 3 TelegramBadRequest: Telegram server says - Bad Request: not enough rights to send text messages to the chat[7][8]
python-telegram-bot telegram.error.BadRequest: Not enough rights to send text messages to the chat[9][10]
grammY GrammyError: Call to 'sendMessage' failed! (400: Bad Request: not enough rights to send text messages to the chat)[11]
Telegraf TelegramError: 400: Bad Request: not enough rights to send text messages to the chat[12]

python-telegram-bot drops the Bad Request: prefix and capitalizes the rest[9]. This page explains what the error means, lists the variants for photos, files and the rest, the causes from the most common, how to see the bot’s rights with getChatMember, and what to check when the bot runs on Livops.

What does the error mean?

The bot is in the chat — otherwise you would get a 403 or chat not found — but its permissions there do not cover the message it tried to send. Before sending, the server compares the message’s type with the bot’s effective permissions in that chat, and refuses with not enough rights to send <type> to the chat[3].

In groups and supergroups, those permissions come from two places. ChatPermissions describes what a non-administrator may do in a chat, and the group’s defaults are in getChat’s permissions field[1]. A member that was restricted individually has its own can_send_* fields, and a date when the restriction ends[1]. A bot that is a plain or restricted member is bound by the defaults; an administrator is not[5].

The variants

The error names the type that was refused. Each maps to a field of ChatPermissions[1][3]:

Error ends with Typical method Permission
text messages to the chat sendMessage can_send_messages
contacts, locations, venues, invoice messages sendContact, sendLocation, sendVenue, sendInvoice can_send_messages
photos to the chat sendPhoto can_send_photos
videos to the chat sendVideo can_send_videos
documents to the chat sendDocument can_send_documents
music to the chat sendAudio can_send_audios
voice notes to the chat sendVoice can_send_voice_notes
video notes to the chat sendVideoNote can_send_video_notes
polls to the chat sendPoll can_send_polls
stickers, animations sendSticker, sendAnimation can_send_other_messages

Forwarding and copying a message are checked the same way, against the type of the message being forwarded[3].

Neighbours that look similar

  • Bad Request: chat not found — the bot does not know the chat at all: a wrong id, or a chat it was never in. See chat not found.
  • Forbidden: bot was kicked from the group chat, Forbidden: bot is not a member of the supergroup chat and the same for channels — a 403: the bot is out of the chat[2]. In a private chat, the 403 is bot was blocked by the user[2]. See bot was blocked by the user.
  • Bad Request: need administrator rights in the channel chat — the channel version of this error: in a channel, only an administrator with the right to post may send[4].
  • Too Many Requests: retry after N — slow mode or flood control, not permissions; see Telegram 429.

Causes, most common first

1. The group lets members read, not write

Admins of announcement-style groups often turn off sending for everyone but administrators. A bot added as an ordinary member falls under that default[5]: it stays in the chat, and every sendMessage fails. getChat shows it as permissions.can_send_messages: false[1].

2. The bot itself was restricted

An administrator restricted the bot in a supergroup. getChatMember then returns status: "restricted" with can_send_messages and the other fields set to false, and until_date telling when the restriction is lifted; 0 means forever[1].

3. Text is allowed, the media type is not

The group allows text but not photos, documents or stickers, and the bot sends a photo. The message changes to not enough rights to send photos to the chat, ... documents ... and so on[3]. Each type has its own field[1].

4. A channel, where only administrators post

A channel has no member permissions to switch on. The bot must be an administrator with can_post_messages, the right to post messages, which exists for channels only[1]. Without it, the error is need administrator rights in the channel chat[4].

5. Not a cause: slow mode

slow_mode_delay is the minimum delay between consecutive messages sent by each unprivileged user in a supergroup[1]. Sending too soon is a wait, not a missing right: the server waits it out, and answers Too Many Requests: retry after N when the wait is too long[6]. An administrator with can_manage_chat ignores slow mode[1].

How to see what the bot is allowed to do

First the bot’s own id, then its membership in the chat, then the chat’s defaults[1]:

curl -s "https://api.telegram.org/bot$BOT_TOKEN/getMe"
curl -s "https://api.telegram.org/bot$BOT_TOKEN/getChatMember?chat_id=$CHAT_ID&user_id=$BOT_ID"
curl -s "https://api.telegram.org/bot$BOT_TOKEN/getChat?chat_id=$CHAT_ID"

Read result.status from getChatMember[1]:

status What it means for sending
creator, administrator Not limited by the group’s defaults; in a channel, needs can_post_messages
member Follows the group’s default permissions from getChat
restricted Its own can_send_* fields apply; supergroups only
left, kicked Not in the chat: a 403, not this error

getChatMember is only guaranteed to work for other users when the bot is an administrator[1]; asking about the bot itself is the case this check needs. The same logic in aiogram 3, for text messages:

from aiogram import Bot


async def can_send_text(bot: Bot, chat_id: int) -> bool:
    me = await bot.get_me()
    chat = await bot.get_chat(chat_id)
    member = await bot.get_chat_member(chat_id, me.id)
    if member.status == "creator":
        return True
    if chat.type == "channel":
        return member.status == "administrator" and bool(member.can_post_messages)
    if member.status == "administrator":
        return True
    defaults = bool(chat.permissions and chat.permissions.can_send_messages)
    if member.status == "restricted":
        return member.can_send_messages and defaults
    if member.status == "member":
        return defaults
    return False  # "left" or "kicked"

To hear about changes instead of asking, handle my_chat_member: Telegram sends it whenever the bot’s own status in a chat changes[1].

How to fix it

Make the bot an administrator. In the group’s or channel’s settings, add the bot as an administrator. In a group or supergroup that alone lifts the default permissions[5]; in a channel, keep the right to post messages switched on[1][4].

Or turn the permission back on. If the bot should stay an ordinary member, an administrator enables sending messages (or the media type you need) in the group’s permissions. Through the API this is setChatPermissions, which needs an administrator with can_restrict_members[1].

Or lift the restriction. For a bot restricted in a supergroup, restrictChatMember with all permissions set to True lifts it[1]; in the app, an administrator removes the restriction from the bot’s member entry.

Then handle it in code. A bot in many groups will meet this error again. Catch it per chat, log the chat id, and stop sending there until its status changes, rather than retrying:

from aiogram.exceptions import TelegramBadRequest

try:
    await bot.send_message(chat_id, text)
except TelegramBadRequest as e:
    if "not enough rights" not in e.message:
        raise
    await db.mark_chat_muted(chat_id)  # un-mark it on the next my_chat_member update

On Livops

The rights are set inside Telegram, in each chat; no host can change them. What helps on Livops is seeing which chat refused and keeping that state:

  • Logs. Log the chat_id, the method and the error text; the project’s Logs page and livops logs <service> -f (CLI) show them.
  • The chat list in PostgreSQL. Add PostgreSQL under Databases, and DATABASE_URL is written into every service in the environment. Keep a row per chat with its last known status from my_chat_member, and skip the chats where the bot may not write.
  • Token and fixed targets as variables. Put BOT_TOKEN and, for a fixed target such as an admin group or a channel, CHAT_ID under Variables. Mark the token as a secret, and its value is never shown again. New values take effect on the next deploy; restart the service to apply them now.

A bot costs 19 credits a month (19,000 so’m); see Pricing.

Questions

Why can my bot send messages in one group but not in another?

Permissions are per chat. Each group has its own default permissions for members, and a bot that is a plain member follows them. If a group turns off sending messages for members, or restricts the bot, the bot cannot write there even though it works elsewhere.

Does making the bot an administrator fix it?

In a group or supergroup, yes: default member permissions describe what non-administrators may do, and an administrator is not limited by them. In a channel the bot must be an administrator with the right to post messages.

How do I check what my bot is allowed to do in a chat?

Call getMe to get the bot's id, then getChatMember with the chat id and that id. The status says whether the bot is the creator, an administrator, a member, restricted, left or kicked, and a restricted member shows which can_send fields are false. getChat shows the group's default permissions.

Is this the same as bot was blocked by the user or chat not found?

No. Chat not found means the bot does not know the chat at all. A 403 such as bot was blocked by the user or bot was kicked from the group chat means the bot may not write there at all. Not enough rights means the bot is in the chat but this kind of message is not allowed for it.

Can text be allowed but photos not?

Yes. Permissions are separate for text, photos, videos, documents, audio, voice notes, video notes, polls and other messages, and the error names the type: not enough rights to send photos to the chat, and so on.

Is slow mode the cause?

Not of this error. Slow mode sets a minimum delay between messages for each unprivileged member, and a bot that sends too soon is asked to wait, which ends as a 429 Too Many Requests when the wait is too long. Administrators who can manage the chat ignore slow mode.

Sources

  1. Telegram Bot API — ChatPermissions, ChatMember, ChatFullInfo, getMe, getChat, getChatMember, restrictChatMember, setChatPermissions, Update (core.telegram.org). Checked .
  2. Telegram Bot API server source — telegram-bot-api/Client.cpp (raw.githubusercontent.com). Checked .
  3. TDLib source — td/telegram/MessageContent.cpp (raw.githubusercontent.com). Checked .
  4. TDLib source — td/telegram/DialogManager.cpp (raw.githubusercontent.com). Checked .
  5. TDLib source — td/telegram/DialogParticipant.cpp (raw.githubusercontent.com). Checked .
  6. TDLib source — td/telegram/net/NetQueryDelayer.cpp (raw.githubusercontent.com). Checked .
  7. aiogram source — aiogram/exceptions.py (raw.githubusercontent.com). Checked .
  8. aiogram source — aiogram/client/session/base.py (raw.githubusercontent.com). Checked .
  9. python-telegram-bot source — telegram/error.py (raw.githubusercontent.com). Checked .
  10. python-telegram-bot source — telegram/request/_baserequest.py (raw.githubusercontent.com). Checked .
  11. grammY source — src/core/error.ts (raw.githubusercontent.com). Checked .
  12. 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 bot

Got a question? — @livops_uz