Integrate an automation rule with Microsoft Teams and Jira Data Center
プラットフォームについて: Data Center のみ。 - This article only applies to Atlassian apps on the Data Center プラットフォーム。
この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。 Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。
*Fisheye および Crucible は除く
要約
この手順では、自動化ルールを Microsoft (MS) Teams チャンネルに統合して Jira 課題に関する通知を表示する方法をご説明します。
Jira から MS Teams チャンネルにメッセージを送信するには、まず Microsoft Teams と Jira 自動化を統合する必要があります。この統合により、自動化が MS Teams チャンネルにメッセージを送信するために使用する Webhook URL が提供されます。この統合はいつでも取り消せます。
ソリューション
Microsoft Teams の統合をセットアップするには、Jira Webhook をリッスンするフロー チェーンを作成する必要があります。
Microsoft Teams に移動して、チャンネル名の横にある [その他のオプション (...)] > [ワークフロー] の順に選択します。
[その他のワークフロー] を選択し、次に [白紙から作成] を選択します。
[Search connectors and triggers (コネクタとトリガーを検索)] フィールドに、「Webhook」と入力します。
[トリガー] で、[When a Teams webhook request is received (Teams Webhook リクエストを受信したとき)] トリガーを選択します。
[Who can trigger the flow (フローをトリガーできるユーザー)] ドロップダウンで [全員] を選択します。
[新しいステップ] を選択して、[アクション] で [JSON の解析] を検索して、このオプションを選択します。
[コンテンツ] フィールドに「
@{triggerBody()}
」と入力します。"スキーマ" フィールドに、次の JSON スキーマを追加します。
{ "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 card in a chat or channel under Actions. Then:
[Post in (投稿の場所)] ドロップダウンで、[チャンネル] を選択します。
[チーム] と [チャンネル] の各ドロップダウンで、通知を投稿するチームとチャンネルを選択します。
"アダプティブ カード" フィールドに次の 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.5" }
ステップ チェーンがスクリーンショットのようになっていることを確認して、[保存] を選択します。
クリップボードに Webhook URL をコピーします。
データを送信できるように、Webhook ドメインを許可リストに追加します。追加しないと、Webhook がブロックされる可能性があります。
Webhook URL を Jira に貼り付ける
次の手順は、使用している Automation For Jira のバージョンによって異なります。
9.0.0 より前のバージョンの Automation For Jira
自動化ルールと [Send Microsoft Teams Notification (Microsoft Teams 通知を送信)] アクションに移動します。
ステップ 4 の Webhook URL を [Webhook URL] フィールドに貼り付けます。
9.0.0 以降のバージョンの Automation For Jira
こちらのドキュメンテーションの指示に従い、Microsoft Teams インターフェイスから取得した Webhook URL を使用して新しいシークレット キーを作成します。
自動化ルールと [Send Microsoft Teams Notification (Microsoft Teams 通知を送信)] アクションに移動します。
[Webhook URL] ドロップダウン メニューをクリックし、先ほど作成したシークレット キーを選択します。
設定完了です! Microsoft Teams チャンネルと統合されました。
マークダウンのサポート
Microsoft Team メッセージでは、基本的なリッチ フォーマットのマークダウンをサポートしています。ただし、以下を挿入することはできません。
画像
インライン HTML
HTML ブロック
カスタム ノード
ヒント
# や * などの特殊文字を文字としてメッセージ中に表示する場合は、文字をエスケープする必要があります。エスケープされていない特殊文字は、マークダウン関数として扱われます。文字をバックスラッシュで囲んでエスケープできます (例: \#\)。
例
バグが発生したら、Microsoft Teams チャンネルにメッセージを送信します。

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

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

これで完了です。Microsoft Teams でメッセージを送信できるようになりました。
この内容はお役に立ちましたか?