Slack Notification mapping

Summary

Slack Notification Mappings define how to send Slack Notification when an issue operation has been performed.

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.

Creating a Slack Notification Mapping:

  1. Go to JEMH Cloud > Notifications > Slack > Create

  2. 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).

  3. On Submit, you should see the new Slack mapping

  4. To test the mapping, create an issue in the nominated project and go to Auditing > Events

  5. 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.

  6. The report of the event should confirm the message was sent to a selected Slack channel (e.g.) 

  7. 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.

Adding the Slack Notification Post Function to workflow transition:

  1. 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

  2. Select Send Slack Notification by JEMHCloud and click Add

  3. Set the Slack Connection, Chanel and Velocity script if necessary. Press Add/Update

     

  4. Move the Post Function to last position and publish the workflow draft.

  5. Remember to publish the workflow change draft! 

  6. To test the post function, go to an issue and perform the transition.

  7. Post function event should appear in JEMH Cloud > Notifications > Events. The event report identifies the channel notified:

     

  8. In Auditing > Outbound Messages, the table shows the SLACK messages sent.

Send Slack Notification when a email was not fully processed

You are able to send a Slack notification when a email was not fully processed by creating a IM Notification within Auditing > IM Notifications.

For more info about IM Notifications see: https://thepluginpeople.atlassian.net/wiki/spaces/JEMHC/pages/3762520067

When IM Notifications is configured it will send a notification for the following scenarios:

  • Excluded - Sends a notification when JEMHCloud excludes an incoming email. e.g. Sender matches a Exclusion, Email Subject matches a Exclusion.

  • No Catchemail Match - Sends a notification when JEMHCloud processes an incoming email that doesn't match the catchemail profile configuration.

  • Error Processing - Sends a notification when JEMHCloud can't process an incoming email because of an error. e.g. Outbound email is too large to be sent by the Mail Server.

  • Limit Exceeded - Sends a notification when JEMHCloud can't process an incoming email because limits have been exceeded (loop detection). e.g. Comment Count Limit exceeded (configured in Profile).

  • Forwarded - Sends a notification when JEMHCloud forwards an incoming email. e.g. due to exclusion, no catchemail match or error.

  • Precedence Bulk - Sends a notification when JEMHCloud ignores or forwards a inbound bulk email. e.g. emails that contain a “Precedence: Bulk” header. Precedence Bulk is configured within the Profile.

  • Message Dropped -Sends a notification when JEMHCloud drops an email for any reason.

  • User Created - Sends a notification when JEMHCloud auto-creates a user.

  • Log - Sends a notification when JEMHCloud needs to inform you something important outside the previous operations.

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.

If you cannot find your chosen channel, you can override this setting using the velocity script in the notification configuration:

  1. Select any channel - this will get overridden.

  2. Enter the following script in the velocity script editor, replacing AnotherChannelNameOrId with the channel name or channel ID:

$slackNotificationUtils.setChannel('AnotherChannelNameOrId')

You can find channel ID’s when accessing Slack through your Web Browser, normally under the following structure:

https://app.slack.com/client/WORKSPACE_ID/CHANNEL_ID

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
#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
#if (!$dateTimeUtils.betweenHours("18:00", "06:00")) $slackNotificationUtils.inhibitNotification() ## Slack messages are not sent during business hours ** #end

Restrict by priority

 

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