· 4 min · TextMeFlow Team

Formatting WhatsApp messages via API: bold, italics, lists and line breaks

Most API integrations send WhatsApp messages as one flat string, and the result looks like a wall of text: no emphasis, no structure, no visual hierarchy. WhatsApp actually supports a small set of formatting characters — the same ones the app itself uses — and they work identically whether a human types them or your backend generates them. Here's what's available and how to use it through TextMeFlow's POST /v1/messages endpoint.

The four characters WhatsApp understands

WhatsApp's renderer looks for these markers in the message body and converts them client-side:

  • *bold*bold
  • _italic_italic
  • ~strikethrough~strikethrough
  • ```monospace```monospace

That's the entire set. There's no header syntax, no colored text, no nested formatting (*_bold italic_* doesn't reliably work across WhatsApp clients), and no tables. Treat it as light emphasis, not a layout system.

Sending it through the API

Formatting lives entirely inside the text field — there's no separate parameter for it. You just include the marker characters in the string:

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, 14:00*.\n\n_Please arrive 10 minutes early._"
  }'

Two things matter for that request to render correctly:

  1. Escape the backslash properly. In JSON, a literal newline in the body has to be written as \n, not an actual line break in your source string — most JSON encoders (json_encode in PHP, json.dumps in Python, JSON.stringify in Node) handle this for you automatically if you build the payload as a native object rather than concatenating a raw JSON string by hand.
  2. Don't URL-escape the markdown characters. * and _ are valid inside a JSON string body and don't need any special treatment — just make sure they land in the text field as-is.

If you haven't wired up the basic request yet, the PHP/Python/Node.js sending guide covers the HTTP call in all three languages — formatting is a drop-in addition to any of those examples, not a different code path.

Building lists and multi-line messages

There's no native bullet-point syntax, but \n line breaks combined with a leading dash or number read cleanly in the WhatsApp UI:

{
  "to": "+32470000000",
  "text": "*Order #4821 — ready for pickup*\n\n- 2x Espresso beans (1kg)\n- 1x Ceramic filter\n- 1x Cleaning kit\n\nPickup point closes at 18:00."
}

This renders as a bold heading line followed by a clean list — no HTML, no attachments needed. For anything more structured than a short list (an itemized invoice, a multi-page document), attaching a file is a better fit than trying to force it into plain text — see the guide to sending PDFs and photos over the API for that.

What formatting is good for (and what it isn't)

Formatting earns its keep on the details a recipient needs to scan quickly, not on making the whole message bold:

  • Bold the one fact someone is scanning for: a date, an order number, an amount due.
  • Italic for a secondary note or instruction that shouldn't compete with the main line.
  • Keep the rest of the message as plain, short sentences. Over-formatting (bolding every other word) reads as spam and defeats the purpose.

Also worth knowing: WhatsApp auto-detects URLs and phone numbers in plain text and makes them tappable without any markup on your end — you don't need to do anything special to make a link clickable, just include it as normal text.

Test before you ship

Formatting renders differently across WhatsApp's mobile, desktop and web clients, and a stray unmatched * or _ in dynamic content (a customer's name with an underscore in it, for example) will silently break the formatting for the rest of the message instead of throwing an error. Before wiring a template into production, send a couple of test messages to your own number with realistic dynamic values — including edge cases like names containing _ or * — and check how they actually render. The API reference has the full field list if you're building this into a template system with variable substitution.

Try it

Formatting works on every plan, including the free one — sign up for free and send up to 50 messages a month to test how bold order numbers, italic notes and simple lists look in your own workflow before committing to anything paid.

Zelf WhatsApp-berichten versturen via API?

Gratis voor altijd tot 50 berichten/maand. QR scannen en binnen 5 minuten verstuur je je eerste bericht.

Gratis voor altijd