- You have internal tools, homegrown systems, or third-party services that Cortex doesn’t integrate with yet.
- You want to automate the process of sending custom metrics, events, or other data into Cortex without building and maintaining additional infrastructure.
- You want to pre-process data before it reaches Cortex, such as adding extra metadata or transforming the payload format.
You can also add custom metadata manually to an entity descriptor or programmatically via the API. Learn more in Adding custom data.
How to create a custom webhook integration in Cortex
Step 1: Configure the custom integration in Cortex
- In Cortex, navigate to Integrations. On the left side of the Integrations page, click Custom integrations.
-
Click +Add custom integration.

-
Configure the integration details:
- Integration name: Enter a name for the integration.
- Entity tag JQ: Enter the JQ that will be used to extract the entity’s Cortex tag from the data. This tells Cortex where in the payload body we can find the Cortex tag.
- For example, the payload shown in Step 2 would have
.data.codeTagas the JQ, andfrontend-servicewould be the entity’s Cortex tag. - If the tag Cortex extracts from the payload does not match an existing Cortex tag, it will result in a 400 error and the custom metadata will not be updated. Learn about alternate mappings below.
- For example, the payload shown in Step 2 would have
- Key: Enter the custom metadata key.
- Data will be stored under the key for entities, similar to adding data via entity descriptor or API.
- In the example below, the key is
mydata.
- Click Save.
- Copy the provided webhook URL.
Step 2: Send data to the webhook
Note that the entity must exist in Cortex before you send the payload. cURL is a quick and flexible method to post to the webhook and verify that it’s receiving data.- Save your payload as a .json file. Include the field that matches the JQ expression configured in the previous steps, so Cortex can map the data to the correct entity. For example, the payload might look like this:
-
In your terminal, use cURL to POST the JSON, using a command similar to the following:
curl -X POST -H "Content-Type: application/json" --data <path to json file> <webhook URL>- For example:
curl -X POST -H "Content-Type: application/json" --data @/tmp/payload.json https://api.getcortexapp.com/api/v1/custom-integrations/data/12345abcdef
- For example:
Changing the mappings for entities
If the webhook payload does not contain a value that maps to the exact Cortex tag, you can configure alternative mappings to look up when processing payloads. Use thex-cortex-custom-integration-mappings block in the entity descriptor YAML. For example:
View custom integration data in Cortex
Similar to when you add custom metadata to an entity, custom integration data appears in the sidebar on an entity details page within the Custom data & metrics page. It appears with anINTEGRATION tag next to the key name.

Example: GitHub webhook
In this example, we create a webhook integration to send GitHub data into Cortex. While Cortex does offer a native integration with GitHub, there may be scenarios where you want to send additional metadata that isn’t included in the native integration.- Create a custom webhook integration in Cortex.
- Enter a descriptive name so others understand the purpose of this webhook, such as “GitHub metadata.”
- In this example, we use the Service query
.repository.nameand the KeygithubTest.
- Copy the webhook URL generated in Cortex for this integration.
- In GitHub, under Settings > Webhooks, create a webhook.
- In the webhook’s settings under Payload URL, paste in the webhook URL from Cortex.
- Set the Content type to
application/json.
- Push a commit to your GitHub repository.
-
In your GitHub settings under Webhooks, click the Recent Deliveries tab to see the payload that will be sent. Because you set the JQ query to
.repository.name, the repository name value in the payload will correspond with the Cortex tag in Cortex. In the example screen shot, the repository name is “michigan”:
-
In your GitHub settings under Webhooks, click the Recent Deliveries tab to see the payload that will be sent. Because you set the JQ query to
- Navigate to the entity in Cortex.
- In this example, the repository name is “michigan,” so we can search in Cortex to find an entity with “michigan” as its Cortex tag.
- On the entity’s details page, click Custom data & metrics from the entity’s sidebar.
-
Next to the
githubTestkey, you will see the payload sent from GitHub:
-
Next to the