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)

space

string

For logged activities in Sitecore CDP, Sitecore Connect, and Sitecore Personalize, set this value to "Production".

For logged activities in the Sitecore Cloud Portal, set this value to "prod".

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.

  • "Production"

  • "prod"

sourceSystem.$type

string

The Sitecore digital experience platform (DXP) app to forward logs from.

You must set this value to "AnySource", which means that logs from all apps will be forwarded.

"AnySource"

destinationSystem.$type

string

The type of the system that logs will be forwarded to.

You must set this value to "Webhook".

"Webhook"

destinationSystem.secret

string

A secret you define, automatically passed in the X-Secret request header. To authenticate incoming webhook calls, your target application must verify this secret.

"mys3cr3tstr1ingforauth1!x"

destinationSystem.targetUrl

string

The webhook target URL. This is the URL that logs will be forwarded to.

"https://www.exampletarget.url/example-endpoint"

eventName

string

The internal event name of when a webhook is created.

You must set this value to "sitecore.backbone.messages.audit.created".

"sitecore.backbone.messages.audit.created"

enabled

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.

true or false

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.

RequestResponse
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
}'
RequestResponse
{
  "events": [
    {
      "id": "7050346545d5447da57b64be6416ac78",
      "enabled": true,
      "name": "sitecore.backbone.messages.audit.created",
      "description": null
    }
  ]
}

Do you have some feedback for us?

If you have suggestions for improving this article,