Table of Contents |
---|
Summary
Slack Notification Mappings define how to send Slack Notification when an issue operation has been performed.
Info |
---|
Slack Notifications don't count toward Plan consumption and aren't capped. |
Configuring a Slack Notification Mapping
Slack Notification Mapping is in charge of sending Slack messages from Issue events through the Slack Connection. Here you define there are some options that allow you customise the type of notification that is sent and when the notifications should be sent.
...
Go to JEMH Cloud > Notifications > Slack > Create
Complete the form, select the nominated projects, select the Slack Connection you want to use and the channel that will receive Slack messages. Enter a velocity script if you want to modify the notification behaviour at runtime (more below).
On Submit, you should see the new Slack mapping
To test the mapping, create an issue in the nominated project and go to Auditing > Events
You should see the issue created event in the queue. When event has been processed, the configured channel in the mapping should have received an Slack message.
The report of the event should confirm the message was sent to a selected Slack channel (e.g.)
In Auditing > Outbound Messages > Type Slack, the table should show the Slack messages sent and the cog icon should show their contents.
Send Slack Notifications from Post Functions
JEMHCloud allows you to send Slack notifications when Issue transitions are performed through JIRA Post Functions.
...
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 Slack Notification by JEMHCloud and click Add
Set the Slack Connection, Chanel and Velocity script if necessary. Press Add/Update
Move the Post Function to last position and publish the workflow draft.
Remember to publish the workflow change draft!
To test the post function, go to an issue and perform the transition.
Post function event should appear in JEMH Cloud > Notifications > Events. The event report identifies the channel notified:
In Auditing > Outbound Messages, the table shows the SLACK messages sent.
...
Slack Notification Mapping configuration Options
Below are the available options that can be set to customise the Notification mapping.
Name
This is the name of the Notification Mapping
Enabled
This defines whether the notification mapping is enabled or disabled. If disabled, issue events will not generate Slack Notifications for this mapping.
Projects
This is a list of Projects that should be handled by this mapping. This can either be a select few or All Projects.
Issue Created
This is the template that will be used to render Issue Created notifications.
Issue Updated
The template to use to render Issue Update notifications.
Issue Deleted
The template to use to render Issue Deleted notifications.
Slack Connection
This is the Slack Connection that the Mapping will use to send messages
Channel
This is the channel that the notifications should be sent to.
JQL Whitelist
Optional JQL filter. Only issues matching this JQL expression will result in notifications being sent.
Velocity Script
Velocity Script can be used to customise the notification further. This allows you to inhibit or change parameters when specific conditions are met.
Unable to find your desired Slack channel?
Due to limitations with Slack API, we currently only display the first 1000 channels.
...
Filter Scripts
Both Slack Notification Mapping and Slack Post Function behaviour 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
Code Block |
---|
#if ($context.issue.fields.priority.name.textValue() != 'Critical') $slackNotificationUtils.setChannel('AnotherChannelNameOrId') ## JEMHC looks for the channel by either name or id #end |
Restrict notifications to specific time ranges
Notify only after hours
Code Block |
---|
#if (!$dateTimeUtils.betweenHours("18:00", "06:00")) $slackNotificationUtils.inhibitNotification() ## Slack messages are not sent during business hours ** #end |
Restrict by priority
Code Block |
---|
#if ($context.issue.fields.priority.name.textValue() != 'Blocker') $slackNotificationUtils.inhibitNotification() #end |
Warning |
---|
Velocity Script cannot be validated at configuration time (for example the dynamic channel). You should test the script by re-executing events in Auditing > Events |
Related Articles
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|