Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

After installed python-telegram-bot, I ran a simple script as bellow:

from telegram import Bot
my_token = '534*******:AAF*************'
channel_id = -10016********

def push_message(msg, chat_id=channel_id) -> None:
    bot = Bot(my_token)
    bot.sendMessage(chat_id, msg)

push_message('Hello channel')

I got an error telegram.error.BadRequest: Chat not found
Someone please help me.
I checked the channel ID and I think it's correct. I copied the message link from the channel then got the channel ID from this URL.

You must be logged in to vote

Replies: 8 comments · 2 replies

Comment options

Hi. Please double check that your bot is a member of that chat. Note that bots can only be members of a channel if they are admin in that channel. To double check the chat_id, you can also extract it from the updates that your bot gets from that chat.

You must be logged in to vote
0 replies
Comment options

Hi, you need to add "-" as prefix for your chat id, for example if chat id is 12345, you need to add -12345

You must be logged in to vote
0 replies
Comment options

@Bibo-Joshi
My bot is getting telegram.error.BadRequest: User not found in a group when used bot.getChatMember.
It has the right of sending messages in the chat.

  1. It doesn't happen once in the blue moon. It is consistent.
  2. It happens for all the users, I tried it out manually.
  3. In other groups, it works fine. ( even when with just sending message right )
  4. The group is a public supergroup
You must be logged in to vote
2 replies
@Bibo-Joshi
Comment options

Please don't Tag people just to get attention.
Please also don't ask the same question in multiple places at the same time
https://t.me/pythontelegrambotgroup/737228

@Nusab19
Comment options

I thought this should be placed as an issue rather than just asking in Telegram. So, I sent it here so in future, someone with the same issue can find this

Comment options

Please don't Tag people just to get attention.

You are one of the participants in this issue. That's the reason of me mentioning you.

You must be logged in to vote
0 replies
Comment options

After installed python-telegram-bot, I ran a simple script as bellow:

from telegram import Bot
my_token = '534*******:AAF*************'
channel_id = -10016********

def push_message(msg, chat_id=channel_id) -> None:
    bot = Bot(my_token)
    bot.sendMessage(chat_id, msg)

push_message('Hello channel')

I got an error telegram.error.BadRequest: Chat not found Someone please help me. I checked the channel ID and I think it's correct. I copied the message link from the channel then got the channel ID from this URL.

I got the same issue too and didn't know how to resolve it.

You must be logged in to vote
0 replies
Comment options

After installed python-telegram-bot, I ran a simple script as bellow:

from telegram import Bot
my_token = '534*******:AAF*************'
channel_id = -10016********

def push_message(msg, chat_id=channel_id) -> None:
    bot = Bot(my_token)
    bot.sendMessage(chat_id, msg)

push_message('Hello channel')

I got an error telegram.error.BadRequest: Chat not found Someone please help me. I checked the channel ID and I think it's correct. I copied the message link from the channel then got the channel ID from this URL.

I resolved the issue. I found the previous channel id was incorrect. I issued the following command:

https://api.telegram.org/bot<TOKEN>/getUpdates

and check the id is -1002XXXXXXX under the channel name

You must be logged in to vote
0 replies
Comment options

You may encounter this error if your group was converted to a supergroup and then reverted back to a regular group. In this case, you also need to specify the parameter message_thread_id=0. Unfortunately, Telegram does not return the error "Topic cannot be," but instead writes "Chat not found."

You must be logged in to vote
0 replies

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
⁉️
Q&A
Labels
None yet
7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.