Send Individual Message
Send a text, image, video, voice note, or file to a single WhatsApp number.
To send to a group, see Send Group Message.
Endpoint
POST /v1/whatsapp/{session_id}/send/Authentication: Bearer API key
Get session_id from the chat_id in List Phones.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone in international format (254XXXXXXXXX) |
type | string | Yes | text, image, video, voice, or file |
message | string | For text | Text body. Also used as caption for media. |
url | string | For media | Public URL of the media file |
filename | string | No | Suggested filename for the recipient (for type: file) |
mime_type | string | No | MIME type hint, e.g. application/pdf, image/jpeg |
Examples
Text
curl -X POST https://api.talkntalk.africa/v1/whatsapp/3fa85f64-5717-4562-b3fc-2c963f66afa6/send/ \
-H "Authorization: Bearer tk_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"to": "254712345678",
"type": "text",
"message": "Hello from TalkNTalk!"
}'Image
curl -X POST https://api.talkntalk.africa/v1/whatsapp/3fa85f64-5717-4562-b3fc-2c963f66afa6/send/ \
-H "Authorization: Bearer tk_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"to": "254712345678",
"type": "image",
"url": "https://example.com/promo.jpg",
"message": "Check out our latest offer!"
}'File / Document
curl -X POST https://api.talkntalk.africa/v1/whatsapp/3fa85f64-5717-4562-b3fc-2c963f66afa6/send/ \
-H "Authorization: Bearer tk_live_xxxx" \
-H "Content-Type: application/json" \
-d '{
"to": "254712345678",
"type": "file",
"url": "https://example.com/invoice.pdf",
"filename": "Invoice-001.pdf",
"mime_type": "application/pdf"
}'Response
201 Created
{
"success": true,
"message_id": "3EB065B353B9493D00C9",
"status": "sent",
"to": "254712345678",
"type": "text"
}| Field | Description |
|---|---|
message_id | Provider message ID for delivery tracking via webhooks |
status | sent — transitions to delivered / read via webhook events |
Code Examples
Node.js
const sessionId = '3fa85f64-5717-4562-b3fc-2c963f66afa6';
const res = await fetch(`https://api.talkntalk.africa/v1/whatsapp/${sessionId}/send/`, {
method: 'POST',
headers: {
'Authorization': 'Bearer tk_live_xxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: '254712345678',
type: 'text',
message: 'Hello from TalkNTalk!',
}),
});
const result = await res.json();
console.log('Message ID:', result.message_id);Python
import requests
session_id = '3fa85f64-5717-4562-b3fc-2c963f66afa6'
r = requests.post(
f'https://api.talkntalk.africa/v1/whatsapp/{session_id}/send/',
headers={'Authorization': 'Bearer tk_live_xxxx'},
json={
'to': '254712345678',
'type': 'text',
'message': 'Hello from TalkNTalk!',
},
)
print(r.json())PHP
$sessionId = '3fa85f64-5717-4562-b3fc-2c963f66afa6';
$ch = curl_init("https://api.talkntalk.africa/v1/whatsapp/{$sessionId}/send/");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer tk_live_xxxx',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '254712345678',
'type' => 'text',
'message' => 'Hello from TalkNTalk!',
]),
]);
$result = json_decode(curl_exec($ch), true);
echo "Message ID: {$result['message_id']}";Error Responses
| Status | Description |
|---|---|
400 Bad Request | Missing required field, unsupported type, or group ID passed as to |
401 Unauthorized | Missing or invalid API key |
404 Not Found | Session not found in your organisation |
409 Conflict | Phone is not connected |
502 Bad Gateway | WhatsApp provider rejected the message |