Как зарегистрировать своего бота в Telegram и получить token и chat_id

Инструкция по шагам.

  1. Открываем Телеграм и ищем контакт @BotFather, и открываем с ним чат и нажимаем внизу Начать.
  2. Пишем боту /newbot , он ответит «Alright, a new bot. How are we going to call it? Please choose a name for your bot.» — он говорит, что бот создан и спрашивает, как его назвать — пишем ему имя нашего будущего бота, конечно же на английском, например: mylitlebot
  3. Бот напишет вам «Good. Now let’s choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.»  — просит указать username нашего бота. напишем ему имя, причем в конце обязательно должны быть символы bot, например myseperlitle_bot  (ошибка сделана намерено, потому что @mysuperlitle_bot уже был кем то зарегистрирован на момент написания данной статьи)
  4. Бот ответит вам следующим текстом
    Done! Congratulations on your new bot. You will find it at t.me/myseperlitle_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you’ve finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.Use this token to access the HTTP API:
    505718974:AAHYpDfIaIJNRWY1KDiMrDagP-YqsUQE6ts  For a description of the Bot API, see this page:
    https://core.telegram.org/bots/api
    505718974:AAHYpDfIaIJNRWY1KDiMrDagP-YqsUQE6ts — это и есть ваш токен нового бота.
    Теперь можно создать чат с ботом и получить его chat_id
  5. Ищем чат по userame указанном нами в п.3 @myseperlitle_bot  или перейдем по ссылке, которую нам прислал бот в последнем сообщении http://t.me/myseperlitle_bot, словом открываем чат с ботом и пишем ему что-нибудь. Далее берем наш токен вставляем его в следующую строку вместо строки {token}
    https://api.telegram.org/bot{token}/getUpdates
    в моем случае это был такой url:   https://api.telegram.org/bot505718974:AAHYpDfIaIJNRWY1KDiMrDagP-YqsUQE6ts/getUpdates
    отправляем запрос через  браузер и получаем ответ:

    {"ok":true,"result":[{"update_id":485763969,
    "message":{"message_id":1,"from":{"id":376718569,"is_bot":false,"first_name":"\u041f\u043e\u043a\u0430\u043b\u044c\u043d\u0435\u0442\u043e\u0432","last_name":"\u041f\u0430\u0432\u0435\u043b","username":"RedXes","language_code":"en"},"chat":{"id":376718569,"first_name":"\u041f\u043e\u043a\u0430\u043b\u044c\u043d\u0435\u0442\u043e\u0432","last_name":"\u041f\u0430\u0432\u0435\u043b","username":"RedXes","type":"private"},"date":1513335210,"text":"/start","entities":[{"offset":0,"length":6,"type":"bot_command"}]}}]}

    среди всего этого видим строку «chat»:{«id»:376718569,    376718569  — это и есть наш chat_id

В итоге  мы получили:
token = 505718974:AAHYpDfIaIJNRWY1KDiMrDagP-YqsUQE6ts
chat_id = 376718569

 

   Отправить статью как PDF   

Комментариев 299 на “Как зарегистрировать своего бота в Telegram и получить token и chat_id

  1. Pingback: canada rx

  2. Pingback: pinshape.comusers2612491-medicine-online-order

  3. Pingback: climbingcoaches.co.ukmember-homecanadianpharmaciesprofile

  4. Pingback: https://www.mixcloud.com/canadapharmacies/

  5. Pingback: www.viki.comuserscanadianpharmaciessabout

  6. Pingback: canadian government approved pharmacies

  7. Pingback: northwest pharmacy canada

  8. Pingback: online canadian pharmacies

  9. Pingback: https://www.beastsofwar.com/forums/users/canadiancialis/

  10. Pingback: www.nzrelo.comforumsuserscanadianviagragenericpharmacy

  11. Pingback: https://bitcoinblack.net/community/prescription-drugs-from-canada/info/

  12. Pingback: offcourse.cousersprofilepharmacy-cheap-no-prescription

  13. Pingback: canadian online pharmacies

  14. Pingback: www.celtras.uniport.edu.ngprofilecanadianpharmacy

  15. Pingback: online pharmacies

  16. Pingback: www.cakeresume.commeonline-drugs-without-prescriptions-canada

  17. Pingback: https://www.passivehousecanada.com/members/online-drugs-without-prescriptions-canada/

  18. Pingback: canadian pharmaceuticals

  19. Pingback: canadian pharmacy no prescription

  20. Pingback: https://forum.melanoma.org/user/canadianpharmacyonline/profile/

  21. Pingback: canadian medications

  22. Pingback: http://climbingcoaches.co.uk/member-home/londondrugscanada/profile/

  23. Pingback: canada drugs

  24. Pingback: https://jemi.so/generic-viagra-online-pharmacy

  25. Pingback: https://www.passivehousecanada.com/members/canada-pharmaceuticals-online-generic/

Комментарии закрыты