Migrating the legacy webhook behavior to GROQ-powered Webhooks
If you need to recreate the previous webhook behavior – triggering on all changes, and on a dataset level rather than document-level – you can do so by following these steps:
- Create a webhook set to trigger on create, update and delete
- Leave the Filter field empty
- Add the following to the Projection field
// webhook projection
{
"transactionId": "Not supported",
"projectId": sanity::projectId(),
"dataset": sanity::dataset(),
"ids": {
"created": [
select(before() == null && after() != null => _id)
],
"deleted": [
select(before() != null && after() == null => _id)
],
"updated": [
select(before() != null && after() != null => _id)
],
"all": [
_id
]
}
}
You can also click this link to get a template with the settings described above.