Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Set up Teams Workflows for Jira Automation in the Data Center to receive updates on the tickets

Teams Workflows provide a seamless way to automate tasks, integrate with various services, and improve team collaboration. This guide will help you navigate the process, ensuring a smooth transition from Connectors to Workflows, and use the full potential of the latest features and functionalities that Teams Workflows offer.

Create workflow in MS Teams

To set up a Microsoft Teams integration, you need to create a flow chain that will listen to Jira webhooks:

  1. Go to Microsoft Teams and find the channel where you want to send Jira notifications. Next to the channel name, select More options (...), then select Workflows.

Teams.png

      2. Select More workflows,

   More-Workflows.png

          then Create from blankScreenshot 2024-11-04 at 1.12.26 PM.png

      3. In the Search connectors and triggers field, enter Webhook. Now we need to                create a flow chain that will listen to webhooks and react to the JSON sent in the              request. In this example, we will send an adaptive card with information about the            changed issue to the channel.

      4. Under Triggers, select the When a Teams webhook request is received trigger.

 

whenwebhookrec.png

             a. In the Who can trigger the flow dropdown, select Anyone.

      5. Select New Step, search for Parse JSON, and then select this option under                    Actions.

           a. In the Content field, enter @{triggerBody()}.

           b. In the Schema field, add the following JSON Schema

{

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

        }

    }

}

     6.  Add new Step → Post card in a chat or channel

Select New Step, search for Card, and then select Post message in a chat or channel under Actions.

  1. In the Post in dropdown, select Channel.

  2. In the Team and Channel dropdowns, select the team and channel where the notification should be posted.

post.png

    7. In the Adaptive Card field, add the following JSON:

{
    "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"
} 

   8. Verify that the step chain looks like on the screenshot, and then select Save.

eight.png

   9. The webhook will be automatically generated after you save the workflow. Copy                the webhook URL to the clipboard.

nine.png

 

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 Jira automation version you’re using:

  • For a Jira automation version older than 9.0.0:

    1. Go to your automation rule, then select the Send Microsoft Teams notification action.

    2. Paste the webhook URL into the Webhook URL field.

  • For a Jira automation version newer than 9.0.0:

    1. Create a new secret key by following these instructions and using the webhook URL obtained from the Microsoft Teams interface.

    2. Go to your automation rule, then select the Send Microsoft Teams notification action.

    3. From the Wehbook URL dropdown select the secret key created earlier.

webhook.png

All done! You’re now integrated with your Microsoft Teams channel.

Markdown support

Microsoft Team messages support basic markdown for rich formatting. The only limitations are:

  • Images

  • Inline HTML

  • HTML blocks

  • Custom nodes

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; otherwise, they'll be performing a markdown function. You can escape the characters by surrounding them with backslashes, for example \#\.

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 using:

  1. Bold

  2. Italics

  3. Link

ex.png

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

ex2.png

1 comment

Volker Lutz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 6, 2024

Hei!

Thank you very much for this HowTo.
There is just a small typo, which lead me into using a wrong workflow step.

Maybe you want to update the documentation on point 6.

This is some kind of double information and in the bold text there ist "Post message" instead of "Post card". There is also an action "Post message" available in the workflow builder, but this is the wrong for this context.

Is it possible to post as "Flow Bot" to a public channel?
When I select this option in the "Post as" Dropdown the workflow runs successfully, but the Channel shows a card wird the text "We're sorry, this card couldn't be displayed".

When posting as user, everything is OK, but I think it can be misleading, when the user is shown as author, because this user is not the user who initiated the Jira action, but the user created the workflow.

Cheers,
Volker

 

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events