API Reference

Update Webhook

PATCH /webhooks/:id — update a webhook’s endpoint, events, or status.

PATCH/webhooks/:id

Updates an existing webhook. Send any of endpoint, events, or status; omitted fields are left unchanged. Use status to pause delivery without deleting the webhook.

Path parameters
idstringrequired

The webhook id.

Body parameters
endpointstringoptional

The HTTPS URL where webhook events will be sent.

eventsstring[]optional

Array of event types to subscribe to. Replaces the existing set. See Create Webhook for the available values.

statusstringoptional

The webhook status. Either enabled or disabled.

import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.webhooks.update('4dd369bc-aa82-4ff3-97de-514ae3000ee0', {
  "endpoint": "https://new-webhook.example.com/handler",
  "events": ["email.sent", "email.delivered"],
  "status": "enabled"
});
console.log({ data, error });

Response

{
  "object": "webhook",
  "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0"
}

Errors: not_found if the webhook does not exist or is not yours. See Errors.