Karta.Webhooks.Payload (Karta v1.0.0)

What Karta's own webhook format (version 1) says about an event. The body of a request is a JSON object:

{
  "type": "message.delivered",
  "timestamp": "2026-12-02T10:15:00.000000Z",
  "version": 1,
  "data": {...}
}

timestamp is when the event happened (UTC); data is the event's:

  • every message event: server_id; message - id, message_id (the header's), mail_from, from, subject, tag, tags, variables, size (bytes), created_at (when it was accepted); recipient - id, address;
  • message.suppressed: suppression - reason (manual, unsubscribe, hard_bounce or complaint);
  • message.delivered, message.deferred, message.bounced: delivery - attempt, status, code, enhanced_code, details, mx_host, remote_ip, local_ip, tls_version, tls_cipher, tls_policy, and for message.deferred next_attempt_at;
  • message.complained: complaint - feedback_type (RFC 5965's type, abuse for one Karta does not know), user_agent, version, reported_domain, source_ip and the report's own and the quoted message's ids, as the report gave them;
  • message.opened, message.clicked: tracking - ip_network (the client's network, never its address), user_agent, for an open first (true when no other open of the recipient was recorded before), and for a click url and link_id;
  • domain.dns_failed: server_id; server - name, slug, organisation (its slug); domain - id, name; checked_at; failed - the checks that turned to fail in this run; checks - every check with a result: its status (pass, warn, fail, missing) and, unless it passed, problem (what was found, in a sentence);
  • webhook.test: webhook_id and message, a sentence.

A field whose value Karta does not know is left out. Version 1 changes only by adding fields and event types: a receiver ignores what it does not know. Something incompatible would be a new version.

Summary

Functions

message.accepted for every recipient, and message.suppressed for those on the suppression list (recipients: their id, address and status), with the reason they are on it.

The JSON body of a request about an event (Karta.Webhooks.Event or event/0).

A spam complaint about a recipient's copy of a message (a feedback report, Karta.Complaints.Complaint).

The outcome of a delivery attempt for a recipient: delivery is the Karta.Outbound.Delivery row as written; next_attempt_at when it was deferred.

A DNS health check of the domain turned to fail (failed: which); checks are the domain's results after the run.

The test event sent to one webhook on request.

An open or a click (url: the link's) recorded for a recipient (an open's first is looked up: call it in the transaction that records the open).

A one-click unsubscribe of a recipient.

Types

event()

@type event() :: %{type: String.t(), occurred_at: DateTime.t(), data: map()}

Functions

accepted(message, recipients, at)

@spec accepted(Karta.Messages.Message.t(), [map()], DateTime.t()) :: [event()]

message.accepted for every recipient, and message.suppressed for those on the suppression list (recipients: their id, address and status), with the reason they are on it.

body(map)

@spec body(%{type: String.t(), occurred_at: DateTime.t(), data: map()}) :: String.t()

The JSON body of a request about an event (Karta.Webhooks.Event or event/0).

complaint(message, recipient, complaint, at)

A spam complaint about a recipient's copy of a message (a feedback report, Karta.Complaints.Complaint).

delivery(message, recipient, delivery, next_attempt_at)

@spec delivery(Karta.Messages.Message.t(), map(), map(), DateTime.t() | nil) ::
  event()

The outcome of a delivery attempt for a recipient: delivery is the Karta.Outbound.Delivery row as written; next_attempt_at when it was deferred.

dns_failed(server, organisation, domain, checks, failed, at)

A DNS health check of the domain turned to fail (failed: which); checks are the domain's results after the run.

test(server_id, webhook_id, at)

@spec test(Ecto.UUID.t(), Ecto.UUID.t(), DateTime.t()) :: event()

The test event sent to one webhook on request.

tracking(message, recipient, tracked, url)

@spec tracking(
  Karta.Messages.Message.t(),
  map(),
  Karta.Tracking.Event.t(),
  String.t() | nil
) :: event()

An open or a click (url: the link's) recorded for a recipient (an open's first is looked up: call it in the transaction that records the open).

unsubscribed(message, recipient, at)

@spec unsubscribed(Karta.Messages.Message.t(), map(), DateTime.t()) :: event()

A one-click unsubscribe of a recipient.