Sanity and GROQ-powered webhooks are great, but there is a bug!

Sanity recently launched their GROQ-powered webhooks, and they are really powerful! There is even a guide that explains projections, and one that explains filters.

The bug

I created a simple webhook like this, that posts a message to Slack whenever a new document of type user is created.

Graphical user interface, for setting up a Sanity webhook

When I later updated the webhook to only run for the production dataset, using the top drop-down, the webhook continued to fire on all datasets.

The workaround

One possible solution is doing the dataset filtering in GROQ, and not with the dropdown.

Graphical user interface for Sanity webhook with dataset filtering

With this update, the webhook is only triggered for the production dataset.