Karta.Postmark (Karta v1.0.0)

What Karta's Postmark-compatible API (KartaWeb.Postmark) reads, and what it and webhooks in Postmark's format (Karta.Webhooks.Postmark) say alike.

  • Messages: a server's outgoing messages, searched as Postmark's messages API searches them. Postmark's "message" is Karta's: one per message, whatever its number of recipients, and its MessageID is Karta's id of the message.
  • Bounces: a bounce is the delivery attempt (Karta.Outbound.Delivery) after which a recipient bounced; its id is the bounce's ID (a UUID, where Postmark's are numbers). Its type is Postmark's HardBounce when the receiving server refused the message, SoftBounce when the retry period ran out (status 4.4.7).

Everything is scoped by server: only the server's own accepted outgoing messages, and their bounces, are found.

Summary

Functions

A bounce of the server (see bounces/4), or nil.

Postmark's type of a bounce, from the enhanced status code of the attempt after which the recipient bounced: {type, code, name, description}.

A page of the server's bounces, newest first, and how many there are in all: {total, bounces}, each a Karta.Outbound.Delivery with its recipient and message. Filters (all optional): type ("HardBounce", "SoftBounce"; any other finds nothing), inactive (true finds nothing: a bounce does not put an address on the suppression list), email (text found in the address, without regard to case), tag, message (a message's id), from, to (DateTimes, inclusive, of the bounce), stream.

The server's bounces by type, %{hard: n, soft: n}, and its addresses on the suppression list that have not expired.

An accepted outgoing message of the server, or nil.

A page of the server's accepted outgoing messages, newest first, and how many there are in all: {total, messages}. Filters (all optional)

Whether each message still has recipients to deliver to (queued or deferred): %{message_id => :queued | :sent}.

Postmark's type of a delay (Karta tries again): Transient.

Types

bounce_type()

@type bounce_type() :: {String.t(), pos_integer(), String.t(), String.t()}

Functions

bounce(server, id)

@spec bounce(Karta.Servers.Server.t(), term()) :: Karta.Outbound.Delivery.t() | nil

A bounce of the server (see bounces/4), or nil.

bounce_type(arg1)

@spec bounce_type(String.t() | nil) :: bounce_type()

Postmark's type of a bounce, from the enhanced status code of the attempt after which the recipient bounced: {type, code, name, description}.

bounces(server, filters, count, offset)

A page of the server's bounces, newest first, and how many there are in all: {total, bounces}, each a Karta.Outbound.Delivery with its recipient and message. Filters (all optional): type ("HardBounce", "SoftBounce"; any other finds nothing), inactive (true finds nothing: a bounce does not put an address on the suppression list), email (text found in the address, without regard to case), tag, message (a message's id), from, to (DateTimes, inclusive, of the bounce), stream.

delivery_stats(server)

@spec delivery_stats(Karta.Servers.Server.t()) :: %{
  hard: non_neg_integer(),
  soft: non_neg_integer(),
  inactive: non_neg_integer()
}

The server's bounces by type, %{hard: n, soft: n}, and its addresses on the suppression list that have not expired.

message(server, id)

@spec message(Karta.Servers.Server.t(), term()) :: Karta.Messages.Message.t() | nil

An accepted outgoing message of the server, or nil.

messages(server, filters, count, offset)

A page of the server's accepted outgoing messages, newest first, and how many there are in all: {total, messages}. Filters (all optional):

  • recipient - an envelope recipient, compared without case;
  • from_email - the From address, compared without case;
  • tag - one of the message's tags;
  • status - :queued (some recipient not yet delivered to or bounced: queued or deferred) or :sent (none);
  • from, to - DateTimes, inclusive, of acceptance;
  • subject - text found in the subject, without regard to case;
  • metadata - [{name, value}], variables the message has, exactly;
  • stream - a message stream: other than "outbound" finds nothing.

statuses(messages)

@spec statuses([Karta.Messages.Message.t()]) :: %{
  required(Ecto.UUID.t()) => :queued | :sent
}

Whether each message still has recipients to deliver to (queued or deferred): %{message_id => :queued | :sent}.

transient()

@spec transient() :: bounce_type()

Postmark's type of a delay (Karta tries again): Transient.