Unicom360.WhatsApp.TemplateSendResult (Unicom360 v0.1.0)

Copy Markdown View Source

The result of Unicom360.WhatsApp.send_template/3 (canonical name TemplateSendResult).

  • api_reference, message - from the envelope.
  • accepted_count, rejected_count - how many recipients were queued and rejected (the API's accepted and rejected; accepted/1 and rejected/1 return the results).
  • results - one Unicom360.WhatsApp.TemplateResult per recipient.
  • raw, extra - the JSON object, and the members this version does not model.

A rejected recipient is not an error. When every recipient is rejected the send fails with a NoValidRecipientsError (%Unicom360.Error{code: "NO_VALID_RECIPIENTS"}), whose results say why.

Summary

Functions

The queued results (status exactly "ACKNOWLEDGED"), in response order.

The first result whose to has the same digits as number, or nil.

The rejected results (status exactly "REJECTED"), in response order.

Types

t()

@type t() :: %Unicom360.WhatsApp.TemplateSendResult{
  accepted_count: non_neg_integer() | nil,
  api_reference: String.t() | nil,
  extra: map(),
  message: String.t() | nil,
  raw: map(),
  rejected_count: non_neg_integer() | nil,
  results: [Unicom360.WhatsApp.TemplateResult.t()]
}

Functions

accepted(template_send_result)

@spec accepted(t()) :: [Unicom360.WhatsApp.TemplateResult.t()]

The queued results (status exactly "ACKNOWLEDGED"), in response order.

by_number(template_send_result, number)

@spec by_number(t(), String.t()) :: Unicom360.WhatsApp.TemplateResult.t() | nil

The first result whose to has the same digits as number, or nil.

rejected(template_send_result)

@spec rejected(t()) :: [Unicom360.WhatsApp.TemplateResult.t()]

The rejected results (status exactly "REJECTED"), in response order.