Reputation: 2265
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:
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
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:
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 ?
Upvotes: 3
Views: 18931
Reputation: 1
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'];
}
Upvotes: 0
Reputation: 72
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.
Upvotes: 0
Reputation: 2265
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 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!
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.
delete the bot name created problems, no more using that "name" :(
recreate a bot with different name.
Any similar experience ?
Upvotes: 1