Disable Webhook Notifications at Your Command

How to disable webhook notifications at your command

By Martin MakarskyJun 7, 2021

Are you changing your content model and your services are overwhelmed by webhook notifications? Disabling your webhooks notification requests might help you with focusing on things that matter.

Developers do refactoring. In short, it’s a restructuring of existing code into a more meaningful structure often accompanied by massive code changes. I believe a similar approach is used when dealing with bulky content models as well. Sometimes it feels right to split some content types here and there—or to adjust them according to the new needs and opportunities of your organization. Kontent’s environments and migrations will definitely make your life easier with these tasks. But what to do with your webhook-powered integrations?

You don’t want to spam your services with all new notifications. But at the same time, you are pretty happy with your webhooks set up, and you just don’t want to delete them. Disabling the webhooks feature is exactly The Thing you need in this scenario.

Webhooks are a powerful integration tool. With them, you can automate many tasks that depend on your content—rebuilding your site, testing your project, sending push notifications, releasing the new version of your artifacts, updating search indices...countless possibilities, indeed.

How to disable webhooks?

If you want to disable webhooks, you need to go to the Environment settings in the Project settings section. Select Webhooks, open the detail of the webhook and click on Disable. When needed, you can enable the webhook in the same location in the Project Settings.

Disable and enable webhooks
Disable and enable webhooks

The other way of using webhooks is via our Management API. With just one PUT request, you are able to enable or disable a specific webhook. This might come in handy, e.g., in automatic migrations or your internal tools.

Disable a webhook via API

curl --request PUT \
  --url https://manage.kontent.ai/v2/projects/<YOUR_PROJECT_ID>/webhooks/<YOUR_WEBHOOK_ID>/disable \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-type: application/json'

Enable a webhook via API

curl --request PUT \
  --url https://manage.kontent.ai/v2/projects/<YOUR_PROJECT_ID>/webhooks/<YOUR_WEBHOOK_ID>/enable \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-type: application/json'

The most important takeaway is understanding what a disabled webhook means for your project. Disabled webhooks ignore their triggers and don’t create any notifications. This means that no notification will be sent after you later enable the webhook again.

This behavior ensures your services won’t be overwhelmed by requests when you enable webhooks again. Moreover, after disabling the webhook, the not-sent webhook requests in the queue are deleted as well.

As usual, you can learn more about this feature in our documentation.

Bonus 😊: Struggling with the state of the webhooks and don’t know what’s wrong with your configuration? Take a look at the webhook debugging feature.

Written by
Martin Makarsky

Iʼm a Developer Advocate at Kentico Kontent. During the day, my mission is to try to find ways to help people with code. At nights, Iʼm hacking at first glance incompatible pieces into meaningful structures.

More articles from Martin

Subscribe to Kentico Kontent Newsletter

Stay in the loop. Get the hottest updates while they’re fresh!