Karta.MessageEvents (Karta v1.0.0)

What happened to a server's outgoing messages, one event per recipient and occurrence, read from the message store (nothing is recorded twice):

  • :accepted - the message was accepted for the recipient (its message's created_at);
  • :delivered - a delivery attempt that succeeded;
  • :failed - a delivery attempt that failed, severity: :temporary (deferred) or :permanent (bounced); and a recipient on the suppression list when the message was accepted (:permanent, no delivery);
  • :opened, :clicked - recorded by Karta.Tracking.

list/2 returns them in time order, filtered and in pages. Each event has a key, unique among the server's events, which with its time is the position to continue from. Everything is scoped by server; events of messages that are gone (retention) are gone with them.

Summary

Functions

Every kind of event.

The server's events. Options (all optional)

Types

kind()

@type kind() :: :accepted | :delivered | :failed | :opened | :clicked

t()

@type t() :: %{
  kind: kind(),
  key: String.t(),
  at: DateTime.t(),
  severity: :temporary | :permanent | nil,
  recipient: Karta.Outbound.Recipient.t(),
  delivery: Karta.Outbound.Delivery.t() | nil,
  tracking: Karta.Tracking.Event.t() | nil
}

Functions

kinds()

@spec kinds() :: [kind()]

Every kind of event.

list(server, opts \\ [])

@spec list(Karta.Servers.Server.t(), keyword()) :: [t()]

The server's events. Options (all optional):

  • kinds - a list of kinds (default all);
  • severity - :temporary or :permanent (only failures then);
  • recipient - an address, compared without case;
  • message_id - the Message-ID, with or without angle brackets;
  • message - the id of one message;
  • tags - events of messages with any of these tags;
  • from, to - DateTimes, inclusive;
  • order - :asc (oldest first) or :desc (default);
  • after - {at, key} of an event: the events after it in order;
  • limit - default 100, at most 300.

The recipient (with its message), the delivery (:delivered, :failed attempts) and the tracking event (with its link) are loaded.