'Telegram bots API responds 403 Forbidden

I'm fairly new to programming and I want to make a simple bot for telegram. After creating new bot using bot father and getting token, I made a simple HTTP post request to the below address:

https://api.telegram.org/bot{token}/METHOD_NAME

But for any method, I faced with a 403 error page. What's wrong?



Solution 1:[1]

https://api.telegram.org/bot{yourtoken}/get_me(or any method name) just like me you are forgetting "bot" after https://api.telegram.org/

Solution 2:[2]

You should not replace bot string with your Bot's username, Just append given token at the end of /bot (e.g .../bot123456:ABC-D...) and your URL is ready.

Solution 3:[3]

replace keyword token with your string, which is provided by bot father. The telegram user who will interactive with bot, have to send /start command to bot. I think it is a kind of registering or allowing bot to work with user.

Solution 4:[4]

This happens to my bot when posting to an specific chat_id. You should check:

  1. Whether this fails for any chat id or some specific chat id.

  2. If message destination is a chat_id under your control, check that you didn't tell your Telegram client to delete the chat with the bot.

  3. If message destination is a group chat_id, check the bot is a member of the group.

Issuing a "get_me" instead should never get you a 403, so my suggestion is to first check whether everything is sending you a 403 or only a specific chat_id is the problem. If you are writing some notification software and this happens to you, you should stop sending messages and either alert the user (via some settings page, not Telegram) or if you don't have such means other than Telegram to contact the user just delete it from your database.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 brutalsam90
Solution 2
Solution 3
Solution 4 Matías Moreno