# `Unicom360.WhatsApp.Session`
[🔗](https://github.com/TechRode-Solution-Limited/unicom360-elixir/blob/v0.1.0/lib/unicom360/whatsapp/session.ex#L1)

Builders for WhatsApp session messages, sent with `Unicom360.WhatsApp.send_session/3` inside
the 24-hour customer service window.

    alias Unicom360.WhatsApp.Session

    Session.text("260971234567", "Your order is ready.", reply_to: inbound_wamid)
    Session.image("260971234567", "https://example.com/receipt.png", caption: "Your receipt")
    Session.buttons("260971234567", "Collect today or deliver?", [
      {"collect", "Collect"},
      {"deliver", "Deliver"}
    ])

Every builder takes the keyword options `:from` (your WhatsApp number), `:user_reference_id`
(makes the send safe to retry), `:callback_url` and, all but `reaction/4`, `:reply_to`.
`:reply_to` and a reaction's `message_id` take either a `message_id` a send returned or the
`wamid.` id of an inbound message, exactly as a `message.received` webhook delivers it.

The SDK checks no lengths or limits; the gateway answers an invalid message with an
`:invalid_request_error`.

# `audio`

```elixir
@spec audio(String.t(), String.t(), keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

An audio file.

# `buttons`

```elixir
@spec buttons(
  String.t(),
  String.t(),
  [Unicom360.WhatsApp.ReplyButton.t() | {String.t(), String.t()} | map()],
  keyword()
) :: Unicom360.WhatsApp.SessionMessage.t()
```

An interactive message with up to three reply buttons, each a
`Unicom360.WhatsApp.ReplyButton`, an `{id, title}` tuple or a map. Options: `:header`,
`:footer` and the common ones.

# `contacts`

```elixir
@spec contacts(String.t(), [map()], keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

Contact cards, each a map in Meta's contact shape
(`%{"name" => %{"formatted_name" => ...}, "phones" => [...]}`), sent as given.

# `document`

```elixir
@spec document(String.t(), String.t(), keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

A document, with an optional `:caption` and `:filename`.

# `image`

```elixir
@spec image(String.t(), String.t(), keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

An image, with an optional `:caption`.

# `list`

```elixir
@spec list(
  String.t(),
  String.t(),
  String.t(),
  [Unicom360.WhatsApp.ListSection.t() | map()],
  keyword()
) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

An interactive list: `button` is the text of the button that opens it, `sections` a list of
`Unicom360.WhatsApp.ListSection` (or maps). Options: `:header`, `:footer` and the common ones.

# `location`

```elixir
@spec location(String.t(), number(), number(), keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

A location pin. Options: `:name`, `:address` and the common ones.

# `reaction`

```elixir
@spec reaction(String.t(), String.t(), String.t(), keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

A reaction to a message. An empty `emoji` (`""`) removes your reaction. Options: `:from`,
`:user_reference_id` and `:callback_url` (a reaction takes no `:reply_to`).

# `sticker`

```elixir
@spec sticker(String.t(), String.t(), keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

A sticker.

# `text`

```elixir
@spec text(String.t(), String.t(), keyword()) :: Unicom360.WhatsApp.SessionMessage.t()
```

A text message. Options: the common ones.

# `video`

```elixir
@spec video(String.t(), String.t(), keyword()) ::
  Unicom360.WhatsApp.SessionMessage.t()
```

A video, with an optional `:caption`.

---

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