WhatsApp
Send Individual Message

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

FieldTypeRequiredDescription
tostringYesRecipient phone in international format (254XXXXXXXXX)
typestringYestext, image, video, voice, or file
messagestringFor textText body. Also used as caption for media.
urlstringFor mediaPublic URL of the media file
filenamestringNoSuggested filename for the recipient (for type: file)
mime_typestringNoMIME 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"
}
FieldDescription
message_idProvider message ID for delivery tracking via webhooks
statussent — 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

StatusDescription
400 Bad RequestMissing required field, unsupported type, or group ID passed as to
401 UnauthorizedMissing or invalid API key
404 Not FoundSession not found in your organisation
409 ConflictPhone is not connected
502 Bad GatewayWhatsApp provider rejected the message