Search code examples
telegramtelegram-botpython-telegram-bottelegram-webhooknode-telegram-bot-api

Is it possible to programmatically pre-approve a user to a telegram group or channel


I want to allow only users from a particular school - say Harvard - to access a telegram group. So, I need the person to “register” - say on a bot and share his [email protected] email address. I then verify the email through a verification code. He has to enter the code in the registration and only thereafter he can join the telegram group.

No other person is allowed to join the telegram group. As such, there shouldn’t be a telegram link that someone can use to get into the group unauthenticated.

Is this possible to do technically? I see a company called “invite member” and they seem to be able to do something similar, except they charge a user for membership, so it means presumably there is a way to allow a telegram group to selectively accept members.

Thanks!


Solution

  • There are couple of paid services (bots) which do this, however the logic behind this is to:

    1. User should contact bot.
    2. Verify details.
    3. Enqueue a verified user.
    4. Call exportChatInviteLink.
    5. Send invite link.
    6. Wait for user to join group.
    7. Process next user.

    The reason to use a queue is because everytime exportChatInviteLink is called it revokes the previous link, so if two users are using the bot concurrently, the link should be sent to given out in order. You should also have some Time To Live logic for a user to join the group in a specified amount of time otherwise the link is given to the next user.