自動化ルールを Microsoft Teams と統合する

プラットフォームについて: Data Center のみ。 - この記事は、 Data Center プラットフォーム

この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。 Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。

*Fisheye および Crucible は除く

要約

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.

ソリューション

Microsoft Teams の統合をセットアップするには、Jira Webhook をリッスンするフロー チェーンを作成する必要があります。

  1. Navigate to Microsoft Teams, choose More options (...) next to the channel name, then choose Workflows

    MS Teams Workflows Selection

  2. [その他のワークフロー] を選択し、次に [白紙から作成] を選択します。

  3. [Search connectors and triggers (コネクタとトリガーを検索)] フィールドに、「Webhook」と入力します。

  4. [トリガー] で、[When a Teams webhook request is received (Teams Webhook リクエストを受信したとき)] トリガーを選択します。

    1. [Who can trigger the flow (フローをトリガーできるユーザー)] ドロップダウンで [全員] を選択します。

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

    1. [コンテンツ] フィールドに「@{triggerBody()}」と入力します。

    2. 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" } } }

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

    1. [Post in (投稿の場所)] ドロップダウンで、[チャンネル] を選択します。

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

      Post MS Teams card in channel
  7. 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" }

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

    MS Teams Workflow Configuration

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

    Copying MS Teams webhook URL

Webhook URL を Jira に貼り付ける

次の手順は、使用している Automation For Jira のバージョンによって異なります。

  1. 9.0.0 より前のバージョンの Automation For Jira

    1. 自動化ルールと [Send Microsoft Teams Notification (Microsoft Teams 通知を送信)] アクションに移動します。

    2. ステップ 4 の Webhook URL を [Webhook URL] フィールドに貼り付けます。

      Microsoft Teams メッセージの Webhook URL

  2. 9.0.0 以降のバージョンの Automation For Jira

    1. こちらのドキュメンテーションの指示に従い、Microsoft Teams インターフェイスから取得した Webhook URL を使用して新しいシークレット キーを作成します。

    2. 自動化ルールと [Send Microsoft Teams Notification (Microsoft Teams 通知を送信)] アクションに移動します。

    3. [Webhook URL] ドロップダウン メニューをクリックし、先ほど作成したシークレット キーを選択します。

      Microsoft Teams と Jira を統合するためのシークレット キー

設定完了です! Microsoft Teams チャンネルと統合されました。

マークダウンのサポート

Microsoft Team メッセージでは、基本的なリッチ フォーマットのマークダウンをサポートしています。ただし、以下を挿入することはできません。

  • 画像

  • インライン HTML

  • HTML ブロック

  • カスタム ノード

ヒント

# や * などの特殊文字を文字としてメッセージ中に表示する場合は、文字をエスケープする必要があります。エスケープされていない特殊文字は、マークダウン関数として扱われます。文字をバックスラッシュで囲んでエスケープできます (例: \#\)。

バグが発生したら、Microsoft Teams チャンネルにメッセージを送信します。

Ms Teams 経由でバグが報告されたときにチームにアラートを送信する自動化

メッセージ本文では、マークダウン言語でフォーマットされたスマート値を使用しています。

自動化の Teams メッセージの内容

このルールがトリガーされると、Microsoft Teams 内のメッセージは次のように表示されます。

Automation for Jira によって送信されるサンプル Teams メッセージ

これで完了です。Microsoft Teams でメッセージを送信できるようになりました。

更新日時: 2025 年 2 月 23 日

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。