Request engine behind every resource module (Graph Cloud API, REST only).
Builds the Req call (Authorization: Bearer <token>), decodes JSON, applies
the bounded retry policy, and normalizes failures to %Noizu.WhatsApp.Error{}.
Return shapes
{:ok, decoded_body}— 2xx.{:ok, decoded_body, meta}— when the call is made withmeta: true.{:error, %Noizu.WhatsApp.Error{}}.
Retry policy
- 429 — retried with a delay from the
Retry-Afterheader or JSON hint, else exponential-ish backoff, clamped to:max_delay_ms. - 5xx — retried for idempotent methods only (
GET,HEAD,PUT). - At most
:max_attempts(default 3) total attempts.
Summary
Functions
Percent-encodes one path segment (ids).
Performs one API call. path is relative to the Graph root (the version is
inserted automatically, e.g. "12345/messages").
Resolves the sending phone number id from opts[:phone_number_id] or the
client, as {:ok, id} or {:error, %Error{tag: :config}}.
Normalizes a recipient or returns a masked validation error.
As require_phone_number_id/2 for the WABA id.
Types
@type meta() :: %{status: pos_integer(), attempts: pos_integer()}
@type method() :: :get | :post | :put | :patch | :delete | :head
@type result() :: {:ok, term()} | {:ok, term(), meta()} | {:error, Noizu.WhatsApp.Error.t()}
Functions
Percent-encodes one path segment (ids).
@spec perform(Noizu.WhatsApp.Client.t(), method(), String.t(), keyword()) :: result()
Performs one API call. path is relative to the Graph root (the version is
inserted automatically, e.g. "12345/messages").
Options: :json (request body), :params (query; nil values dropped),
:form (multipart form), :headers, :meta.
@spec require_phone_number_id(Noizu.WhatsApp.Client.t(), keyword()) :: {:ok, String.t()} | {:error, Noizu.WhatsApp.Error.t()}
Resolves the sending phone number id from opts[:phone_number_id] or the
client, as {:ok, id} or {:error, %Error{tag: :config}}.
@spec require_recipient(term()) :: {:ok, String.t()} | {:error, Noizu.WhatsApp.Error.t()}
Normalizes a recipient or returns a masked validation error.
@spec require_waba_id(Noizu.WhatsApp.Client.t(), keyword()) :: {:ok, String.t()} | {:error, Noizu.WhatsApp.Error.t()}
As require_phone_number_id/2 for the WABA id.