# Teams Webhooks

## Microsoft Teamsのセットアップと連携

書式付きのアラートをMicrosoft Teamsのチャンネルへ送るには、以下の手順に従います。

**(1)** 通知を出したいTeamsチャンネルで、**\[⋯]** (その他メニュー) をクリックし、**\[ワークフロー]** を選びます。

<figure><img src="/files/0Ogj9MKCZNYm7tUHdy90" alt="チャンネルでワークフローを選択" width="243"><figcaption></figcaption></figure>

**(2)** 検索ボックスに `webhooks` と入力してワークフローを絞り込み、**\[Send webhook alerts to a channel]** を選びます。

<figure><img src="/files/ZvN4FygRnDu6a29s6vG7" alt="チャンネルにWebhookワークフローを追加" width="338"><figcaption></figcaption></figure>

**(3)** チャンネルが属するチームを選びます。対象チャンネルは最初から選ばれていることが多いです。

<figure><img src="/files/AWbapyFZRHu3OxTvfEEc" alt="チームとチャンネルを選択してWebhookを設定" width="418"><figcaption></figcaption></figure>

**(4)** 作成したワークフローの画面に表示されるWebhook URLをコピーします。

<figure><img src="/files/iCtKCMYQAZ0KMuZeyQD2" alt=""><figcaption></figcaption></figure>

**(5)** Keeper管理コンソールにログインし、**\[レポートとアラート]** > **\[アラート]** を開き、新規でアラートを作成するか、既存のアラートを開きます。

<figure><img src="/files/d9plUk3BpKrrrDnAO35A" alt=""><figcaption><p>アラートの追加</p></figcaption></figure>

**(6)** **\[受信者]** > **\[受信者を追加]** をクリックします。

<figure><img src="/files/iUZkBhF1A38ldIApuh1r" alt=""><figcaption><p>受信者の追加 (Teams)</p></figcaption></figure>

**(7)** 受信者名とメールアドレスを入力し、**\[Webhookを追加]** をクリックします。

<figure><img src="/files/B5lzmytCEAaB59atLQ3P" alt=""><figcaption><p>Webhookの追加</p></figcaption></figure>

**(8)** 手順 **(4)** でコピーしたWebhook URLを入力欄に貼り付けます。続けて、下記のJSONを **\[HTTPボディ]** 欄にコピーして貼り付けます。

<figure><img src="/files/UrWOWHrKAPLd0m07Vgcb" alt=""><figcaption><p>URLとHTTPボディの追加</p></figcaption></figure>

```
{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "Alert: #alert_name",
    "sections": [{
        "activityTitle": "#description",
        "activitySubtitle": "#alert_name",
        "activityImage": "https://keeper-email-images.s3.amazonaws.com/common/Keeper_512x512.png",
        "facts": [{
            "name": "User",
            "value": "#username"
        }, {
            "name": "Timestamp",
            "value": "#timestamp"
        }, {
            "name": "IP Address",
            "value": "#remote_address"
        }],
        "markdown": true
    }]
}
```

**(9)** 受信者の設定で **\[保存]** をクリックし、続けてアラートの画面でも **\[保存]** をクリックします。

<figure><img src="/files/X73fU0hT772i5DZE4k5B" alt="" width="375"><figcaption><p>Webhookの追加</p></figcaption></figure>

<figure><img src="/files/qpenJfRkbyK58BuvkbwH" alt=""><figcaption></figcaption></figure>

以上です。イベントがTeams側に届き始めるまで最大15分かかることがあります。HTTP本文は用途に合わせて書き換えてかまいません。カードの見た目を細かく調整するときは、[Microsoftのコネクタに関するドキュメント](https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using)をご参照ください。

{% hint style="info" %}
Webhook本文を新しく作った直後や編集した直後は、内容が有効になるまで最大15分かかることがあります。
{% endhint %}

## コマンドラインによるWebhooksのテスト (任意)

Mac/Linux環境では、書式を手早く試すために `curl` が使えます。

* `test.json` などのファイルにWebhook本文 (JSON) を保存
* 以下のコマンドの `<WEBHOOK URL>` を、実際のSlackまたはTeamsのWebhook URLに置き換えて実行

```
# MacおよびLinuxの場合:
curl -X POST -H 'Content-type: application/json' -d @test.json <WEBHOOK URL>

# Windowsの場合
curl.exe -H "Content-Type:application/json" -d @test.json <WEBHOOK URL>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/enterprise-guide/jp/webhooks/teams-webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
