Messaging API
Send different types of WhatsApp messages, and read the ones your instance receives.
Sending requests are POST with Content-Type: application/json. All requests must include the X-API-KEY header. Responses follow {message: string, success: boolean, code: number, data: any}.
Receivers use the international format, digits only, without the leading plus sign (e.g., 14155552671), or a group ID with group: true. The instance must be connected.
Common Parameters
Every message endpoint accepts these optional parameters in the request body to control delivery and tracking:
group(boolean): Set this totrueif thereceiveris a WhatsApp Group ID rather than a phone number. This ensures the message is correctly routed to the group chat.sendsAt(string | null): An ISO 8601 date with a timezone (e.g.,2026-12-25T10:00:00Z). If it is in the future, Communiktor schedules the message and sends it at that time; it can be cancelled until then. Usenullor omit it for immediate delivery.metadata(object): A custom JSON object of your choice. This data is not sent to the WhatsApp recipient but is stored by Communiktor. When a webhook event (likemessage.sentormessage.read) is triggered for this message, yourmetadatawill be included in the webhook payload, allowing you to easily link the event back to your internal systems (e.g., an order ID or a customer UUID).
Response
Every message endpoint answers as soon as the message is accepted, with its identifier in data.message:
{
"success": true,
"code": 200,
"message": "The message has been scheduled successfully",
"data": {
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
}
}
- Keep
data.message: it identifies the message in the webhooks (data.message.message) and is needed to cancel a scheduled message. - The delivery happens right after the response. Its outcome is reported by the
message.sentormessage.sent.failedwebhooks, thenmessage.receivedandmessage.read. - Messages of one instance are sent one at a time, in the order they were accepted.
- The request is refused with HTTP
400when the receiver is not on WhatsApp or the instance is not connected (seemessage).
Text
POST /messages/text
When to use it
- Send plain text updates, OTPs, and quick replies.
- Ideal for low-latency transactional notifications.
Body
- instance: string — Your instance identifier.
- receiver: string — E.164 digits without plus.
- text: string — The message text.
- group?: boolean — Set to true if the receiver is a WhatsApp group.
- sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
- metadata?: object — Optional JSON object that will be returned in webhooks.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
import axios from 'axios';
const url = 'https://api.communiktor.com/messages/text';
const headers = {
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY',
};
const body = {
instance: 'my-instance-1',
receiver: '14155552671',
text: 'Hello from Communiktor!',
group: false,
sendsAt: '2024-12-25T10:00:00Z', // Optional: schedule for later
metadata: { orderId: 'ORD-12345' }, // Optional: track in webhooks
};
axios.post(url, body, { headers })
.then(res => console.log(res.data))
.catch(err => console.error(err.response?.data || err.message));
const url = 'https://api.communiktor.com/messages/text';
const res = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY',
},
body: JSON.stringify({
instance: 'my-instance-1',
receiver: '14155552671',
text: 'Hello from Communiktor!',
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
}),
});
const data = await res.json();
console.log(data);
import requests
url = 'https://api.communiktor.com/messages/text'
headers = {
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY'
}
payload = {
'instance': 'my-instance-1',
'receiver': '14155552671',
'text': 'Hello from Communiktor!',
'group': False,
'sendsAt': '2024-12-25T10:00:00Z',
'metadata': {'orderId': 'ORD-12345'}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
curl -X POST https://api.communiktor.com/messages/text \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"text": "Hello from Communiktor!",
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client([
'base_uri' => 'https://api.communiktor.com',
]);
$response = $client->post('/messages/text', [
'headers' => [
'Content-Type' => 'application/json',
'X-API-KEY' => 'YOUR_API_KEY',
],
'json' => [
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'text' => 'Hello from Communiktor!',
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345']
],
]);
echo $response->getBody();
<?php
$ch = curl_init('https://api.communiktor.com/messages/text');
$payload = json_encode([
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'text' => 'Hello from Communiktor!',
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345']
]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-KEY: YOUR_API_KEY'
],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
Image
POST /messages/image
When to use it
- Send product photos, tickets, receipts, or screenshots.
- Use viewOnce for sensitive content that should not persist in the chat.
Body
- instance: string — Your instance identifier.
- receiver: string — E.164 digits without plus.
- url: string — Publicly accessible image URL.
- viewOnce?: boolean — If true, the media disappears after being viewed once.
- caption?: string — Optional text shown below the image.
- group?: boolean — Set to true if the receiver is a WhatsApp group.
- sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
- metadata?: object — Optional JSON object that will be returned in webhooks.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -X POST https://api.communiktor.com/messages/image \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/image.jpg",
"caption": "Order #12345",
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'
import axios from 'axios';
await axios.post('https://api.communiktor.com/messages/image', {
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/image.jpg',
caption: 'Order #12345',
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
}, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' } });
await fetch('https://api.communiktor.com/messages/image', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
body: JSON.stringify({
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/image.jpg',
caption: 'Order #12345',
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
})
});
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$resp = $client->post('/messages/image', [
'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => 'YOUR_API_KEY' ],
'json' => [
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/image.jpg',
'caption' => 'Order #12345',
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]
]);
echo $resp->getBody();
<?php
$ch = curl_init('https://api.communiktor.com/messages/image');
$payload = json_encode([
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/image.jpg',
'caption' => 'Order #12345',
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: YOUR_API_KEY' ],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$resp = curl_exec($ch);
if ($resp === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $resp;
import requests
r = requests.post('https://api.communiktor.com/messages/image', json={
'instance': 'my-instance-1',
'receiver': '14155552671',
'url': 'https://example.com/image.jpg',
'caption': 'Order #12345',
'viewOnce': False,
'group': False,
'sendsAt': '2024-12-25T10:00:00Z',
'metadata': {'orderId': 'ORD-12345'}
}, headers={
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY'
})
print(r.json())
Video
POST /messages/video
When to use it
- Send feature demos, announcements, or short clips.
- Use asGif/asNote for lightweight previews when appropriate.
Body
- instance: string — Your instance identifier.
- receiver: string — E.164 digits without plus.
- url: string — Publicly accessible video URL.
- asGif?: boolean — Send as short looping preview (no sound).
- asNote?: boolean — Send as a circular video note (like push-to-talk style).
- caption?: string — Optional text shown below the video.
- viewOnce?: boolean — If true, the media disappears after being viewed once.
- group?: boolean — Set to true if the receiver is a WhatsApp group.
- sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
- metadata?: object — Optional JSON object that will be returned in webhooks.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -X POST https://api.communiktor.com/messages/video \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/video.mp4",
"caption": "Feature demo",
"asGif": false,
"asNote": false,
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'
import axios from 'axios';
await axios.post('https://api.communiktor.com/messages/video', {
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/video.mp4',
caption: 'Feature demo',
asGif: false,
asNote: false,
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
}, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' } });
await fetch('https://api.communiktor.com/messages/video', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
body: JSON.stringify({
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/video.mp4',
caption: 'Feature demo',
asGif: false,
asNote: false,
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
})
});
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$resp = $client->post('/messages/video', [
'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => 'YOUR_API_KEY' ],
'json' => [
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/video.mp4',
'caption' => 'Feature demo',
'asGif' => false,
'asNote' => false,
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]
]);
echo $resp->getBody();
<?php
$ch = curl_init('https://api.communiktor.com/messages/video');
$payload = json_encode([
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/video.mp4',
'caption' => 'Feature demo',
'asGif' => false,
'asNote' => false,
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: YOUR_API_KEY' ],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$resp = curl_exec($ch);
if ($resp === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $resp;
import requests
r = requests.post('https://api.communiktor.com/messages/video', json={
'instance': 'my-instance-1',
'receiver': '14155552671',
'url': 'https://example.com/video.mp4',
'caption': 'Feature demo',
'asGif': False,
'asNote': False,
'viewOnce': False,
'group': False,
'sendsAt': '2024-12-25T10:00:00Z',
'metadata': {'orderId': 'ORD-12345'}
}, headers={
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY'
})
print(r.json())
Audio
POST /messages/audio
When to use it
- Share voice notes, short audio confirmations, or hotline messages.
- Use asNote for a push-to-talk style waveform.
Body
- instance: string — Your instance identifier.
- receiver: string — E.164 digits without plus.
- url: string — Publicly accessible audio URL.
- asNote?: boolean — Send as a voice note (push-to-talk style).
- viewOnce?: boolean — If true, the media disappears after being viewed once.
- group?: boolean — Set to true if the receiver is a WhatsApp group.
- sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
- metadata?: object — Optional JSON object that will be returned in webhooks.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -X POST https://api.communiktor.com/messages/audio \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/audio.mp3",
"asNote": false,
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'
import axios from 'axios';
await axios.post('https://api.communiktor.com/messages/audio', {
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/audio.mp3',
asNote: false,
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
}, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' } });
await fetch('https://api.communiktor.com/messages/audio', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
body: JSON.stringify({
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/audio.mp3',
asNote: false,
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
})
});
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$resp = $client->post('/messages/audio', [
'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => 'YOUR_API_KEY' ],
'json' => [
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/audio.mp3',
'asNote' => false,
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]
]);
echo $resp->getBody();
<?php
$ch = curl_init('https://api.communiktor.com/messages/audio');
$payload = json_encode([
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/audio.mp3',
'asNote' => false,
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: YOUR_API_KEY' ],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$resp = curl_exec($ch);
if ($resp === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $resp;
import requests
r = requests.post('https://api.communiktor.com/messages/audio', json={
'instance': 'my-instance-1',
'receiver': '14155552671',
'url': 'https://example.com/audio.mp3',
'asNote': False,
'viewOnce': False,
'group': False,
'sendsAt': '2024-12-25T10:00:00Z',
'metadata': {'orderId': 'ORD-12345'}
}, headers={
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY'
})
print(r.json())
Document
POST /messages/document
When to use it
- Send PDFs, invoices, contracts, or other business files.
- Set filename to control how the file appears to the recipient.
Body
- instance: string — Your instance identifier.
- receiver: string — E.164 digits without plus.
- url: string — Publicly accessible document URL.
- viewOnce?: boolean — If true, the media disappears after being viewed once.
- caption?: string — Optional text shown below the document.
- filename?: string — File name shown to the recipient.
- group?: boolean — Set to true if the receiver is a WhatsApp group.
- sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
- metadata?: object — Optional JSON object that will be returned in webhooks.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -X POST https://api.communiktor.com/messages/document \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"url": "https://example.com/invoice.pdf",
"caption": "Invoice May",
"filename": "invoice-may.pdf",
"viewOnce": false,
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'
import axios from 'axios';
await axios.post('https://api.communiktor.com/messages/document', {
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/invoice.pdf',
caption: 'Invoice May',
filename: 'invoice-may.pdf',
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
}, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' } });
await fetch('https://api.communiktor.com/messages/document', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
body: JSON.stringify({
instance: 'my-instance-1',
receiver: '14155552671',
url: 'https://example.com/invoice.pdf',
caption: 'Invoice May',
filename: 'invoice-may.pdf',
viewOnce: false,
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
})
});
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$resp = $client->post('/messages/document', [
'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => 'YOUR_API_KEY' ],
'json' => [
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/invoice.pdf',
'caption' => 'Invoice May',
'filename' => 'invoice-may.pdf',
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]
]);
echo $resp->getBody();
<?php
$ch = curl_init('https://api.communiktor.com/messages/document');
$payload = json_encode([
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'url' => 'https://example.com/invoice.pdf',
'caption' => 'Invoice May',
'filename' => 'invoice-may.pdf',
'viewOnce' => false,
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: YOUR_API_KEY' ],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$resp = curl_exec($ch);
if ($resp === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $resp;
import requests
r = requests.post('https://api.communiktor.com/messages/document', json={
'instance': 'my-instance-1',
'receiver': '14155552671',
'url': 'https://example.com/invoice.pdf',
'caption': 'Invoice May',
'filename': 'invoice-may.pdf',
'viewOnce': False,
'group': False,
'sendsAt': '2024-12-25T10:00:00Z',
'metadata': {'orderId': 'ORD-12345'}
}, headers={
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY'
})
print(r.json())
Location
POST /messages/location
When to use it
- Share store locations, delivery coordinates, or meeting points.
- Include name/address to display a readable pin name.
Body
- instance: string — Your instance identifier.
- receiver: string — E.164 digits without plus.
- location: object — Coordinates and label to pin on the map:
- latitude: number — Latitude in decimal degrees.
- longitude: number — Longitude in decimal degrees.
- name?: string — Pin title shown to the user.
- address?: string — Human‑readable address for the pin.
- group?: boolean — Set to true if the receiver is a WhatsApp group.
- sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
- metadata?: object — Optional JSON object that will be returned in webhooks.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -X POST https://api.communiktor.com/messages/location \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"location": {"latitude": 37.7749, "longitude": -122.4194, "name": "Communiktor HQ", "address": "1 Market St, San Francisco"},
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'
import axios from 'axios';
await axios.post('https://api.communiktor.com/messages/location', {
instance: 'my-instance-1',
receiver: '14155552671',
location: { latitude: 37.7749, longitude: -122.4194, name: 'Communiktor HQ', address: '1 Market St, San Francisco' },
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
}, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' } });
await fetch('https://api.communiktor.com/messages/location', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
body: JSON.stringify({
instance: 'my-instance-1',
receiver: '14155552671',
location: { latitude: 37.7749, longitude: -122.4194, name: 'Communiktor HQ', address: '1 Market St, San Francisco' },
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' },
})
});
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$resp = $client->post('/messages/location', [
'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => 'YOUR_API_KEY' ],
'json' => [
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'location' => [ 'latitude' => 37.7749, 'longitude' => -122.4194, 'name' => 'Communiktor HQ', 'address' => '1 Market St, San Francisco' ],
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]
]);
echo $resp->getBody();
<?php
$ch = curl_init('https://api.communiktor.com/messages/location');
$payload = json_encode([
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'location' => [ 'latitude' => 37.7749, 'longitude' => -122.4194, 'name' => 'Communiktor HQ', 'address' => '1 Market St, San Francisco' ],
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: YOUR_API_KEY' ],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$resp = curl_exec($ch);
if ($resp === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $resp;
import requests
r = requests.post('https://api.communiktor.com/messages/location', json={
'instance': 'my-instance-1',
'receiver': '14155552671',
'location': { 'latitude': 37.7749, 'longitude': -122.4194, 'name': 'Communiktor HQ', 'address': '1 Market St, San Francisco' },
'group': False,
'sendsAt': '2024-12-25T10:00:00Z',
'metadata': {'orderId': 'ORD-12345'}
}, headers={
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY'
})
print(r.json())
vCard
POST /messages/vcard
When to use it
- Share a contact card for sales agents, stores, or support lines.
- Ensure the contact phone is E.164 digits to allow immediate messaging.
Body
- instance: string — Your instance identifier.
- receiver: string — E.164 digits without plus.
- name: string — Title of the card shown in the chat.
- contact: object with fields:
- fullname: string — Contact full name.
- phone: string — E.164 digits without plus.
- waid?: string — WhatsApp ID of the contact (if known).
- organization?: string — Company or organization name.
- title?: string — Role or job title.
- email?: string — Contact email address.
- url?: string — Website or profile URL.
- address?: string — Postal address.
- note?: string — Additional notes.
- group?: boolean — Set to true if the receiver is a WhatsApp group.
- sendsAt?: string | null — Optional ISO 8601 date to schedule the message.
- metadata?: object — Optional JSON object that will be returned in webhooks.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -X POST https://api.communiktor.com/messages/vcard \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"receiver": "14155552671",
"name": "Sales Contact",
"contact": {
"fullname": "Jane Doe",
"phone": "14155552671",
"organization": "ACME Inc.",
"title": "Account Executive",
"email": "jane.doe@example.com",
"url": "https://example.com",
"address": "1 Market St, San Francisco",
"note": "VIP client handler"
},
"group": false,
"sendsAt": "2024-12-25T10:00:00Z",
"metadata": {"orderId": "ORD-12345"}
}'
import axios from 'axios';
await axios.post('https://api.communiktor.com/messages/vcard', {
instance: 'my-instance-1',
receiver: '14155552671',
name: 'Sales Contact',
contact: {
fullname: 'Jane Doe',
phone: '14155552671',
organization: 'ACME Inc.',
title: 'Account Executive',
email: 'jane.doe@example.com',
url: 'https://example.com',
address: '1 Market St, San Francisco',
note: 'VIP client handler'
},
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' }
}, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' } });
await fetch('https://api.communiktor.com/messages/vcard', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
body: JSON.stringify({
instance: 'my-instance-1',
receiver: '14155552671',
name: 'Sales Contact',
contact: {
fullname: 'Jane Doe',
phone: '14155552671',
organization: 'ACME Inc.',
title: 'Account Executive',
email: 'jane.doe@example.com',
url: 'https://example.com',
address: '1 Market St, San Francisco',
note: 'VIP client handler'
},
group: false,
sendsAt: '2024-12-25T10:00:00Z',
metadata: { orderId: 'ORD-12345' }
})
});
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$resp = $client->post('/messages/vcard', [
'headers' => [ 'Content-Type' => 'application/json', 'X-API-KEY' => 'YOUR_API_KEY' ],
'json' => [
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'name' => 'Sales Contact',
'contact' => [
'fullname' => 'Jane Doe',
'phone' => '14155552671',
'organization' => 'ACME Inc.',
'title' => 'Account Executive',
'email' => 'jane.doe@example.com',
'url' => 'https://example.com',
'address' => '1 Market St, San Francisco',
'note' => 'VIP client handler'
],
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]
]);
echo $resp->getBody();
<?php
$ch = curl_init('https://api.communiktor.com/messages/vcard');
$payload = json_encode([
'instance' => 'my-instance-1',
'receiver' => '14155552671',
'name' => 'Sales Contact',
'contact' => [
'fullname' => 'Jane Doe',
'phone' => '14155552671',
'organization' => 'ACME Inc.',
'title' => 'Account Executive',
'email' => 'jane.doe@example.com',
'url' => 'https://example.com',
'address' => '1 Market St, San Francisco',
'note' => 'VIP client handler'
],
'group' => false,
'sendsAt' => '2024-12-25T10:00:00Z',
'metadata' => ['orderId' => 'ORD-12345'],
]);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: YOUR_API_KEY' ],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$resp = curl_exec($ch);
if ($resp === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $resp;
import requests
r = requests.post('https://api.communiktor.com/messages/vcard', json={
'instance': 'my-instance-1',
'receiver': '14155552671',
'name': 'Sales Contact',
'contact': {
'fullname': 'Jane Doe',
'phone': '14155552671',
'organization': 'ACME Inc.',
'title': 'Account Executive',
'email': 'jane.doe@example.com',
'url': 'https://example.com',
'address': '1 Market St, San Francisco',
'note': 'VIP client handler'
},
'group': False,
'sendsAt': '2024-12-25T10:00:00Z',
'metadata': {'orderId': 'ORD-12345'}
}, headers={
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY'
})
print(r.json())
Cancel a scheduled message
POST /messages/cancel
When to use it
- Cancel a message scheduled with
sendsAtbefore it is sent (an appointment was moved, an order was cancelled).
Body
- instance: string — Your instance identifier.
- message: string — The message identifier returned when the message was created (
data.message).
Only messages that have not been sent yet can be cancelled. Otherwise, the API answers HTTP 404 with the message Message not found or already sent.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -X POST https://api.communiktor.com/messages/cancel \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "my-instance-1",
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
}'
import axios from 'axios';
const { data } = await axios.post('https://api.communiktor.com/messages/cancel', {
instance: 'my-instance-1',
message: '0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d'
}, {
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
});
console.log(data);
const res = await fetch('https://api.communiktor.com/messages/cancel', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY' },
body: JSON.stringify({
instance: 'my-instance-1',
message: '0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d'
}),
});
console.log(await res.json());
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$response = $client->post('/messages/cancel', [
'headers' => ['Content-Type' => 'application/json', 'X-API-KEY' => 'YOUR_API_KEY'],
'json' => [
'instance' => 'my-instance-1',
'message' => '0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d',
],
]);
echo $response->getBody();
<?php
$payload = json_encode([
'instance' => 'my-instance-1',
'message' => '0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d',
]);
$ch = curl_init('https://api.communiktor.com/messages/cancel');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-API-KEY: YOUR_API_KEY'],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $response;
import requests
response = requests.post(
'https://api.communiktor.com/messages/cancel',
json={
"instance": "my-instance-1",
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
},
headers={'Content-Type': 'application/json', 'X-API-KEY': 'YOUR_API_KEY'},
)
print(response.json())
Response
{
"success": true,
"code": 200,
"message": "Message cancelled successfully",
"data": {
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
}
}
Received messages
GET /messages/incoming
When to use it
- Give a chatbot or an AI agent the recent conversation with a customer.
- Catch up on the messages your server missed while it was down, instead of relying only on the
message.incomingwebhook.
Communiktor keeps the messages your instance receives in direct conversations for 30 days, with their files, whether the webhook is enabled or not. Group messages are not kept. The messages you send are tracked through their own identifiers and webhooks.
Query parameters
- instance: string — Your instance identifier.
- phone: string (optional) — Only the messages from this phone number (international format, digits only).
- since: string (optional) — Only the messages received at or after this ISO 8601 date (e.g.
2026-11-26T00:00:00Z). - until: string (optional) — Only the messages received before this ISO 8601 date.
- limit: number (optional) — Messages per page, from 1 to 100. Default: 50.
- cursor: string (optional) — The
next_cursorof the previous page.
Messages come newest first. When data.next_cursor is not null, pass it as cursor to get the older ones. Each message has the same fields as data.message in the message.incoming webhook, except the group fields. File links (media.url) are valid one hour: call the endpoint again to get a fresh one.
- curl
- Axios
- Fetch
- Guzzle
- curl (PHP)
- requests
curl -G https://api.communiktor.com/messages/incoming \
-H "X-API-KEY: YOUR_API_KEY" \
--data-urlencode "instance=my-instance-1" \
--data-urlencode "phone=14155552671" \
--data-urlencode "limit=20"
import axios from 'axios';
const { data } = await axios.get('https://api.communiktor.com/messages/incoming', {
params: { instance: 'my-instance-1', phone: '14155552671', limit: 20 },
headers: { 'X-API-KEY': 'YOUR_API_KEY' },
});
console.log(data.data.messages, data.data.next_cursor);
const params = new URLSearchParams({ instance: 'my-instance-1', phone: '14155552671', limit: '20' });
const res = await fetch(`https://api.communiktor.com/messages/incoming?${params}`, {
headers: { 'X-API-KEY': 'YOUR_API_KEY' },
});
const { data } = await res.json();
console.log(data.messages, data.next_cursor);
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.communiktor.com']);
$response = $client->get('/messages/incoming', [
'headers' => ['X-API-KEY' => 'YOUR_API_KEY'],
'query' => [
'instance' => 'my-instance-1',
'phone' => '14155552671',
'limit' => 20,
],
]);
echo $response->getBody();
<?php
$query = http_build_query([
'instance' => 'my-instance-1',
'phone' => '14155552671',
'limit' => 20,
]);
$ch = curl_init('https://api.communiktor.com/messages/incoming?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY'],
]);
$response = curl_exec($ch);
if ($response === false) { throw new Exception(curl_error($ch)); }
curl_close($ch);
echo $response;
import requests
response = requests.get(
'https://api.communiktor.com/messages/incoming',
params={'instance': 'my-instance-1', 'phone': '14155552671', 'limit': 20},
headers={'X-API-KEY': 'YOUR_API_KEY'},
)
print(response.json())
Response
{
"success": true,
"code": 200,
"message": "Received messages",
"data": {
"messages": [
{
"id": "3EB0A1B2C3D4E5F60718",
"type": "image",
"text": "Do you have this one in blue?",
"mime": "image/jpeg",
"sender": "14155552671",
"name": "Ana",
"timestamp": "2026-11-26T10:16:42Z",
"reply_to": null,
"media": {
"url": "https://…/incoming/…?X-Amz-Expires=3600&X-Amz-Signature=…",
"expires_at": "2026-11-26T11:20:03Z",
"mime": "image/jpeg",
"size": 81234,
"file_name": null
},
"location": null,
"contact": null
},
{
"id": "3EB0C767D26A1D8B4F3A",
"type": "text",
"text": "Hello, is the red dress still available?",
"mime": null,
"sender": "14155552671",
"name": "Ana",
"timestamp": "2026-11-26T10:15:00Z",
"reply_to": null,
"media": null,
"location": null,
"contact": null
}
],
"next_cursor": "5b0d7a3e-8f8f-4a52-9a3c-0c9a6f1f2e11"
}
}
The request is refused with HTTP 400 when limit is out of range or phone is not a phone number.