For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/ja/api/latest/slack-integration/add-channels-to-slack-integration.md. A documentation index is available at /llms.txt.
Language
Datadog site

Slack インテグレーションにチャンネルを追加する

PUThttps://api.datadoghq.com/api/v1/integration/slackhttps://api.us3.datadoghq.com/api/v1/integration/slackhttps://api.us5.datadoghq.com/api/v1/integration/slackhttps://api.datadoghq.eu/api/v1/integration/slackhttps://api.ap1.datadoghq.com/api/v1/integration/slackhttps://api.ap2.datadoghq.com/api/v1/integration/slackhttps://api.uk1.datadoghq.com/api/v1/integration/slackhttps://api.ddog-gov.com/api/v1/integration/slackhttps://api.us2.ddog-gov.com/api/v1/integration/slack

概要

非推奨: このエンドポイントは非推奨です。

このメソッドは、Datadog 組織に送信された新しい構成で現在の構成を置き換えることにより、 インテグレーション構成を完全に書き換えます。 Slack の Webhook URL を含むすべての項目が有効であることを確認してください。 無効な URL を使用すると、Slack 通知が正常に機能しなくなります。

リクエスト

Body Data (required)

既存の Datadog-Slack インテグレーションリクエストボディを更新します。

フィールド
タイプ
説明
channels
[object]

Slack チャンネルの構成。

応答

OK

コード例

Slack インテグレーションにチャンネルを追加する
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "channels": [
    {
      "account": "Main_Account",
      "channel_name": "#channel_name_main_account",
      "transfer_all_user_comments": false
    }
  ]
}
EOF