Manage webhooks
How to register, get, or delete webhooks in Optimizely Graph.
Optimizely Graph provides endpoints to manage your webhooks by the specific account.
Note
See the API Reference for information on managing webhooks.
Important
Authentication required, use either Basic or HMAC authentication.
Register a webhook with notification filters
- Use a REST client tool, for example, Postman or Insomnia.
- Send a POST request with the URL:
https://cg.optimizely.com/api/webhooks
. - Use either Basic or HMAC authentication within the request.
- Prepare the request body.
{
"disabled": false,
"request" : {
"url" : <your_webhook_url>,
"method": "post"
},
"topic": ["{subject}.{action}"],
"filters": [
{
[field]: { [operator]: {value} }
}
]
}
- disabled – Boolean. Set to true to disable the webhook.
- request – Object. Represents the HTTP request to the webhook, including method (GET, POST, and so on), headers, query parameters, and body.
- topic – Array of strings. Filters events by
subject
andaction
. Use an asterisk (*) as a wildcard.- Examples
- Filter all events –
topics: ["*.*"]
- Filter all 'doc' events –
topics: ["doc.*"]
- Filter all 'updated' events –
topics: ["*.updated"]
- Filter 'doc updated' events –
topics: ["doc.updated"]
- Filter 'doc updated' or 'bulk completed' events –
topics: ["doc.updated", "bulk.completed"]
- Filter all events –
- Available values for
subject
doc
– For updating events involving only a single content.bulk
– For updating events involving multiple content in one request.*
– Update both event types,doc
andbulk
.- If you are not sure, use
*
for thesubject
.
- If you are not sure, use
- Examples
- (Optional) Filters property – An object containing key-value pairs, where each key is a filter name, and the value is an array of filter objects. Filters help you receive specific notifications.
Examples:- Filters docs that have 'Published' status.
{ "request" : { "url" : <your_webhook_url>, "method": "post" }, "filters": [ { "status": { "eq": "Published" } } ], }
- Filters docs that have 'Published' or 'Draft' status.
{ "request" : { "url" : <your_webhook_url>, "method": "post" }, "filters": [ { "status": { "eq": "Published" } }, { "status": { "eq": "Draft" } } ], }
- Filters docs that have 'Published' status and id '123'.
{ "request" : { "url" : <your_webhook_url>, "method": "post" }, "filters": [ { "status": { "eq": "Published" }, "id": { "eq": "123" } } ] }
- Filters docs that have custom fields like 'siteId' (for example, with multiple sites).
Note
Custom fields are case-sensitive.
{ "request" : { "url" : <your_webhook_url>, "method": "post" }, "filters": [ { "siteId": { "eq": "site_id" } } ] }
- Filters docs that have custom fields like page name and 'Published' status (assume that the page name is not changed).
{ "request" : { "url" : <your_webhook_url>, "method": "post" }, "filters": [ { "Name": { "eq": "Alloy Plan" }, "status": { "eq": "Published" } } ] }
- Filters docs that have 'Published' status.
List all registered webhooks
- Use the REST client tool.
- Send a GET request with the URL:
https://cg.optimizely.com/api/webhooks
. - Use either Basic or HMAC authentication within the request.
Example response:
[
{
"id": <guid>,
"request" : {
"url" : <your_webhook_url>,
"method": "post"
},
"filters": [
{
"status": { "eq": "Published" }
}
]
}
]
Delete a registered webhook
Updated about 2 months ago