API Reference

Create Webhook

POST /webhooks — create a webhook to receive real-time notifications about email events.

POST/webhooks

Creates a webhook. MailBlastr POSTs an event payload to your endpoint URL whenever one of the subscribed events occurs. The response includes a signing_secret — store it and use it to verify the signature on every incoming request. See Webhooks.

Body parameters
endpointstringrequired

The HTTPS URL where webhook events will be sent.

eventsstring[]required

Array of event types to subscribe to. See the table below.

secretstringoptional

Optional. Provide your own signing secret (e.g. to mirror a secret across providers). When omitted, MailBlastr mints a fresh whsec_… secret. Either way the plaintext is returned once in this response and never again.

Event types
email.sentenumoptional

MailBlastr accepted the email and queued it for delivery.

email.deliveredenumoptional

The receiving server accepted the message.

email.delivery_delayedenumoptional

Delivery was temporarily deferred and MailBlastr is retrying.

email.bouncedenumoptional

The message could not be delivered (hard rejection).

email.complainedenumoptional

The recipient marked the message as spam.

email.openedenumoptional

The recipient’s mail client loaded the tracking pixel (requires open tracking).

email.clickedenumoptional

The recipient clicked a tracked link (requires click tracking).

email.failedenumoptional

The email could not be sent (e.g. invalid recipient, quota reached).

email.scheduledenumoptional

The email was accepted for future delivery with a scheduled_at time.

email.suppressedenumoptional

The send was skipped because the recipient is on the account suppression list.

email.receivedenumoptional

An inbound email arrived at one of your verified receiving domains.

email.repliedenumoptional

A reply to one of your sent emails was detected.

email.unsubscribedenumoptional

A recipient unsubscribed via an unsubscribe link or header.

contact.createdenumoptional

A contact was created in one of your audiences.

contact.updatedenumoptional

A contact was updated.

contact.deletedenumoptional

A contact was deleted.

domain.createdenumoptional

A domain was added to your account.

domain.updatedenumoptional

A domain’s settings or verification status changed.

domain.deletedenumoptional

A domain was removed from your account.

import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.webhooks.create({
  "endpoint": "https://example.com/handler",
  "events": ["email.sent", "email.delivered"]
});
console.log({ data, error });

Response

{
  "object": "webhook",
  "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0",
  "signing_secret": "whsec_xxxxxxxxxx"
}
The signing_secret is only returned here, at creation. Store it securely — it cannot be retrieved again later.