Learn R Programming

whapi (version 0.0.2)

whapi_send_quick_reply: Send a WhatsApp interactive message with QUICK REPLY buttons (Whapi.Cloud)

Description

Sends an interactive message of type QUICK REPLY via Whapi. Each button is normalized/validated by whapi_coerce_buttons_quick() and automatically gets a unique slugified id if missing.

Usage

whapi_send_quick_reply(
  to,
  body_text,
  buttons,
  header_text = NULL,
  footer_text = NULL,
  token = Sys.getenv("WHAPI_TOKEN", unset = ""),
  timeout = 30,
  verbose = TRUE
)

Value

A tibble with fields id, to, status, timestamp, and raw response resp.

Arguments

to

Character (length 1). Phone in E.164 digits (without "+") or group id.

body_text

Character. Main body text.

buttons

Data frame or list. Up to 3 items; fields: title, id (id auto-generated if missing).

header_text, footer_text

Character (optional). Header/footer texts.

token

Bearer token. Defaults to env var WHAPI_TOKEN.

timeout

Numeric, request timeout in seconds. Default 30.

verbose

Logical, print CLI messages. Default TRUE.

See Also

whapi_coerce_buttons_quick(), whapi_common_blocks(), whapi_perform_request()

Examples

Run this code
if (FALSE) {
 Sys.setenv(WHAPI_TOKEN = "your_token_here")
 whapi_send_quick_reply(
   to = "5581999999999",
   body_text = "Do you confirm?",
   buttons = tibble::tribble(~title, "YES", "NO")
 )
}

Run the code above in your browser using DataLab