Create a webhook
POST /api/v1/eventConfigurations
Creates a webhook.
In the request body, you can enable the webhook by setting the value for enabled to true. When you enable the webhook, Sitecore Common Audit Log will immediately start forwarding all audit logs to the webhook target URL.
You must provide the following required attributes in the request body:
|
Attribute |
Type |
Description |
Example(s) |
|---|---|---|---|
|
|
string |
For logged activities in Sitecore CDP, Sitecore Connect, and Sitecore Personalize, set this value to For logged activities in the Sitecore Cloud Portal, set this value to Note To send events from CDP, Connect, Personalize, and the Cloud Portal to a single endpoint, create two webhooks with the same webhook target URL. |
|
|
|
string |
The Sitecore digital experience platform (DXP) app to forward logs from. You must set this value to |
|
|
|
string |
The type of the system that logs will be forwarded to. You must set this value to |
|
|
|
string |
A secret you define, automatically passed in the |
|
|
|
string |
The webhook target URL. This is the URL that logs will be forwarded to. |
|
|
|
string |
The internal event name of when a webhook is created. You must set this value to |
|
|
|
boolean |
Determines whether the webhook is enabled or disabled at creation time. When enabled, logs will immediately start being forwarded to the webhook target URL. To change this after creating the webhook, see Disable a webhook and Enable a webhook. |
|
In the response, in the object in the events array, the id key contains the webhook ID. You use the webhook ID to, for example, retrieve or update the webhook.
curl -X POST '<baseURL>/api/v1/eventConfigurations' \
-H 'Authorization: Bearer <bearerToken>' \
-H 'Accept: application/json' \
--data-raw '
{
"space": "Development",
"sourceSystem": {
"$type": "AnySource"
},
"destinationSystem": {
"$type": "Webhook",
"secret": "<secret>",
"targetUrl": "https://www.exampletartget.url/example-endpoint"
},
"eventName": "sitecore.backbone.messages.audit.created",
"enabled": true
}'
{
"events": [
{
"id": "7050346545d5447da57b64be6416ac78",
"enabled": true,
"name": "sitecore.backbone.messages.audit.created",
"description": null
}
]
}