Introduction
When leveraging the DataDog Integration with CircleCI to visualize and analyze your jobs, it can be configured using the UI as outlined in our documentation or using our V2 API's /webhook
endpoint with a POST
request. Using the API approach here can speed up the DataDog webhook process for teams and organizations with many projects.
Prerequisites
- A valid base64-encoded CircleCI API Token with the appropriate permissions to authenticate with
- Your DataDog API Key
- Project IDs for the projects that will be receiving this webhook
- Project IDs are found under the Overview section within your Project Settings
Instructions
- Confirm that you have the prequisities handy for your API requests below
- Run the following query from your shell:
-
-
-
curl --request POST \
--url https://circleci.com/api/v2/webhook \
--header 'authorization: Basic <BASIC_AUTH>' \
--header 'content-type: application/json' \
--data '{"name":"Datadog CI Visibility","events":["workflow-completed","job-completed" ],"url":"https://webhook-intake.datadoghq.com/api/v2/webhook/?dd-api-key=<API_KEY>","verify-tls":true,"signing-secret":"string","scope":{"id":"<PROJECT_ID_HERE>","type":"project"}}'
-
-
Please replace:
<BASIC_AUTH>
with your base64-encoded API Token
<API_KEY>
with your DataDog API Key
<PROJECT_ID_HERE>
with the project ID of the project in question that will be receiving this webhook
3. The expected response of a successful webhook creation will look similar to the snippet below:
{
"url" : "https://webhook-intake.datadoghq.com/api/v2/webhook/?dd-api-key=thisisakey",
"id" : "f3bbddde-xxxx-48a9-8123-11fb64xx807e",
"verify_tls" : true,
"name" : "Datadog CI Visibility",
"updated_at" : "2023-06-23T23:01:23.791Z",
"scope" : {
"type" : "project",
"id" : "2d2bx315-a55e-xxxx-9cec-e46a71030x61"
},
"signing_secret" : "",
"events" : [ "workflow-completed", "job-completed" ],
"created_at" : "2023-06-23T23:01:23.791Z"
}%
Outcome
Once the query is complete, navigating to the Webhooks section of your Project's Project Settings page will yield that newly created Datadog CI Visibility
Webhook
Additonal Notes
- The
signing-secret
parameter can not be omitted and should be passed as an empty string as it is not required for these DataDog webhooks. - Authentication can be done using either base64-encoded
BASIC
or usingCircle-Token
- Due to the nature of DataDog webhooks, the API key will remain in plain text as it is part of the DataDog Webhook's API URL.
Comments
Article is closed for comments.