WhatsApp
Send Group Message

Send Group Message

Send a text, image, video, or voice message to a WhatsApp group.

To find your group's chat_id, call List Groups first.
For individual messages, see Send Individual Message.


Endpoint

POST /v1/whatsapp/{session_id}/groups/send/

Authentication: Bearer API key
Get session_id from the chat_id in List Phones.


Request Body

FieldTypeRequiredDescription
tostringYesGroup chat_id ending in @g.us — from List Groups
typestringYestext, image, video, or voice
messagestringFor textText body. Also used as caption for media.
urlstringFor mediaPublic URL of the media file
mime_typestringNoMIME type hint, e.g. video/mp4, audio/ogg

Examples

Text

curl -X POST https://api.talkntalk.africa/v1/whatsapp/3fa85f64-5717-4562-b3fc-2c963f66afa6/groups/send/ \
  -H "Authorization: Bearer tk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "to":      "120363410923125768@g.us",
    "type":    "text",
    "message": "Hello team!"
  }'

Image

curl -X POST https://api.talkntalk.africa/v1/whatsapp/3fa85f64-5717-4562-b3fc-2c963f66afa6/groups/send/ \
  -H "Authorization: Bearer tk_live_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "to":      "120363410923125768@g.us",
    "type":    "image",
    "url":     "https://example.com/banner.jpg",
    "message": "New product launch!"
  }'

Response

201 Created

{
  "success":    true,
  "message_id": "3EB065B353B9493D00C9",
  "status":     "sent",
  "to":         "120363410923125768@g.us",
  "type":       "text"
}

Code Examples

Node.js

const sessionId = '3fa85f64-5717-4562-b3fc-2c963f66afa6';
 
const res = await fetch(`https://api.talkntalk.africa/v1/whatsapp/${sessionId}/groups/send/`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer tk_live_xxxx',
    'Content-Type':  'application/json',
  },
  body: JSON.stringify({
    to:      '120363410923125768@g.us',
    type:    'text',
    message: 'Hello team!',
  }),
});
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}/groups/send/',
    headers={'Authorization': 'Bearer tk_live_xxxx'},
    json={
        'to':      '120363410923125768@g.us',
        'type':    'text',
        'message': 'Hello team!',
    },
)
print(r.json())

PHP

$sessionId = '3fa85f64-5717-4562-b3fc-2c963f66afa6';
 
$ch = curl_init("https://api.talkntalk.africa/v1/whatsapp/{$sessionId}/groups/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'      => '120363410923125768@g.us',
        'type'    => 'text',
        'message' => 'Hello team!',
    ]),
]);
$result = json_decode(curl_exec($ch), true);
echo "Message ID: {$result['message_id']}";

Error Responses

StatusDescription
400 Bad RequestMissing required field, unsupported type, or to is not a group ID
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