In this page
Overview
Slack is a leading workplace communications platform, offering chat rooms (channels) organized by topic, private groups, and direct messaging. Slack is a strategic partner of Atlassian and a preferred instant messaging platform in the Atlassian Ecosystem.
Watch this short tutorial video about creating and using Slack automations, then follow the step-by-step guide in the next section:
Sending a Slack message about a new changeset
This automation sends a notification message to a Slack channel about the changeset after that has been accepted by the repository:
The message content can be freely customized, allowing you to post anything from short summaries to longer details.
Configuration
- Login into your Slack account.
-
Go to Incoming WebHooks.
- Choose the default channel for the messages.
- Click Add Incoming WebHooks integration.
- Copy the Webhook URL to clipboard.
- Login to Jira as admin, go to Administration → System → Automation rules.
- Click Create rule.
- Select the trigger Changeset accepted (from the DevOps category).
- Click Save.
- Click Add component and select New condition.
- Select the condition Advanced compare condition.
- Enter {{devops.changeset.commits.size}} to the First value field.
- Choose the does not equal option from the Condition dropdown.
- Enter "0" to the Second value field.
- Click Save.
- Click New action.
- Select the action Send Slack message.
- Paste the Webhook URL you just configured.
-
Enter the following content into the Message field:
_[DEVOPS] {{devops.changeset.commits.size}} new commit{{#devops.changeset.commits}}{{^first}}{{#last}}s{{/}}{{/}}{{/}}{{^devops.changeset.commits}}s{{/}} in {{devops.changeset.repositoryId}}_ {{#issues.size}} *{{issues.size}} issue{{#issues}}{{^first}}{{#last}}s{{/}}{{/}}{{/}}* linked: {{/}} {{^issues.size}} No issues linked. {{/}} {{#issues}} <{{url}}|{{key}}> {{summary}} {{/}} {{#devops.changeset.commits}} ————— Commit: *#{{id}}* · Branch: *{{branch}}* · Author: *{{author}}* >{{message.replace("\n","\n>")}} *{{files.size}} file{{#files}}{{^first}}{{#last}}s{{/}}{{/}}{{/}}{{^files}}s{{/}}* changed: {{#files}} `{{action.label}}` {{path}} {{/}} {{/}}
Notes:- You can use the Slack markdown syntax here.
- Override Channel or user or leave as default as you set it in step 2.
- Click Save.
- Name your automation rule intuitively, and click Turn it on.
Usage
- Create a commit in your repository with this message:
Implement the FOO-1 feature.
- Then another with this:
Fix the FOO-2 and FOO-3 bugs.
- A Slack message will be sent to the selected channel with the linked issue list and the commit details.
Troubleshooting
If you don't get the expected results:
- See the general troubleshooting steps.
Questions?
Ask us any time.