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 as returned by Create Webhook or List Webhooks — a numeric string (e.g. 17), not a UUID. A non-numeric id returns not_found (404).

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('17', {
  "endpoint": "https://new-webhook.example.com/handler",
  "events": ["email.sent", "email.delivered"],
  "status": "enabled"
});
console.log({ data, error });

Response

{
  "object": "webhook",
  "id": "17"
}

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