skip to Main Content

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?

4

Answers


  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/

    Login or Signup to reply.
  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.

    Login or Signup to reply.
  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.

    Login or Signup to reply.
  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.

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