skip to Main Content

i have one problem when i develop my bot.
I need to revoke invite link that i created by my bot. And i use your telegram bot api.
For example, i created next url and try to use it:
https://api.telegram.org/bot{token}/revokeChatInviteLink?chat_id={chatId}&invite_link={inviteLink}

(I’m sure that my token, chat_id and inviteLink are correct)
But this don’t work and return me error 400.
For example in value inviteLink i have string like that: https://t.me/+OlaTFdG1UftkOTgy

What i do wrong?
(Also method editChatInviteLink don’t work, i use it in the same way. I saw that method creatChatInviteLink return is_revoked = false, but i don’t know how to make it true)

I do it in C#, but I would be grateful for help in any other language.

2

Answers


  1. https://core.telegram.org/bots/api#revokechatinvitelink

    Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.

    You get 400 error. Ok, but what is the description of the error? Too less infomration to understand.

    If it doesn’t find the chat, have you putted the ‘-100’ before chat id? Channels and supergroup have this value before chat id.
    You can also use the bot api to finde the correct chat id.

    Login or Signup to reply.
  2. $apiToken = ”; //your bot apiToken

    $chat_id =’-1001790282017′; // your channel id

    $url = "https://t.me/+OlaTFdG1UftkOTgy";

    $purl = parse_url($url);

    $output = substr($purl[‘path’], 2); // OlaTFdG1UftkOTgy

    $revoke_link = "https://api.telegram.org/bot{apiToken}/revokeChatInviteLink?chat_id={$chat_id}&invite_link={output}";

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search