I am currently using this link for writing a program in Python that will send out curl commands for POST
, PUT
, and DELETE
requests using the Datadog API. So far, the request seems to be firing as I'd like it to, but it won't take my credentials. I'm not entirely sure what a service hook url is, but I believe it may be the culprit. Could anyone tell me how to find the following Slack specific elements for this?
This is my test script in Python:
os.system("curl -v -X POST -H \"Content-type: application/json\" \
-d '{\
\"service_hooks\": [\
{\
\"account\": \"[???]\",\
\"url\": \"[???]\"\
}\
],\
\"channels\": [\
{\
\"channel_name\": \"[#???]\",\
\"transfer_all_user_comments\": \"false\",\
\"account\": \"[???]\"\
}\
]\
}' \
\"https://api.datadoghq.com/api/v1/integration/slack?api_key=$"+[???]+"&application_key=$"+[???]+"\"");
The results were:
M-C02TW43FHV2Q:python foobar$ python main.py
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 00.000.000.00...
* TCP_NODELAY set
* Connected to api.datadoghq.com (00.000.000.00) port 000 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_000_GCM_SH00000
* Server certificate: *.datadoghq.com
* Server certificate: COMODO RSA Domain Validation Secure Server CA
* Server certificate: COMODO RSA Certification Authority
> POST /api/v1/integration/slack?api_key=00000000000000000000000000000&application_key=00000000000000000000000000000000 HTTP/1.1
> Host: api.datadoghq.com
> User-Agent: curl/0.00.0
> Accept: */*
> Content-type: application/json
> Content-Length: 292
>
* upload completely sent off: 292 out of 292 bytes
< HTTP/1.1 403 Forbidden
< Date: Tue, 26 Jun 2018 01:42:25 GMT
< Content-Type: application/json
< Content-Length: 31
< Connection: keep-alive
< Vary: Accept-Encoding
< Pragma: no-cache
< Cache-Control: no-cache
< X-DD-VERSION: 00.000000
< DD-POOL: dogweb_sameorig
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Strict-Transport-Security: max-age=100000000;
<
* Connection #0 to host api.datadoghq.com left intact
{"errors": ["Invalid API key"]}M-000000000000:python foobar$
I would really appreciate any help in finding this information!
It looks to me that these are Datadog specific configuration parameters. So you first need to install the Datadog app to your Slack workspace, which you find on the Slack App Directory.
Here is how the process is described in the official documentation:
Installation
The Slack integration is installed via its integration tile in the Datadog application.
Configuration
- In your Slack account go to the Applications page and search for Datadog.
- Click Install, followed by Add Integration.
- Copy the Slack Service Hook and paste in the service hook field for Slack in Datadog.
- Add the channels you want to be able to post to.
- If you would like to be notified for every comment on a graph, tick the check box “Transfer all user comments” by each channel. If left unchecked (default) you will need to use the @slack-channel_name syntax for comments to be posted to slack.
Source: official documentation from Datadog
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With