Nuntly.Messages (nuntly v0.1.0)

Copy Markdown View Source

Access received messages, download attachments, and send replies or forwards from an inbox.

Summary

Functions

forward_message(client, message_id, body, opts \\ [])

Forward Message

Forward a message to new recipients.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • message_id — Required path parameter, string. The RFC 5322 Message-ID header.
  • body — application/json request body using ForwardMessageRequest. Accepted fields:
    • "to" (list of string, required) — The recipient addresses to forward to.
    • "text" (string, optional) — An optional comment to prepend.
  • opts — Optional keyword list passed to Req for this request.
    • "Idempotency-Key" — Optional header, string. Unique key to ensure the request is processed at most once. UUIDv4 recommended.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.forward_message(
  client,
  "message-id",
  %{
    "to" => "brian67@gmail.com"
  },
  headers: [{"Idempotency-Key", "idempotency-key"}]
)

list_message_attachments(client, message_id, opts \\ [])

List Message Attachments

List all attachments for a message.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • message_id — Required path parameter, string.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.list_message_attachments(client, "message-id")

list_messages(client, params \\ %{}, opts \\ [])

List Messages

List all received messages across inboxes.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • params — Optional map of query parameters:
    • "cursor" — Optional query parameter, string. Pagination cursor from a previous response
    • "limit" — Optional query parameter, integer. Maximum number of items to return Defaults to 30.
    • "domainId" — Optional query parameter, string. Filter by domain.
    • "from" — Optional query parameter, string. Filter by sender address.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.list_messages(
  client,
  %{
    "cursor" => "cursor",
    "limit" => 30,
    "domainId" => "domain-id",
    "from" => "from"
  }
)

reply_to_message(client, message_id, body, opts \\ [])

Reply To Message

Reply to a message. Set replyAll to true to reply to all recipients.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • message_id — Required path parameter, string. The RFC 5322 Message-ID header.
  • body — application/json request body using ReplyMessageRequest. Accepted fields:
    • "text" (string, optional) — The plain text body.
    • "html" (string, optional) — The HTML body.
    • "replyAll" (boolean, required) — Whether to reply to all recipients.
  • opts — Optional keyword list passed to Req for this request.
    • "Idempotency-Key" — Optional header, string. Unique key to ensure the request is processed at most once. UUIDv4 recommended.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.reply_to_message(
  client,
  "message-id",
  %{
    "replyAll" => true
  },
  headers: [{"Idempotency-Key", "idempotency-key"}]
)

retrieve_message(client, message_id, opts \\ [])

Retrieve Message

Retrieve a single message with inbox enrichment.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • message_id — Required path parameter, string. The email Message-ID header.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.retrieve_message(client, "message-id")

retrieve_message_attachment(client, message_id, attachment_id, opts \\ [])

Retrieve Message Attachment

Retrieve an attachment with a presigned download URL.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • message_id — Required path parameter, string.
  • attachment_id — Required path parameter, string.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.retrieve_message_attachment(client, "message-id", "attachment-id")

retrieve_message_content(client, message_id, opts \\ [])

Retrieve Message Content

Returns presigned URLs to download the HTML, plain-text, and raw MIME source of a received message.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • message_id — Required path parameter, string.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.retrieve_message_content(client, "message-id")

update_message(client, message_id, body, opts \\ [])

Update Message

Update message labels. Only available for messages in user-created inboxes.

Arguments

  • client — A Nuntly.Client returned by Nuntly.new/1.
  • message_id — Required path parameter, string.
  • body — application/json request body using UpdateMessageRequest. Accepted fields:
    • "addLabels" (list of string, optional) — Labels to add to the message.
    • "removeLabels" (list of string, optional) — Labels to remove from the message.
  • opts — Optional keyword list passed to Req for this request.

Example

client = Nuntly.new(api_key: "ntly_...")

Nuntly.Messages.update_message(
  client,
  "message-id",
  %{
    "addLabels" => ["add-label"]
  }
)