skip to Main Content

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 ?

3

Answers


  1. Chosen as BEST ANSWER

    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 ?


  2. I,m getting this error through WebHook requests.
    This issue occurs after adding bot to a group and disable bot Add to group feature via BotFather.

    This issue exists until i fetch updates manually by /getUpdates method and make them passed for Telegram server and after that WebHook works fine.

    Hope this works for you too.

    Login or Signup to reply.
  3. return ok if bot API return respond error, like this example

    try {
            return Telegram::sendMessage($message);
        } catch (TelegramResponseException $exception) {
            Log::info($exception->getMessage());
            return ['ok' => 'true'];
        }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search