README.md

codesamples-perl-codeExampleBot

Perl 5.26 LWP::UserAgent Telegram API NASAAPI to Telegram

Description

In fact a gateway between the NASA API and Telegram API - if you run the bot it will get the information about closet asteroids to Earth for today and then choose on random asteroid from a returned list and send it to Telegram API to the bot, for which you would provide token and chat id(should be received from Telegram API and populated to the bot configuration cfg file in config folder)

Purposes

To demonstrate ability to work with various APIs and implement cross-API interaction on Perl using LWP::UserAgent

Requirements

  1. Perl 5.26
  2. LWP::UserAgent
  3. Telegram bot created via botFather(see here: https://core.telegram.org/api)

    Installation instructions (approximate, not the last ones to follow):

  4. git clone this project
  5. [optional] sudo apt-get install perl
  6. [optional] sudo apt-get install libwww-perl
  7. [optional] sudo apt-get install liburi-encode-perl
  8. [optional] sudo apt-get install libjson-perl
  9. [optional] sudo apt-get install libconfig-simple-perl
  10. Open your telegram app
  11. Search for @botfather - simply put @botfather to search widget
  12. You will see BotFather and ‘I can help you create and m…’ below
  13. Click on it and press start
  14. Command @BotFather a /newbot
  15. You will receive ‘Alright, a new bot. How are we going to call it? Please choose a name for your bot.’
  16. Answer with the name of your bot
  17. The system asks for the user name of your bot
  18. Answer with something that ends with _bot
  19. You will receive token
  20. [as per https://core.telegram.org/bots/api , follow to Making Requests header] Follow https://api.telegram.org/bot/getUpdates (instead of you token value)
  21. Send something to your bot and refresh the page mentioned at point 15 - you should get you chat id - token and chat_id to the /config/codeExampleBot_config.cfg instead of placeholder message after =
  22. Additional information via https://blog.meer-web.nl/sending-telegram-messages-using-php/

How to run?:

  1. perl /path/to/codeExampleBot.pl
  2. Check you Telegram for message
Описание

Portfolio demo app API requests

Конвейеры
0 успешных
0 с ошибкой