Skip to content

Telegram configuration

Vasenkov Stanislav edited this page Oct 3, 2022 · 10 revisions

1. Telegram bot notification configuration

To receive telegram bot notifications, you need to fill in the part of the configuration file referring to telegram

Configuration template for telegram bot notifications:

  "telegram": {
    "token": "...",
    "chat": "...",
    "replyTo": ""
  }
  • "token" - Token to access the HTTP API
  • "chat" - Bot ID
  • "replyTo" - Leave the field blank

Next, let's look at how to get this data

1.1. Token

  1. Chat with @BotFather and he will give you a bot
  1. Remember the token you got from @BotFather

1.2. Chat

  1. Add bot to your telegram chat (and make it admin)

  2. Get telegram chat id, you can find it here -> https://api.telegram.org/botXXX:YYYYY/getUpdates (replace the XXX: YYYYY with your BOT HTTP API Token you just got from the Telegram BotFather)

The final configuration will look like this:

  "telegram": {
    "token": "7011306889:BBHJ9-NEi3KUYR2W-nzE2X7e1oMdHEdr9Jw",
    "chat": "654789321",
    "replyTo": ""
  }

2. Adding allure-notifications.jar to your autotests project

3. Configure Jenkins (for example)

java  \
"-Dchat.id=-1053872341..." \
"-Dbot.token=1265622901:AAHTwGNmvuqc..." \
"-Dproject.name=${JOB_BASE_NAME}" \             <- jenkins environment var
"-Dbuild.launch.name=Some release 2.0" \
"-Dbuild.env=https://prod.your.site" \
"-Dbuild.report.link=${BUILD_URL}" \            <- jenkins environment var
"-Dlang=en" \
"-Denable.chart=true" \
"-Dallure.report.folder=./allure-report/" \
-jar allure-notifications-2.2.1.jar

4. Telegram bot notification example