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()
Summary
Functions
Finalize the builder and return the payload map.
Add a reply button to a button message.
Start building a button message.
Build a CTA URL message.
Build a Flow trigger message.
Start building a list message.
Build a location request message.
Build a single product message.
Build a multi-product list message.
Add a product section to a product list message.
Create a row for a list section.
Add a section with rows to a list message.
Types
@type builder() :: map()
Functions
Finalize the builder and return the payload map.
This is an identity function -- the builder map is the payload.
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.
Start building a button message.
Options
:header- Optional header text:footer- Optional footer text (max 60 characters per OpenAPI spec)
Build a CTA URL message.
Options
:header- Optional header text:footer- Optional footer text
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
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.
Build a location request message.
Build a single product message.
Options
:body- Optional body text:footer- Optional footer text
Build a multi-product list message.
Options
:header- Optional header text:footer- Optional footer text
Add a product section to a product list message.
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)
Add a section with rows to a list message.
OpenAPI Constraints
title— section title, max 24 characters (maxLength: 24)