ChatKomodo Docs Home Sign in

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.

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 /v1 request. See Authentication.
Devices
Each linked WhatsApp number is a device; its id (sessionId in the paths) says which number sends.
Errors
{"error": "โ€ฆ", "code": "โ€ฆ"} with a stable code to branch on. See Errors.
Machine-readable spec
OpenAPI 3.1 at api.chatkomodo.com/openapi.json for client generators and Insomnia. An interactive console runs at api.chatkomodo.com/docs.
Postman
A ready Postman collection with every endpoint and an example request for each: import it, then set the apiKey and deviceId variables.

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));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
	  "chat_id": "+447700900123",
	  "type": "text",
	  "body": "Hi Sam, your order #1042 has shipped ๐Ÿšš"
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/messages", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}

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