You have a WhatsApp number your customers already know, and an app that needs to talk to them: order updates, reminders, verification codes. This guide takes you from a new Communiktor account to a message on a real phone. Plan on about 15 minutes.
What you need
- A phone with WhatsApp or WhatsApp Business, signed in with the number you want to send from.
- A Communiktor account. The 7-day trial is enough for everything below, and it does not ask for payment details.
- A terminal with
curl, or any HTTP client you like (Postman, Insomnia, your own code).
Step 1: start the trial and create an instance
In Communiktor, a WhatsApp number is called an instance, and each instance runs on a subscription. Open the dashboard, go to Subscriptions and start the 7-day free trial on the plan you want to test.
Then go to Instances, create one and attach it to that subscription. Give it a name you will recognise later, such as "Shop support" or "Clinic reminders".
Each instance gets an Instance ID, a short code like BUV3WTC. You will pass it with every API request, so keep the instance page open.
Step 2: link your WhatsApp number
Linking works exactly like WhatsApp Web. On the instance page, choose one of the two methods:
- QR code: on your phone, open WhatsApp, go to Linked devices, tap Link a device and scan the code on your screen.
- Pairing code: enter your number, then type the 8-character code on your phone after choosing Link with phone number instead.
A few seconds later the instance shows as connected. Not sure which method to pick? Our article on QR codes and pairing codes, on the blog, explains when each one is the better choice.
Step 3: create an API key
Go to API Keys and create a key. It belongs to your team, so the same key works with every instance you add later.
Treat it like a password. Store it in an environment variable on your server, and never put it in a web page or a mobile app, where anyone could read it.
Step 4: send a text message
Now the fun part. Replace the three values in capitals and run:
curl -X POST https://api.communiktor.com/messages/text \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"instance": "YOUR_INSTANCE_ID",
"receiver": "14155552671",
"text": "Hello! This message was sent through the Communiktor API."
}'
The receiver is the phone number in international format, digits only: no +, no spaces, no leading 00. A Cameroonian number like +237 6 70 00 00 00 becomes 237670000000.
Send it to your own personal number first. It is the quickest way to see the result.
What the response tells you
If everything is right, you get this back:
{
"success": true,
"code": 200,
"message": "The message has been scheduled successfully",
"data": {
"message": "0193a6a2-5c1e-7c43-9a59-3f0f5a6f2b1d"
}
}
A 200 means the message was accepted. Delivery happens right after, usually within seconds. Keep the identifier in data.message: it is how you will recognise this message in webhooks, and how you cancel it if it was scheduled for later.
The same request from your code
In Node.js, with the built-in fetch:
const response = await fetch('https://api.communiktor.com/messages/text', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': process.env.COMMUNIKTOR_API_KEY,
},
body: JSON.stringify({
instance: process.env.COMMUNIKTOR_INSTANCE,
receiver: '14155552671',
text: 'Your order #1042 has shipped. It should arrive tomorrow.',
}),
});
const result = await response.json();
console.log(result.data?.message);
In PHP, with Guzzle:
$client = new GuzzleHttp\Client(['base_uri' => 'https://api.communiktor.com']);
$response = $client->post('/messages/text', [
'headers' => ['X-API-KEY' => getenv('COMMUNIKTOR_API_KEY')],
'json' => [
'instance' => getenv('COMMUNIKTOR_INSTANCE'),
'receiver' => '14155552671',
'text' => 'Your order #1042 has shipped. It should arrive tomorrow.',
],
]);
$messageId = json_decode((string) $response->getBody(), true)['data']['message'];
When it does not work
The API always answers with the same envelope, and message says what went wrong. The usual suspects:
- 401: the API key is wrong, the instance belongs to another team, or the instance has no active subscription.
- 400: the instance is not connected yet, or the receiver does not have WhatsApp.
- 422: a field is missing or malformed. Check the
receiverformat first. - 408: the instance took too long to answer. Wait a few seconds and try again.
Where to go next
You now have a working integration. Two things are worth adding before you go live:
- Webhooks, so your app knows when a message is delivered, read, or answered. Set them up on the instance page.
- Scheduling: add a
sendsAtdate to any message and Communiktor sends it at that time. Perfect for reminders.
The API documentation covers every message type, from images and PDFs to locations and contact cards, with examples in curl, JavaScript, PHP and Python.