# `WhatsApp.Interactive`
[🔗](https://github.com/jeffhuen/whatsapp_sdk/blob/main/lib/whatsapp/interactive.ex#L1)

Builders for WhatsApp interactive messages.

Provides a functional pipeline API for constructing interactive message
payloads -- buttons, lists, CTAs, flows, and products.

## Examples

    # Quick reply buttons
    payload =
      WhatsApp.Interactive.buttons("Choose an option:")
      |> WhatsApp.Interactive.button("yes", "Yes, proceed")
      |> WhatsApp.Interactive.button("no", "No, cancel")
      |> WhatsApp.Interactive.build()

    # List message
    payload =
      WhatsApp.Interactive.list("Main Menu", "View options")
      |> WhatsApp.Interactive.section("Products", [
        WhatsApp.Interactive.row("prod_1", "Widget", "Our best widget"),
        WhatsApp.Interactive.row("prod_2", "Gadget", "Our best gadget")
      ])
      |> WhatsApp.Interactive.build()

# `builder`

```elixir
@type builder() :: map()
```

# `build`

```elixir
@spec build(builder()) :: map()
```

Finalize the builder and return the payload map.

This is an identity function -- the builder map is the payload.

# `button`

```elixir
@spec button(builder(), String.t(), String.t()) :: builder()
```

Add a reply button to a button message.

## OpenAPI Constraints

  * Maximum 3 buttons per message (`maxItems: 3`)
  * Minimum 1 button required (`minItems: 1`)
  * `id` — unique identifier, max 256 characters (`maxLength: 256`).
    No leading or trailing spaces.
  * `title` — button label, max 20 characters (`maxLength: 20`).
    Cannot be empty, must be unique across buttons. Emojis supported, no markdown.

# `buttons`

```elixir
@spec buttons(
  String.t(),
  keyword()
) :: builder()
```

Start building a button message.

## Options

  * `:header` - Optional header text
  * `:footer` - Optional footer text (max 60 characters per OpenAPI spec)

# `cta_url`

```elixir
@spec cta_url(String.t(), String.t(), String.t(), keyword()) :: builder()
```

Build a CTA URL message.

## Options

  * `:header` - Optional header text
  * `:footer` - Optional footer text

# `flow`

```elixir
@spec flow(String.t(), String.t(), String.t(), keyword()) :: builder()
```

Build a Flow trigger message.

## Options

  * `:header` - Optional header text
  * `:footer` - Optional footer text
  * `:flow_action` - Flow action, defaults to `"navigate"`
  * `:flow_action_payload` - Optional map payload added to parameters

# `list`

```elixir
@spec list(String.t(), String.t(), keyword()) :: builder()
```

Start building a list message.

## Options

  * `:header` - Optional header text
  * `:footer` - Optional footer text

## OpenAPI Constraints

  * `button_text` — button label, max 20 characters (`maxLength: 20`).
    Cannot be empty. Emojis supported, no markdown.

# `location_request`

```elixir
@spec location_request(String.t()) :: builder()
```

Build a location request message.

# `product`

```elixir
@spec product(String.t(), String.t(), keyword()) :: builder()
```

Build a single product message.

## Options

  * `:body` - Optional body text
  * `:footer` - Optional footer text

# `product_list`

```elixir
@spec product_list(String.t(), String.t(), keyword()) :: builder()
```

Build a multi-product list message.

## Options

  * `:header` - Optional header text
  * `:footer` - Optional footer text

# `product_section`

```elixir
@spec product_section(builder(), String.t(), [String.t()]) :: builder()
```

Add a product section to a product list message.

# `row`

```elixir
@spec row(String.t(), String.t(), String.t() | nil) :: map()
```

Create a row for a list section.

Description is optional and only included when provided.

## OpenAPI Constraints

  * `id` — unique row identifier, max 200 characters (`maxLength: 200`)
  * `title` — row title, max 24 characters (`maxLength: 24`)
  * `description` — optional, max 72 characters (`maxLength: 72`)

# `section`

```elixir
@spec section(builder(), String.t(), [map()]) :: builder()
```

Add a section with rows to a list message.

## OpenAPI Constraints

  * `title` — section title, max 24 characters (`maxLength: 24`)

---

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