Telegram Bot API errors codes (integrating Groups and Channels)

15,271

I answer myself having found a possible reason of the problem. The problem arise just with a single specific Bot I created in past (and I removed from a group). As specificed in question:

Step by step story

  • step 1: After creation I added that bot on a group with 2 users: (myself and a second person).

  • step 2: Afterward I removed that bot from the group.

  • step 3: I used that bot to test my BOTserver sending SendMessage od reply to webhook update. Now i experienced the mentioned 400/403 errors.

  • step 4: I DELETED that Bot, chatting with BotFather.

  • step 5: I created again the same Bot with the **SAME identichal name*

  • Step 6: I tested again, an I rised the usual issue:

    Telegram API has returned the error. (ok: "false", error_code: "401", description: "[Error]: Unauthorized"):

  • Step 7: I created new bot(s) with different name(s) Finally, no more errors!

Conclusion:

I fair the original Bot name remained in a "wrong" Telegram server internal status. My hypotesis is that adding/removing Bots from Groups have some problem/bug.

My Solution:

  • delete the bot name created problems, no more using that "name" :(

  • recreate a bot with different name.

Any similar experience ?

Share:
15,271
Giorgio Robino
Author by

Giorgio Robino

Curriculum Vitae: http://linkedin.com/in/giorgiorobino Homepage: http://www.convcomp.it Ambient music soundscapes: http://solyaris.altervista.org

Updated on June 06, 2022

Comments

  • Giorgio Robino
    Giorgio Robino almost 2 years

    I'm working on my open-source project BOTServer a http://telegram.org Bot Platform Webhooks Server, for Rubyists.

    I experienced strange error when sending messages (sendMessage API endpoint) on a Telegram Bot I created. when sending messages to a specific Bot I created, I got these errors:

    1. Error code 400 -> Bad Request: group is deactivated

      Telegram::Bot::Exceptions::ResponseError - Telegram API has returned the error. (ok: "false", error_code: "400", description: "[Error]: Bad Request: group is deactivated")

    and/or

    1. Error code 403 -> Bot was kicked from a chat

      Telegram::Bot::Exceptions::ResponseError - Telegram API has returned the error. (ok: "false", error_code: "403", description: "[Error]: Bot was kicked from a chat")

    That's really strange. It seems that the problem is related to the "story" of a specific Bot (errors are not systematic and I do not have issues with another bot). In facts I done these steps:

    1. I create the bot (lets cal it: MYbot)
    2. I ADDED the bot to a Telegram Group (e.g. MYGroup)
    3. I REMOVED the bot from the Group
    4. I send messages from the bot in reply to a user (then I got errors)

    Question 1 Ok I'm pretty sure something wrong happened Telegram Serve side and I could delete and rebuild the bot... Any better idea about a solution ?

    Question 2 There is a published list of Telegram Bot errors ? I didn't find in Telegram Bot documentation/tutorials.

    I love Telegram architecture! But I feel there are some issue/bugs with Bots APIs especially in recent possibilities to insert Bots in Groups and Cahnnel. Any similar experience ?