Telegram Notification task uses Telegraf - Telegram Bot Framework for Node.js and allows you to send customizable notifications to your Telegram chats and groups. This task has some predefined options of what info (e.g build/release status, ID etc.) to include in the message about your build/release process.
Only three steps to start receiving your notifications: 1. Create a Bot 2. Get Chat Ids 3. Customize your notifications
Follow the instructions below to configure the Telegram Notifications task to send messages to a group or chat.
First of all, you need to create a Telegram bot which will later send all the notifications to your chats.
- Talk to Bot Father: follow Bot Father's instructions and create a bot
- Save Bot Token: this token will be used by the task
- Add your bot to every chat you want to be notified
Having a bot allows you to fully customize its appearance (nickname, user picture) and add it to as many chats or groups as you want.
Currently, Telegram doesn't offer a convenient way to obtain all chat IDs from bot API. So there are two ways to do it:
1. Add @RawDataBot to your group
Upon joining it will send a JSON where your chat ID will be located at message.chat.id.
Don't forget to remove the bot from chat right after.
If you want the bot to send notifications directly to you (not a group), the trick with @RawDataBot won't work. You need to:
- Check "Get chat Id" in task properties
- Queue build or release: please make sure that this action won't affect any of your production processes. I suggest creating empty build\release definition just to get chat ID and then paste them into the real task.
- Type /chat: while the task is running use /chat command in every chat where your bot is present
- Type /stop: use this command to finish task execution
- Paste your chat IDs to task properties: copy all your IDs to task property (use comma as delimiter e.g -123456678,321654987)
There are some basic predefined features both for build and release tasks.
General
- Add task status - shows whether the task finished successfully, failed or has some issues.
In order this to work properly, don't forget to change run conditions of the task to "Even if a previous task has failed"
- Add project link - adds a link to your team project
- Message - add a custom message to your notification. You can use html markup.
For Release
- Name - The name of the current release.
- Created by - The display name of identity that triggered the release.
For Build
- Number - The name of the completed build.
- Queued by - The display name of identity that queued the build.
NOTE: USE EITHER RELEASE OR BUILD RELATED OPTIONS DEPENDING ON YOUR PROCESS