Skip to content

๐Ÿ“ญ Telegram notifications

coccoinomane edited this page May 14, 2022 · 1 revision

The bot can send notifications to your phone on successful and unsuccessful commands (e.g. sendTeamsMining, reinforceDefense, reinforceAttack, etc).

Follow these instructions for setup:

  1. Open Telegram.
  2. Enter @Botfather in the search tab and choose this bot.
  3. Choose or type the /start command and send it.
  4. Choose or type the /newbot command and send it. And follow Botfather's instructions.
  5. Take a note of your token value e.g. 11112222:AAASBBBSDASD. This is your TELEGRAM_API_KEY. And keep this private!
  6. Enter @your-newly-created-bot-name in the search tab and choose this bot.
  7. Choose or type the /start command and send it.
  8. Enter @username_to_id_bot in the search tab and choose this bot.
  9. Choose or type the /start command and send it.
  10. Take a note of your ID e.g. P.S. Your ID: 1122334455. This is your TELEGRAM_CHAT_ID.

Then, set your .env file:

  1. set NOTIFICATION_IM=1 and TELEGRAM_ENABLE=1
  2. set TELEGRAM_API_KEY and TELEGRAM_CHAT_ID
  3. run python3 -m src.tests.testSendIM

If everything worked fine, you should receive a Telegram message on your newly created bot.

Notify multiple users at once

To send Telegram notifications to more than one user, using same bot:

  1. Create a group chat with the other person.
  2. Add the bot to that chat group.
  3. Configure the bot with the chat ID of the chat group.

Credits

  • Thanks to @yigitest for the first implentation of the TG notifications ๐Ÿ’ช
  • Thanks to @nikohd12 for the chat group trick