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": "2d665262-ffca-4289-a6cb-4126910d868b",
"status": "queued",
"cost": 19.5,
"currency": "ngn",
"category": "utility",
"sender": "2349060008502"
}
FieldMeaning
message_idOur id for the message. Store it — it’s how you look the message up in delivery reports.
statusStatus at acceptance — normally queued. Delivery happens afterwards.
cost / currencyWhat this message cost you. Already debited.
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.