Integrate an Automation rule with Microsoft Teams
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This procedure describes how to integrate an automation rule with a Microsoft (MS) Teams channel to show notifications about Jira issues.
If you want Jira to send messages to an MS Teams channel, you first need to integrate Microsoft Teams with Jira automation. This integration provides a webhook URL that automation uses to send messages to your MS Teams channels. This integration can be revoked at any time.
Solution
To set up a Microsoft Teams integration, you need to create a flow chain that will listen to Jira webhooks:
Navigate to Microsoft Teams, choose More options (...) next to the channel name, then choose Workflows
Select More workflows, then Create from blank.
In the Search connectors and triggers field, enter Webhook.
Under Triggers, select the When a Teams webhook request is received trigger.
In the Who can trigger the flow dropdown, select Anyone.
Select New Step, search for Parse JSON, and then select this option under Actions.
In the Content field, enter
@{triggerBody()}
.In the Schema field, add the following JSON Schema.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
{ "type": "object", "properties": { "summary": { "type": "string" }, "sections": { "type": "array", "items": { "type": "object", "properties": { "activityTitle": { "type": "string" }, "activitySubtitle": { "type": "string" }, "activityImage": { "type": "string" }, "activityText": { "type": "string" }, "facts": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "value": { "type": "string" } }, "required": [ "name", "value" ] } } }, "required": [ "activityTitle" ] } }, "potentialAction": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "targets": { "type": "array", "items": { "type": "object", "properties": { "uri": { "type": "string" }, "os": { "type": "string" } }, "required": [ "uri", "os" ] } }, "@@type": { "type": "string" } }, "required": [ "name", "targets", "@@type" ] } }, "themeColor": { "type": "string" }, "@@context": { "type": "string" }, "@@type": { "type": "string" } } }
Select New Step, search for Card, and then select Post message in a chat or channel under Actions. Then:
In the Post in dropdown, select Channel.
In the Team and Channel dropdowns, select the team and channel where the notification should be posted.
In the Adaptive Card field, add the following JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
{ "type": "AdaptiveCard", "body": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "items": [ { "type": "TextBlock", "weight": "Bolder", "text": "@{body('Parse_JSON')['sections'][0]['activityTitle']}", "wrap": true } ], "width": "stretch" } ] }, { "type": "TextBlock", "text": "@{body('Parse_JSON')['sections'][0]['activityText']}", "wrap": true }, { "type": "TextBlock", "weight": "Bolder", "text": "@{body('Parse_JSON')['sections'][1]['activityTitle']}", "wrap": true }, { "type": "ColumnSet", "columns": [ { "type": "Column", "items": [ { "type": "TextBlock", "weight": "Bolder", "text": "@{body('Parse_JSON')['sections'][1]['facts'][0]['name']}", "wrap": true } ], "width": "auto" }, { "type": "Column", "width": "auto", "items": [ { "type": "RichTextBlock", "horizontalAlignment": "Right", "inlines": [ { "type": "TextRun", "text": "@{body('Parse_JSON')['sections'][1]['facts'][0]['value']}" } ] } ], "verticalContentAlignment": "Center" } ] }, { "type": "ColumnSet", "columns": [ { "type": "Column", "items": [ { "type": "TextBlock", "weight": "Bolder", "text": "@{body('Parse_JSON')['sections'][1]['facts'][1]['name']}", "wrap": true } ], "width": "auto" }, { "type": "Column", "width": "auto", "items": [ { "type": "RichTextBlock", "horizontalAlignment": "Right", "inlines": [ { "type": "TextRun", "text": "@{body('Parse_JSON')['sections'][1]['facts'][1]['value']}" } ] } ], "verticalContentAlignment": "Center" } ] }, { "type": "ColumnSet", "columns": [ { "type": "Column", "items": [ { "type": "TextBlock", "weight": "Bolder", "text": "@{body('Parse_JSON')['sections'][1]['facts'][2]['name']}", "wrap": true } ], "width": "auto" }, { "type": "Column", "width": "auto", "items": [ { "type": "RichTextBlock", "horizontalAlignment": "Right", "inlines": [ { "type": "TextRun", "text": "@{body('Parse_JSON')['sections'][1]['facts'][2]['value']}" } ] } ], "verticalContentAlignment": "Center" } ] } ], "actions": [ { "type": "Action.OpenUrl", "title": "@{body('Parse_JSON')['potentialAction'][0]['name']}", "url": "@{body('Parse_JSON')['potentialAction'][0]['targets'][0]['uri']}" } ], "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.6" }
Verify that the step chain looks like on the screenshot, and then select Save.
Copy the webhook URL to the clipboard.
Add the webhook domain to the allowlist so that you can send data to it. Otherwise, the webhook could be blocked.
Paste webhook URL in Jira
The next steps will depend on the Automation For Jira version that you are using
For Automation For Jira on any version below 9.0.0
Go to your Automation rule and the Send Microsoft Teams Notification action
Paste the webhook URL from step 4 into the Webhook URL field
For Automation For Jira on any version from 9.0.0
Create a new Secret Key by following the instructions from this documentation and using the Webhook URL obtained from the Microsoft Teams interface
Go to your Automation rule and the Send Microsoft Teams Notification action
Click on the Webhook URL dropdown menu and select the secret key created earlier
All done! You are now integrated with your Microsoft Teams Channel.
Markdown support
Microsoft Team messages support basic markdown for rich formatting. The only limitations are you can't insert:
Images
Inline HTML
HTML Blocks
Custom nodes
Tip
If you're using characters such as # or * and you want them to appear as characters in your message content, you need to escape them else they'll be performing a markdown function. You can do this surrounding them with backslashes e.g. \#\
Example
Send a message to a Microsoft Teams channel when a bug is raised:

The message body is using smart values formatted with markdown language:

When this rule is triggered, a message in Microsoft Teams looks like this:

Done! You should now be able to be able to send messages with Microsoft Teams.
Was this helpful?