Telegram API: doesn't send message to user until receive first message from that user

Bojbaj picture Bojbaj · Aug 26, 2015 · Viewed 8.7k times · Source

I use Telegram API to send a message to a user with my bot. When the user sends me a message, that operation works but when I want to send a message to an user that haven't sent me any message to me before, then an error occurs (I have his user id):

{"ok":false,"error_code":400,"description":"Error: Bad Request: user not found"}

Is there a solution to solve this?

Answer

retif picture retif · Nov 10, 2015

Telegram bots cannot be a conversation initiators - they can write to user only after that user sends a message to bot first: https://core.telegram.org/bots#4-how-are-bots-different-from-humans

If this error appears in a group, first you need add this bot to that group.