Telegram Integration
BETA
Telegram is a messaging app with a focus on speed and security, it’s super-fast, simple and free. It's cloud based like Slack and RockChat. According to Telegram, the app's architecture does not support federation yet like Mattermost.
The messaging format is simpler that RocketChat, Mattermost or Slack. It doesn't allow complex messages like showing avatars, fields, headers, etc. The message format is closer to an SMS message than a "Card" like Slack provides.
JEMHCloud supports Telegram notifications from Issue Events and Post Functions. You will be able to notify your Telegram Channels when JEMHC detects an issue change.
Configuring the Telegram Connection
In order to send Telegram notifications from Issue and Post function events, you need to create a bot and add the bot to a group or a private conversation.
Once you have the bot, you can enter the bot token to JEMHCloud in order to create the Telegram Connection.
Configure Telegram's Bot
For this step, we are assuming that you have a Telegram account.
Log into Telegram Web Portal and talk to the BotFather. The link is the following https://web.telegram.org/#/im?p=@BotFather
To create a new bot, send the message /newbot to the BotFather. Enter a unique Bot Name and Bot Username (for example myCompoanyJira and my CompanyJira_bot).
This will create and configure the bot. The bot has a token associated that will be used to authenticate JEMHC with Telegram sending messages as your bot.
Click on the t.me/MyBotUsername_bot link to start a conversation with your Bot. Send a message to the Bot. This will simplify the bot user search when creating a group.
Create a Group where you want JEMHC to notify about issue changes. Add the created bot and your team members to the group.
Double check that the Bot is added to the group. Use @ notation to mention the bot user.
Copy the token BotFather has generated for your room.
Create JEMHCloud's Telegram Connection
Go to JEMHCloud → Messages → Telegram Connections
Click on Create button.
Once in the Telegram Connection form, enter a name and paste the token generated in Telegram's BotFather chat.
Submit. If the configuration is ok, you should see a test message in Telegram's chat
Create JEMHCloud's Telegram Notification Mapping
Like Email and SMS Notification Mapping, Telegram Notification Mapping is in charge of sending Telegram messages from Issue events through the Telegram Connection.
Creating a Telegram Notification Mapping:
Go to JEMH Cloud → Notifications → Telegram → Create
Complete the form, select the nominated project, select the Telegram Connection and the chat (for example the new group chat where the bot is a member). Enter a velocity script if you want to modify the notification behavior at runtime (more below). Be sure that the Group Chat is listed in the select. If not, mention the bot user in the Telegram's chat group and refresh the Telegram Notification Page in JEMHCloud.
On Submit, you should see the new Telegram mapping
To test the mapping, create an issue in the nominated project and go to Auditing → Events
You should see the issue created an event in the queue. When the event has been processed, the configured channel in the mapping should have received a Telegram message
The report of the event should confirm the message sent
In Auditing → Outbound Messages → Type Telegram, the table should show the Telegram messages sent and the cog icon should show their contents.
Send Telegram Notifications from Post Functions
JEMHCloud allows you to send Telegram notifications when Issue transitions are performed through JIRA Post Functions.
Adding the Telegram Notification Post Function to workflow transition:
Go to right corner Cog → JIRA Administration → Issue → Workflows. Edit the workflow of the project you want to add the Post Function
Click on the transition you want to change and select the Post Functions tab. Click on Add post function
Select Send Telegram Notification by JEMHCloud and click Add
Set the Telegram Connection and Velocity script if necessary. Press Add/Update
Once the Post Function is in the right position, publish the workflow draft.
To test the post function, go to an issue of the given workflow and perform the transition that will fire the post function.
Post function event should appear in JEMH Cloud → Notifications → Events.
The event report should show the used incoming webhook URL
The message in Telegram:
In Auditing → Outbound Messages, the table should show the Telegram messages sent and the cog icon should show their contents.
Filter Scripts
Both Telegram Notification Mapping and Telegram Post Function behavior can be changed at runtime with a Velocity Script. The script can use the event data or be time-based to change how notifications are performed.
Change Channel
Change channel when Critical
#if ($context.issue.fields.priority.name.textValue() != 'Critical')
$telegramNotificationUtils.setChat('Fernando') ## JEMHC to send the message to chat. It can be the chat id or a name of a group or a user.
Restrict notifications to specific time ranges
Notify only after hours
#if (!$dateTimeUtils.betweenHours("18:00", "06:00"))
$telegramNotificationUtils.inhibitNotification() ## Telegram messages are not sent during business hours **
#end
Restrict by priority
#if ($context.issue.fields.priority.name.textValue() != 'Blocker')
$telegramNotificationUtils.inhibitNotification()
#end
Velocity Script cannot be validated at configuration time (for example the dynamic chat name). You should test the script by re-executing events in Auditing → Events