Learn R Programming

whapi (version 0.0.2)

whapi_coerce_buttons_quick: Coerce and validate QUICK REPLY buttons for Whapi

Description

Internal helper that prepares quick reply buttons for Whapi interactive messages. It relies on whapi_coerce_buttons_base() to normalize input (accept data.frame/list, map aliases label/name -> title, auto-generate id via slug + uniqueness) and then:

  • Enforces type = "quick_reply" for all buttons;

  • Requires the fields title and id;

  • Ensures the WhatsApp constraint of 1 to 3 buttons.

Usage

whapi_coerce_buttons_quick(buttons, verbose = TRUE)

Value

A list-of-lists of buttons, each including at least title, id, and type = "quick_reply".

Arguments

buttons

A data.frame/tibble (one row per button) or a list of named lists. title is required (or via alias), id will be auto-created when missing by whapi_coerce_buttons_base().

verbose

Logical (default TRUE). If TRUE, prints progress messages via cli.

See Also

whapi_coerce_buttons_base() for normalization; other coercers for mixed buttons (url/call/copy).

Examples

Run this code
 tibble::tribble(~title, "YES", "NO") |>
   whapi_coerce_buttons_base() |>
   whapi_coerce_buttons_quick()

Run the code above in your browser using DataLab