4

I'm developing a bot in telegram , here is my problem: I have some posts in my channel which some inline_keyboards are attached to them. when a user press the button , next events happen in a bot and some messages show to a user. if user has been started the bot before , there is no problem , if not I have error. how should I check the user is member of my bot or not to handle this problem???

1
  • Can you better explain what this buttons does and if they are buttons with link, show_alert etc?
    – 91DarioDev
    Aug 26, 2017 at 12:49

3 Answers 3

2

try to use sendMessage() API and send a message to user. After that telegram will response a status tell you whether success or not.

if started bot receive receive is ok, if not started bot receive is nothing.

{"ok":true,"result":{"message_id":9999,"from":{"id":00000000,"is_bot":true,"first_name":"mybot","username":"mybot"}}}

like that, good luck.

1

There is no way to check if bot can talk to user or not without send message.

You can use url with https://t.me/Bot?start=some_data format, and you will receive /start some_data, please try this link yourself.

0

The problem with this approach is that if a lot of users do the same, telegram starts to throttle your callbacks :( ... it would be so much easier if you could just read that information somewhere...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.