Format WhatsApp Messages via API: Bold, Italic and Lists
Many integrations send WhatsApp messages as a single block of plain text: no emphasis, no structure, just a wall of text. Yet WhatsApp itself supports a small set of formatting characters, the same ones the app uses when a customer types them in. They work identically when your backend generates them via the API. Below is what's possible, and how to apply it through TextMeFlow's POST /v1/messages.
The four characters WhatsApp recognises
WhatsApp's rendering looks for these markers in the message text and converts them client-side:
*bold*→ bold_italic_→ italic~strikethrough~→strikethrough```monospace```→monospace
That's the complete set. No headings, no colours, no combinations (*_bold italic_* doesn't work reliably on every WhatsApp platform) and no tables. Think of it as light emphasis, not a layout system.
Sending formatting via the API
The formatting lives in the text field itself. There's no separate parameter. You simply put the characters around the text:
curl -X POST https://api.textmeflow.eu/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+32470000000",
"text": "Your appointment is confirmed for *Thursday 2:00 pm*.\n\n_Please arrive 10 minutes early._"
}'
Two things have to be right for this to render correctly:
- Line breaks as
\n. A literal new line in your source code has to be written as\nin JSON. Most JSON encoders (json_encodein PHP,json.dumpsin Python,JSON.stringifyin Node) do this automatically if you build the payload as a native object rather than pasting a hand-written string. - No URL-encoding on the formatting characters.
*and_are valid inside a JSON string and need no special treatment. They just have to appear literally in thetextfield.
If you don't have the basic call in place yet, the guide for PHP, Python and Node.js covers the HTTP call in all three languages. Formatting is a simple addition on top, not a separate code path.
Building lists and multiple lines
There's no native bullet syntax, but \n line breaks combined with a dash or number display neatly in the WhatsApp interface:
{
"to": "+32470000000",
"text": "*Order #4821 — ready for pickup*\n\n- 2x Coffee beans (1kg)\n- 1x Ceramic filter\n- 1x Cleaning kit\n\nPickup point closes at 6:00 pm."
}
That gives a bold title line followed by a clear list: no HTML, no attachment needed. For anything more structured than a short list (a detailed invoice, a multi-page document), an attachment is a better choice than forcing plain text. See the guide to sending PDFs and photos via the API for that.
What formatting is, and isn't, for
Formatting pays off most on the detail a recipient scans for, not by making the whole message bold:
- Bold for the one fact someone is looking for: a date, an order number, an outstanding amount.
- Italic for a side note or instruction that shouldn't compete with the main sentence.
- Keep the rest of the message short and plainly readable. Excessive formatting (making every other word bold) reads like spam and undermines the point.
Also useful to know: WhatsApp automatically recognises URLs and phone numbers in plain text and makes them clickable without any formatting on your part. You don't need to do anything for that.
Test before you go live
Formatting renders differently on WhatsApp's mobile, desktop and web clients, and a stray * or _ character in dynamic content (for example a customer name with an underscore in it) silently breaks the formatting of the rest of the message, without any error. Before you put a template with variable fields into production, send a few test messages to your own number with realistic values, including edge cases like names containing _ or *, and check how they actually render. The API reference has the full field list if you build this into a template system with variable substitution.
Getting started
Formatting works on every plan, including the free plan. Create a free account and send up to 50 messages a month to test how bold order numbers, italic notes and simple lists render in your own workflow, before you move to a paid plan.
Want to send WhatsApp messages via API yourself?
Free forever up to 50 messages/month. Scan a QR and send your first message within 5 minutes.
Free forever