Code samples use your device
. Create an API key under API keys.ChatKomodo API
Introduction
Send and receive WhatsApp messages from your own software — order updates, one-time codes, reminders, customer service and campaigns — through the WhatsApp numbers you link to ChatKomodo.
QuickstartLink a number, create an API key and send your first message in five minutes.
AuthenticationAPI keys, child keys, signed requests and dashboard logins.
WebhooksGet incoming messages and delivery updates pushed to your server, signed.
API referenceEvery endpoint with its fields, responses and code samples.
The basics
- Base URL
https://api.chatkomodo.com- Format
- JSON in and out (UTF-8). File uploads use
multipart/form-data. - Authentication
Authorization: Bearer <your API key>on every/v1request. See Authentication.- Devices
- Each linked WhatsApp number is a device; its id (
sessionIdin the paths) says which number sends. - Errors
{"error": "…", "code": "…"}with a stablecodeto branch on. See Errors.- Machine-readable spec
- OpenAPI 3.1 at api.chatkomodo.com/openapi.json — import it into Postman, Insomnia or a client generator. An interactive console runs at api.chatkomodo.com/docs.
A first call
Send a WhatsApp message from one of your devices:
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/messages" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "+447700900123",
"type": "text",
"body": "Hi Sam, your order #1042 has shipped 🚚"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"chat_id": "+447700900123",
"type": "text",
"body": "Hi Sam, your order #1042 has shipped 🚚"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/messages",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"chat_id": "+447700900123",
"type": "text",
"body": "Hi Sam, your order #1042 has shipped 🚚",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/messages', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'chat_id' => '+447700900123',
'type' => 'text',
'body' => 'Hi Sam, your order #1042 has shipped 🚚',
],
]);
print_r(json_decode((string) $res->getBody(), true));The answer is {"id": "01J…", "status": "queued"}: the message is in the device's queue and goes out within seconds (POST /v1/sessions/{sessionId}/messages).
What you can build
- Notifications and one-time codes — send text, images, documents, locations, polls and contact cards; make sends safe to retry with
Idempotency-Key. - Two-way conversations — receive replies with webhooks or the live event stream, and work them in the inbox with agents.
- Campaigns — broadcasts to CRM audiences with personalization, consent checks and a daily send window; scheduled and recurring messages.
- Customer data — contacts, CRM fields, tags and segments, consent and privacy requests.
- Automation — keyword auto-replies, an AI assistant that answers from your documents, and Shopify / WooCommerce order messages.