Lettermint.Messages (Lettermint v2.2.0)

Copy Markdown View Source

Sent and received messages. Needs :team_token; reschedule/4, cancel/3 and resend/4 also accept the sending token when no team token is configured.

Every function takes the options timeout: (milliseconds) last.

Summary

Functions

Cancels a scheduled message. Uses the team token when configured, otherwise the sending token.

Lists the events of a message, one page at a time.

Streams every message, following next_cursor. Raises the error of a failed page request.

Streams every event of a message, following next_cursor. Raises the error of a failed page request.

Releases one quarantined inbound message for webhook delivery. Options: :idempotency_key and :timeout.

Moves a scheduled message to another delivery time. Uses the team token when configured, otherwise the sending token.

Sends the stored content of a message again, as a new message with its own ID that links to the original through resent_from_message_id. Uses the team token when configured, otherwise the sending token.

Types

result(value)

@type result(value) :: {:ok, value} | {:error, Lettermint.Error.t()}

Functions

cancel(client, message_id, options \\ [])

Cancels a scheduled message. Uses the team token when configured, otherwise the sending token.

events(client, message_id, query \\ %{}, options \\ [])

Lists the events of a message, one page at a time.

html(client, message_id, options \\ [])

@spec html(Lettermint.Client.t(), String.t(), keyword()) :: result(String.t())

The HTML body.

iterate(client, query \\ %{}, options \\ [])

Streams every message, following next_cursor. Raises the error of a failed page request.

iterate_events(client, message_id, query \\ %{}, options \\ [])

Streams every event of a message, following next_cursor. Raises the error of a failed page request.

list(client, query \\ %{}, options \\ [])

Lists messages, one page at a time. query: Lettermint.Types.ListMessagesQuery.t/0.

process(client, message_id, options \\ [])

Releases one quarantined inbound message for webhook delivery. Options: :idempotency_key and :timeout.

reschedule(client, message_id, body, options \\ [])

Moves a scheduled message to another delivery time. Uses the team token when configured, otherwise the sending token.

resend(client, message_id, body \\ %{}, options \\ [])

Sends the stored content of a message again, as a new message with its own ID that links to the original through resent_from_message_id. Uses the team token when configured, otherwise the sending token.

body: Lettermint.Types.ResendMessageRequest.t/0. Pass %{recipients: [...]} to resend to some of the original recipients only; omit it to resend to all of them. Options: :idempotency_key and :timeout.

A message can be resent while its content is retained (otherwise Lettermint.APIError with status 410), and at most 5 times in 24 hours (otherwise Lettermint.RateLimitError).

retrieve(client, message_id, options \\ [])

Retrieves a message.

source(client, message_id, options \\ [])

@spec source(Lettermint.Client.t(), String.t(), keyword()) :: result(String.t())

The raw RFC 822 source.

text(client, message_id, options \\ [])

@spec text(Lettermint.Client.t(), String.t(), keyword()) :: result(String.t())

The plain-text body.