Answer the question
In order to leave comments, you need to log in
How to send a message to a user by @username and not by chat_id?
I have a website with a form on it, you need a person to enter his @username in Telegram, and the bot sends him a message with a secret key. How to implement it via API?
Answer the question
In order to leave comments, you need to log in
1. You cannot send a message to a person on behalf of a bot if he has not interacted with him before.
2. Bot Api does not allow sending a message to a person by username, the exception is the channel.
https://core.telegram.org/bots/api#sendmessage chat_id
parameter :
Unique identifier for the target chat or username of the target channel (in the format @channelusername)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question