Send a message
Send a message #
Once your instance is paired and connected, you can send text, media and location messages through the API.
Text message
POST /v1/whatsapp/{instanceCode}/send/textBody parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Recipient number in E.164 format (e.g. +22507XXXXXXXX). |
| message | string | Yes | The text to send (4096 characters at most). |
| scheduled_at | datetime | No | Send later, at this date and time (YYYY-MM-DD HH:MM:SS). |
| skip_duplicated | boolean | No | If true and an identical message was already sent to this number in the last 24 hours, nothing is sent: the response describes that message, with skipped set to true. |
// Envoyer un message texte WhatsApp
const credentials = btoa('ACCESS_KEY:ACCESS_SECRET');
const res = await fetch('https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/text', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + credentials
},
body: JSON.stringify({
to: '+22507XXXXXXXX',
message: 'Bonjour Aïcha'
})
});
// Envoyer un message texte WhatsApp
$ch = curl_init('https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/text');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_USERPWD => 'ACCESS_KEY:ACCESS_SECRET',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+22507XXXXXXXX',
'message' => 'Bonjour Aïcha',
]),
]);
$response = curl_exec($ch);
curl -u 'ACCESS_KEY:ACCESS_SECRET' \
-X POST https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/text \
-H 'Content-Type: application/json' \
-d '{"to":"+22507XXXXXXXX","message":"Bonjour Aïcha"}'
Response (200)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"instance_id": "550e8400-e29b-41d4-a716-446655440001",
"recipient": "+22507XXXXXXXX",
"message_type": "text",
"status": "queued",
"scheduled": false,
"skipped": false
}
status is queued, or pending when the send is scheduled with scheduled_at.
Media message
POST /v1/whatsapp/{instanceCode}/send/mediaBody parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Recipient number (E.164). |
| type | string | Yes | image, video, document or audio. |
| media_url | string | Yes | Public URL of the file (http:// or https://). |
| caption | string | No | Caption shown with the media (max 1024 characters). |
| filename | string | No | File name, useful for document (max 255 characters). |
| scheduled_at | datetime | No | Send later, at this date and time (YYYY-MM-DD HH:MM:SS). |
| skip_duplicated | boolean | No | If true and an identical message was already sent to this number in the last 24 hours, nothing is sent: the response describes that message, with skipped set to true. |
// Envoyer un média WhatsApp
const credentials = btoa('ACCESS_KEY:ACCESS_SECRET');
const res = await fetch('https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/media', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + credentials
},
body: JSON.stringify({
to: '+22507XXXXXXXX',
type: 'image',
media_url: 'https://example.com/photo.jpg',
caption: 'Notre nouveau produit'
})
});
// Envoyer un média WhatsApp
$ch = curl_init('https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/media');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_USERPWD => 'ACCESS_KEY:ACCESS_SECRET',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+22507XXXXXXXX',
'type' => 'image',
'media_url' => 'https://example.com/photo.jpg',
'caption' => 'Notre nouveau produit',
]),
]);
$response = curl_exec($ch);
curl -u 'ACCESS_KEY:ACCESS_SECRET' \
-X POST https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/media \
-H 'Content-Type: application/json' \
-d '{"to":"+22507XXXXXXXX","type":"image","media_url":"https://example.com/photo.jpg","caption":"Notre nouveau produit"}'
Response (200)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"instance_id": "550e8400-e29b-41d4-a716-446655440001",
"recipient": "+22507XXXXXXXX",
"message_type": "image",
"media_url": "https://example.com/photo.jpg",
"status": "queued",
"scheduled": false,
"skipped": false
}
Location message
POST /v1/whatsapp/{instanceCode}/send/locationBody parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Recipient number (E.164). |
| latitude | number | Yes | Latitude between -90 and 90. |
| longitude | number | Yes | Longitude between -180 and 180. |
| name | string | No | Name of the place (≤ 255 characters). |
| address | string | No | Postal address (≤ 1024 characters). |
| scheduled_at | datetime | No | Send later, at this date and time (YYYY-MM-DD HH:MM:SS). |
| skip_duplicated | boolean | No | If true and an identical message was already sent to this number in the last 24 hours, nothing is sent: the response describes that message, with skipped set to true. |
// Envoyer une localisation WhatsApp
const credentials = btoa('ACCESS_KEY:ACCESS_SECRET');
const res = await fetch('https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/location', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + credentials
},
body: JSON.stringify({
to: '+22507XXXXXXXX',
latitude: 5.3599517,
longitude: -4.0082563,
name: 'Plateau, Abidjan',
address: 'Boulevard de la République, Abidjan'
})
});
// Envoyer une localisation WhatsApp
$ch = curl_init('https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/location');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_USERPWD => 'ACCESS_KEY:ACCESS_SECRET',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+22507XXXXXXXX',
'latitude' => 5.3599517,
'longitude' => -4.0082563,
'name' => 'Plateau, Abidjan',
'address' => 'Boulevard de la République, Abidjan',
]),
]);
$response = curl_exec($ch);
curl -u 'ACCESS_KEY:ACCESS_SECRET' \
-X POST https://api.callistosignal.com/v1/whatsapp/{instanceCode}/send/location \
-H 'Content-Type: application/json' \
-d '{"to":"+22507XXXXXXXX","latitude":5.3599517,"longitude":-4.0082563,"name":"Plateau, Abidjan"}'
Response (200)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"instance_id": "550e8400-e29b-41d4-a716-446655440001",
"recipient": "+22507XXXXXXXX",
"message_type": "location",
"status": "queued",
"scheduled": false,
"skipped": false
}