Anu.Response (Anu v0.2.0)

Copy Markdown View Source

Represents a successful response from the WhatsApp Cloud API.

Fields

  • :id - the message ID returned by Meta (e.g. "wamid.HBg...")
  • :status - delivery status string (usually "accepted")
  • :raw - the full parsed response body

Examples

iex> %Anu.Response{id: "wamid.HBgN", status: "accepted"}
%Anu.Response{id: "wamid.HBgN", status: "accepted", raw: nil}

Summary

Functions

Creates an Anu.Response from a Meta API success response body.

Types

t()

@type t() :: %Anu.Response{
  id: String.t() | nil,
  raw: map() | nil,
  status: String.t() | nil
}

Functions

from_body(body)

@spec from_body(map()) :: t()

Creates an Anu.Response from a Meta API success response body.

Examples

iex> body = %{"messages" => [%{"id" => "wamid.123"}]}
iex> Anu.Response.from_body(body)
%Anu.Response{id: "wamid.123", status: "accepted", raw: %{"messages" => [%{"id" => "wamid.123"}]}}