Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status
colourYellow
titleDRAFT

Status
colourYellow
titleIN DEV

Table of Content Zone
Table of Contents

Summary

Slack is a cloud-based team collaboration that pretty much competes with HipChat. Like with HipChat, JEMHCloud collaboration tool used to communicate teams. JEMHCloud supports Slack notifications from Issue Events and Post Functions. You will be able to notify your Slack Channels when JEMHC detects an issue change.

Configuring the Slack Connection

...

To create a Slack Connection:

  1. Log into your Slack's Team

  2. Go to JEMH Cloud → Slack Connection → Connect To Slack

...

  1. Image Added

  2. Authorize JEMHC to be installed to Slack as an App. This allows communication from JEMHCloud to Slack

...

  1. Image Added



  2. Check out new Slack Connection on the screen.

...

Once you have the connection created, you can set Slack Notification Mappings to drive Slack notifications from Issue Created/Updated/Deleted events or Slack Post Functions to drive Slack notifications from transition events.

Send Slack notifications from issue events

Like Email , HipChat or and SMS Notification Mapping, Slack Notification Mapping is in charge of sending Slack messages from Issue events through the Slack Connection.

Creating an SMS a Slack Notification Mapping:

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

    Image Added
  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

...

  1. want to

...

  1. modify the notification

...

  1. behaviour at runtime (more below).

...

  1. Image Added
  2. On Submit, you should see the new Slack mapping

...

  1. Image Added
  2. To test the mapping, create an issue in the nominated project and go to Auditing → Events

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

...

  1. Image Added
  2. The report of the event should confirm the message

...

  1. was sent to a selected Slack channel (e.g.) 

    Image Added
  2. In Auditing → Outbound Messages → Type Slack, the table should show the Slack messages sent and the cog icon should show their contents.

...

  1. Image Added

...


  1. Image Added


Send Slack Notifications from 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

...

  1. . Click on the transition you want to change and select the Post Functions tab. Click on Add post function

...

  1. Image Added
  2. Select Send Slack Notification by JEMHCloud and click Add

...

  1. Image Added
  2. Set the Slack Connection, Chanel and Velocity script if necessary. Press Add/Update

...

  1. Image Added

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

...

  1. Image Added
  2. Remember to publish the workflow change draft! 

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

...

  1. Post function event should appear in JEMH Cloud → Notifications → Events.

...

  1. The event report identifies the channel notified:

...

  1. Image Added

  2. In Auditing → Outbound Messages, the table

...

  1. shows the SLACK messages sent

...

  1. .

...

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:

Code Block
$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 behavior 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

No Formatcode
#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)
showLabelsfalse
max5
spacesJEMHC
sortmodified
showSpacefalse

...

reversetrue
typepage
cqllabel in ( "events" , "notifications" ) and type = "page" and space = "JEMHC"
labelsnotifications events
Page Properties
hiddentrue


Related issues