POST https://api.ap1.datadoghq.com/api/v1/integration/slackhttps://api.ap2.datadoghq.com/api/v1/integration/slackhttps://api.datadoghq.eu/api/v1/integration/slackhttps://api.ddog-gov.com/api/v1/integration/slackhttps://api.us2.ddog-gov.com/api/v1/integration/slackhttps://api.datadoghq.com/api/v1/integration/slackhttps://api.us3.datadoghq.com/api/v1/integration/slackhttps://api.us5.datadoghq.com/api/v1/integration/slack
Overview
Create a Datadog-Slack integration. Once created, add a channel to it with the
Add channels to Slack integration endpoint.
This method updates your integration configuration by adding
your new configuration to the existing one in your Datadog organization.
Request
Body Data (required)
Create Datadog-Slack integration request body.
Expand All
The array of service hook objects.
Your Slack service hook URL.
{
"service_hooks": [
{
"account": "joe.doe",
"url": "https://hooks.slack.com/services/example-workspace/example-channel/example-token"
}
]
}
Response
Bad Request
Error response object.
Expand All
Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}
Authentication error
Error response object.
Expand All
Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}
Too many requests
Error response object.
Expand All
Array of errors returned by the API.
{
"errors": [
"Bad Request"
]
}
Code Example
## default
#
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/integration/slack" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
"service_hooks": [
{
"account": "Main_Account",
"url": "https://hooks.slack.com/services/1/1/1"
}
]
}
EOF
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
config= {
"service_hooks": [
{
"account": "Main_Account",
"url": "https://hooks.slack.com/services/1/1/1"
},
{
"account": "doghouse",
"url": "https://hooks.slack.com/services/2/2/2"
}
]
}
dog = Dogapi::Client.new(api_key, app_key)
dog.create_integration('slack', config)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"