I’m using Telebot to build a simple Telegram bot. I’ve set up a message handler that responds to commands succesfully, but when I try to send a single message I get an error if I use the chat id (ex: 1234567890):
Error code: 403. Description: Forbidden: bot can’t send messages to
bots
I get a different error when I use the user id (ex: @my_user):
Error code: 400. Description: Bad Request: chat not found
This is my code, the auth is correct:
tg_bot = telebot.TeleBot(TG_TOKEN, parse_mode='MARKDOWN')
tg_bot.send_message(chat_id=CHAT_ID_USER, text="hola test")
Is the bot’s chat different to the chat I’m supposed to talk with? Any solution and details about the bot functionality will be apreciated, I’m still learning about that!
2
Answers
try this
If the user under this id has not started your bot, then the bot will not be able to write to him/her first. And in this case it is natural to get the error "chat not found". This error can also be observed when working with users who first used the bot and then blocked it.