Documentation
¶
Overview ¶
Package buttons sends WhatsApp native-flow buttons with HyperMeow.
Only button types that were LIVE-TESTED on a real phone (2026-10-21) are included: quick_reply, cta_url, cta_url as an in-app webview, cta_copy, cta_call, single_select dropdowns (including multi-menu panels), and send_location requests.
Deliberately NOT included, because current WhatsApp clients do not render them (the server accepts them, the phone shows nothing): classic ListMessage, legacy ButtonsMessage, hydrated template buttons. Use SingleSelect instead of a classic list.
Index ¶
- func LocationRequestMessage(body, footer string) *waE2E.Message
- func Message(body, footer string, btns ...*Button) *waE2E.Message
- func Send(ctx context.Context, client *whatsmeow.Client, to types.JID, ...) (whatsmeow.SendResponse, error)
- func SendLocationRequest(ctx context.Context, client *whatsmeow.Client, to types.JID, ...) (whatsmeow.SendResponse, error)
- func TapID(m *waE2E.Message) string
- type Button
- func CTACall(displayText, phoneNumber string) *Button
- func CTACopy(displayText, copyCode string) *Button
- func CTAURL(displayText, url string) *Button
- func CTAWebview(displayText, url string) *Button
- func QuickReply(displayText, id string) *Button
- func SingleSelect(title string, sections []Section) *Button
- type Row
- type Section
- type Tap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocationRequestMessage ¶
LocationRequestMessage builds a send_location request message. Two details make or break it: the button params must be EMPTY, and the message must NOT carry the trailing empty button — that button would rename the biz node to "mixed", while a real location request keeps the name "send_location". The shared location returns as a normal location message.
func Message ¶
Message builds an interactive native-flow message. A nameless trailing button is appended automatically: it makes HyperMeow tag the biz node "mixed", which avoids a 405 error on some accounts when a message mixes button types.
func Send ¶
func Send(ctx context.Context, client *whatsmeow.Client, to types.JID, body, footer string, btns ...*Button) (whatsmeow.SendResponse, error)
Send builds and sends a native-flow button message.
Types ¶
type Button ¶
type Button = waE2E.InteractiveMessage_NativeFlowMessage_NativeFlowButton
Button is a single native-flow button.
func CTACopy ¶
CTACopy copies copyCode to the clipboard when tapped. It produces no callback — the bot never learns that it was tapped.
func CTAWebview ¶
CTAWebview opens a link inside WhatsApp's in-app browser (full screen, behind a "Securely browse this business website" interstitial). It is a cta_url button carrying merchant_url + webview hints.
func QuickReply ¶
QuickReply is a simple tappable reply button. Tapping it sends a native-flow response carrying the given id (see ParseTap).
func SingleSelect ¶
SingleSelect is a dropdown list inside a button. Tapping a row sends a native-flow response carrying the row id (see ParseTap). Pass several SingleSelect buttons to Send to build a settings-panel style message with multiple menus. Renders on Android; like all native-flow lists it may not render on iOS.