services/messages.js file. The right message type depends on what you need the user to do: read information, pick from options, share their location, or receive a file. The examples below show the exact function signatures from the template, so you can use them directly in your bot code.
Interactive messages — buttons, list menus, URL buttons, and flows — are billed as “interactive” messages by WhatsApp. Plain text and media messages are billed as regular messages. Check the Meta pricing page for the current rates for your region.
Message types
- Text
- Image
- Document
- Location request
- Voice notes
- Templates
Send a plain text message. Supports newlines using Parameters:
\n.conversationId— the conversation ID from your databaseto— the recipient’s phone number (e.g."27821234567")text— the message body; use\nfor line breaks
Carousel messages
You can also send a carousel of up to 10 cards, each with an image, body text, and quick-reply buttons. Carousels are useful for product listings, plan comparisons, or multi-item promotions.cards array takes imageUrl, bodyText, and a buttons array. Button clicks are returned via the webhook as interactive messages with button_reply.
Sending a WhatsApp Flow
To open a multi-screen WhatsApp Flow from within a conversation, usesendFlow. The user taps the call-to-action button and the flow opens inline in WhatsApp.
