Use the Slack Notification Transport

since 3.0.3

The Slack Notification Transport enables JEMH to send messages to the Slack communications platform in response to events that occur in your Jira.

Add webhook integration to Slack

  1. Navigate to the Slack App Directory web page

  2. Search for the Incoming WebHooks app

  3. Click Add to Slack

  4. Select a channel in Slack that you want messages to be sent to

  5. Click Add Incoming WebHooks integration

Slack will generate a Webhook URL for the integration. Copy this URL as you will need it shortly. At this point you can also customize the name, description and icon used by the integration. Save changes when done.

Jira Allowlist : Wildcard Expression

If you enable the Jira allow list, the webhook URL supplied by Slack needs to be added, for example:

https://hooks.slack.com/*

Issue Event driven Slack notification

Go JEMH > Notifications and select the Slack transport tab. Click New Transport Config.

Paste the Webhook URL that you copied from Slack into the Webhook field. If you wish, enter a description and a message that will be sent on saving on the configuration (to verify the webhook works).

If you already have a Project Mapping created, skip ahead to the Select event templates step. If you do not have any Project Mappings, create one by clicking New Project Mapping.

Enter the key of the project that you want to integrate with Slack, and save your changes.

Select event templates

  1. Select the Slack transport tab under Transports section. Then, under the

  2. Go to Project specific configurations select the mapping you want to edit then click the pencil icon to edit your project mapping configuration.

You will be presented with the slack project mapping configuration.

Select the transport configuration that you created earlier. Then, select a template for the issue event that you want a message to be sent to Slack for. Save your changes.

Now, when an issue event is fired for the project (and that event type has a template selected), the configured Slack channel will receive a message for it.

PostFunction Slack notification

The slack postfunction needs content that is in a JSON format:

Here is a minimalistic example:

{"text": "This is a line of text in a channel.\nAnd this is another line of text."}

The Slack IssueEvent templates could also be used as a basis, pasted as custom content, eg:

#set ($user = "<${baseurl}/secure/ViewProfile.jspa?name=$!actionUser.getUsername()|$!actionUser.getDisplayName()>") #set ($linkedissue = "<${baseurl}/browse/${issue.getKey()}|$!issue.getKey()>") #set ($title = $i18n.getText("email.event.activity.commented.issue", $user, "*", "*", $linkedissue)) #set ($simple = $i18n.getText("email.event.activity.commented.issue", $!actionUser.getDisplayName(), "", "", $!issue.getKey())) { "text": "$simple", "blocks": [ { "type": "divider" }, { "type": "section", "text": { "type": "mrkdwn", "text": "$title" } }, { "type": "section", "block_id": "section1", "text": { "type": "mrkdwn", "text": "<${baseurl}/browse/${issue.getKey()}|$!issue.getSummary()>" } }, { "type": "section", "block_id": "section2", "text": { "type": "mrkdwn", "text": " Your text here > < & & " } } ] }

Currently, a bug https://thepluginpeople.atlassian.net/browse/JEMH-7959 is preventing a custom slack transport TemplateSet being selectable in the Postfunction config where a custom slack transport is selected, that will be fixed in due course.