Skip to content

Send a WhatsApp message

POSThttps://api.9bits.net/whatsapp/ng/v1/sendwhatsapp

Sends a single WhatsApp message to one recipient.

FieldTypeRequiredDescription
tostringRecipient MSISDN in international format.
message_typestringtemplate or text. Inferred if omitted — see below.
template_namestringThe Meta-approved template. Required for template.
languagestringTemplate language code, e.g. en.
paramsarrayValues for the template’s {{1}}, {{2}}… placeholders, in order.
header_media_urlstringMedia URL for a template with a media header.
textstringFree-form body. Only valid for text, inside an open window.
wa_account_idintegerWhich sender to send from. Defaults to your account default.

The only way to start a conversation.

Terminal window
curl -X POST https://api.9bits.net/whatsapp/ng/v1/sendwhatsapp \
-H "Authorization: Bearer $NINEBITS_WA_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "2348020000000",
"message_type": "template",
"template_name": "order_shipped",
"language": "en",
"params": ["Jane", "AB123"]
}'
{
"to": "2348020000000",
"message_type": "template",
"template_name": "receipt_with_logo",
"language": "en",
"params": ["Jane", "12500.00"],
"header_media_url": "https://cdn.example.com/img/receipt-header.png"
}

header_media_url must be publicly reachable — we fetch it when the message is dispatched.

Only works inside an open 24-hour window, i.e. after the customer has messaged you.

{
"to": "2348020000000",
"message_type": "text",
"text": "Thanks Jane — your refund is on its way."
}

Outside a window this is rejected. If you’re not certain the window is open, send a template instead.

{
"message_id": "wamid.HBgNMjM0ODAyMDAwMDAwMBUCABEYEjZBNUQ2",
"status": "sent",
"cost": 32.5,
"currency": "NGN",
"category": "utility",
"sender": "2349000000000"
}
FieldMeaning
message_idWhatsApp’s wamid.…. Store it — delivery webhooks reference it.
statusDispatch status.
cost / currencyWhat this message cost you.
categoryMeta’s billing category — utility, marketing, authentication, service. Set by the template. Marketing is the expensive one.
senderThe WhatsApp number it went out from.
{ "error": "recipient 'to' is required" }
StatusCause
400Missing to, or a text message sent outside an open 24-hour window.
401Missing or invalid API key.
402Insufficient balance.