# `Noizu.WhatsApp.Messages`
[🔗](https://github.com/noizu-labs-sdks/elixir-whatsapp/blob/v0.1.0/lib/noizu/whatsapp/messages.ex#L1)

Cloud API messaging: text, templates, media, read receipts, reactions.

Every function accepts an explicit `Noizu.WhatsApp.Client` first or omits it
(a default client is built from the environment). Recipients are normalized
to digits-only E.164; failures return `{:error, %Noizu.WhatsApp.Error{}}`
with the phone masked.

Graph code `131047` errors carry `kind: :window_closed` — the 24-hour
customer-service window has lapsed; use `send_template/4` (an approved
template) to re-open it.

# `mark_read`

```elixir
@spec mark_read(String.t()) :: Noizu.WhatsApp.Request.result()
```

# `mark_read`

Marks an inbound message as read.

# `react`

```elixir
@spec react(term(), String.t(), String.t()) :: Noizu.WhatsApp.Request.result()
```

# `react`

Reacts to an inbound message (`:emoji` may be an empty string to remove).

# `send_media`

```elixir
@spec send_media(
  Noizu.WhatsApp.Client.t() | term(),
  term(),
  :image | :document | :audio | :video | :sticker,
  term(),
  keyword()
) :: Noizu.WhatsApp.Request.result()
```

Sends media by link or by media id (as uploaded via `Media.upload/2`).

`type` is `:image | :document | :audio | :video | :sticker`; `link_or_id` is
a URL (`link: true` implied) or an uploaded media id (binary/string id used
as `id:`). Options: `:caption` (image/document/video), `:filename`
(document).

# `send_template`

```elixir
@spec send_template(
  Noizu.WhatsApp.Client.t() | term(),
  term(),
  String.t(),
  String.t(),
  list()
) ::
  Noizu.WhatsApp.Request.result()
```

Sends an approved template — the only way to start a conversation outside
the 24h window. `lang` is a template language code (e.g. `"en_US"`);
`components` is the Cloud API components list (header/body/button params).

# `send_text`

```elixir
@spec send_text(Noizu.WhatsApp.Client.t() | term(), term(), String.t(), keyword()) ::
  Noizu.WhatsApp.Request.result()
```

Sends a free-form text message.

Options: `:preview_url` (`true` renders a link preview), `:reply_to`
(message id threaded under `context`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
