ChatKomodo Docs Home Sign in

API reference · Messaging

Broadcasts

Campaigns to many recipients: explicit lists or CRM audiences (segments, groups, tags), personalization, consent checks, the daily send window and progress counters. Before sending, POST …/blasts/check-recipients shows which numbers a broadcast would skip (blocked, opted out, or messaged within the gap) and the share that already chatted, and POST …/blasts/test sends the campaign to the device's own number first.

Check the ban risk of a broadcast

POST/v1/sessions/{sessionId}/blasts/risk

How likely this broadcast is to get the number banned, before creating or starting it. Same body as creating a campaign; nothing is saved. Looks at the share of recipients this number never chatted with, the number's age and its failures, opt-outs and blocks in the last 7 days, links (especially shortened ones), promotional words, capitals and whether every recipient gets the same text.

Path parameters

  • sessionIdstringrequired

Request body

  • namestringrequired
    Campaign name (internal)
    Up to 200 characters
  • message_typestring
    One of: text, image, video, document, audioDefault: "text"
  • bodystring
    Message text. Personalization tokens: {name}, {first_name}, {phone}, {var1}…{var5}, {attr.<key>}; add a fallback with double braces: {{first_name|there}}, {{attr.plan|your plan}}. A token without a value and without a fallback becomes empty.
    Up to 65 536 characters
  • media_r2_keystring
    Media key from /v1/media/upload-url (for image/video/document/audio)
  • captionstring
    Up to 1 024 characters
  • footerstring
    Up to 200 characters
  • buttonsany
    Optional button configuration
  • delay_configobject
    Pause between recipients. Default 3 000–10 000 ms with 1 000–3 000 ms of simulated typing, and short breaks.
  • delay_config.min_msintegerrequired
  • delay_config.max_msintegerrequired
  • delay_config.typing_min_msintegerrequired
  • delay_config.typing_max_msintegerrequired
  • delay_config.restboolean
    Short breaks (default true): after every 40-60 messages a device pauses 10-20 minutes
  • extra_session_idsarray of string
    More devices of the same business to send from (up to 5 devices in all). Each device keeps its own pace and limits; people who already chatted with one of them get the message from that device; a device that disconnects hands its recipients to the others.
    Up to 4 items
  • simulate_typingboolean
    Show "typing…" before each message (default true)
  • recipientsarray of object
    Explicit recipients. Combined (deduplicated) with the CRM audience below.
    Up to 50 000 items
  • recipients[].chat_idstringrequired
    Phone number (+<country code><number>; local numbers use the business country) or JID
  • recipients[].namestring
    Up to 200 characters
  • recipients[].varsarray of string
    Values for {var1}…{var5}
    Up to 5 items
  • recipients[].attrsobject
    Per-recipient values for {attr.<key>}
  • segment_idstring
    Add every contact of this saved segment
  • group_idstring
    Add every contact of this contact group
  • tagstring
    Add every contact carrying this tag
  • consent_attestedboolean
    Confirms the recipients agreed to receive these messages. Required (here or when starting) if the tenant turned on require_attestation.
  • abobject
    A/B test: a random test share gets message A (body) or B; after wait_hours the variant with the higher reply rate (ties: A) goes to everyone else. See /results and /ab/decide.
  • ab.bodystring
    Message B (required for text broadcasts)
    Up to 65 536 characters
  • ab.captionstring
    Caption B (media broadcasts; body B may also be given)
    Up to 1 024 characters
  • ab.test_percentinteger
    Share of the recipients in the test, split evenly between A and B (default 20); the test needs at least 20 recipients
    From 10 to 50
  • ab.wait_hoursinteger
    Hours to wait for replies after the test share is sent (default 4)
    From 1 to 48

Responses

  • 200Risk
    Response fields
    • scoreintegerrequired
      0-100
    • levelstringrequired
      high (60+) needs accept_risk: true to start
      One of: low, medium, high
    • factorsarray of objectrequired
      Highest first
    • factors[].idstringrequired
      One of: new_contacts, young_number, volume, failures, complaints, shortener, link, spam_words, caps, punctuation, identical, media_only, unsafe_link
    • factors[].pointsintegerrequired
    • factors[].paramsobjectrequired
      Numbers in the message, for translations
    • factors[].messagestringrequired
    • factors[].tipstringrequired
    • statsobjectrequired
    • stats.recipientsintegerrequired
    • stats.new_contactsintegerrequired
      Recipients this number never had a chat with (estimated from a sample above 5 000)
    • stats.new_contact_sharenumberrequired
    • stats.spread_daysintegerrequired
      Days the new contacts are spread over by the number's daily limit
  • 400Validation error
  • 404Segment or group not found
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/risk" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Example",
  "message_type": "text",
  "body": "Hi Sam, your order has shipped."
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/risk', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "Example",
    "message_type": "text",
    "body": "Hi Sam, your order 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/blasts/risk",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "name": "Example",
        "message_type": "text",
        "body": "Hi Sam, your order 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/blasts/risk', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'name' => 'Example',
        'message_type' => 'text',
        'body' => 'Hi Sam, your order has shipped.',
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	body := strings.NewReader(`{
	  "name": "Example",
	  "message_type": "text",
	  "body": "Hi Sam, your order has shipped."
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/risk", 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))
}
Response 200
{
  "score": 1,
  "level": "low",
  "factors": [
    {
      "id": "new_contacts",
      "points": 1,
      "params": {},
      "message": "Hi Sam, your order has shipped.",
      "tip": "string"
    }
  ],
  "stats": {
    "recipients": 1,
    "new_contacts": 1,
    "new_contact_share": 0.5,
    "spread_days": 1
  }
}

Check which recipients a broadcast would skip

POST/v1/sessions/{sessionId}/blasts/check-recipients

Which of these recipients a broadcast from this device would skip, before the message is written: on the device's blocklist, opted out, or sent a broadcast within the gap (gap_days, 0 when the owner turned the gap off in the consent settings). known_share: the share that already chatted with this device, measured on the first 2 000. Nothing is saved.

Path parameters

  • sessionIdstringrequired

Request body

  • chat_idsarray of stringrequired
    Up to 50 000 items

Responses

  • 200Check
    Response fields
    • totalintegerrequired
    • blockedarray of stringrequired
    • opted_outarray of stringrequired
    • recently_broadcastarray of stringrequired
    • gap_daysintegerrequired
    • known_sharenumberrequired
  • 400Validation error
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/check-recipients" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_ids": [
    "+447700900123"
  ]
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/check-recipients', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "chat_ids": [
      "+447700900123"
    ]
  }),
});
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/blasts/check-recipients",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "chat_ids": [
            "+447700900123",
        ],
    },
    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/blasts/check-recipients', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'chat_ids' => [
            '+447700900123',
        ],
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	body := strings.NewReader(`{
	  "chat_ids": [
	    "+447700900123"
	  ]
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/check-recipients", 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))
}
Response 200
{
  "total": 12,
  "blocked": [
    "string"
  ],
  "opted_out": [
    "string"
  ],
  "recently_broadcast": [
    "string"
  ],
  "gap_days": 1,
  "known_share": 0.5
}

Send a test of a broadcast to your own number

POST/v1/sessions/{sessionId}/blasts/test

Sends a test of the broadcast to the device's own number, so you see it as a recipient would: the placeholders are filled with the first recipient's data and, when optout_footer is on, the "Reply STOP" line is added. Same body as creating a campaign; nothing is saved and the test does not count against the new-contact limit. Text, image, video and document broadcasts; at most 10 tests an hour per device.

Path parameters

  • sessionIdstringrequired

Request body

  • namestringrequired
    Campaign name (internal)
    Up to 200 characters
  • message_typestring
    One of: text, image, video, document, audioDefault: "text"
  • bodystring
    Message text. Personalization tokens: {name}, {first_name}, {phone}, {var1}…{var5}, {attr.<key>}; add a fallback with double braces: {{first_name|there}}, {{attr.plan|your plan}}. A token without a value and without a fallback becomes empty.
    Up to 65 536 characters
  • media_r2_keystring
    Media key from /v1/media/upload-url (for image/video/document/audio)
  • captionstring
    Up to 1 024 characters
  • footerstring
    Up to 200 characters
  • buttonsany
    Optional button configuration
  • delay_configobject
    Pause between recipients. Default 3 000–10 000 ms with 1 000–3 000 ms of simulated typing, and short breaks.
  • delay_config.min_msintegerrequired
  • delay_config.max_msintegerrequired
  • delay_config.typing_min_msintegerrequired
  • delay_config.typing_max_msintegerrequired
  • delay_config.restboolean
    Short breaks (default true): after every 40-60 messages a device pauses 10-20 minutes
  • extra_session_idsarray of string
    More devices of the same business to send from (up to 5 devices in all). Each device keeps its own pace and limits; people who already chatted with one of them get the message from that device; a device that disconnects hands its recipients to the others.
    Up to 4 items
  • simulate_typingboolean
    Show "typing…" before each message (default true)
  • recipientsarray of object
    Explicit recipients. Combined (deduplicated) with the CRM audience below.
    Up to 50 000 items
  • recipients[].chat_idstringrequired
    Phone number (+<country code><number>; local numbers use the business country) or JID
  • recipients[].namestring
    Up to 200 characters
  • recipients[].varsarray of string
    Values for {var1}…{var5}
    Up to 5 items
  • recipients[].attrsobject
    Per-recipient values for {attr.<key>}
  • segment_idstring
    Add every contact of this saved segment
  • group_idstring
    Add every contact of this contact group
  • tagstring
    Add every contact carrying this tag
  • consent_attestedboolean
    Confirms the recipients agreed to receive these messages. Required (here or when starting) if the tenant turned on require_attestation.
  • abobject
    A/B test: a random test share gets message A (body) or B; after wait_hours the variant with the higher reply rate (ties: A) goes to everyone else. See /results and /ab/decide.
  • ab.bodystring
    Message B (required for text broadcasts)
    Up to 65 536 characters
  • ab.captionstring
    Caption B (media broadcasts; body B may also be given)
    Up to 1 024 characters
  • ab.test_percentinteger
    Share of the recipients in the test, split evenly between A and B (default 20); the test needs at least 20 recipients
    From 10 to 50
  • ab.wait_hoursinteger
    Hours to wait for replies after the test share is sent (default 4)
    From 1 to 48

Responses

  • 200Sent
    Response fields
    • okbooleanrequired
    • statusstringrequired
      One of: sent, queued
    • chat_idstringrequired
      The device's own number
  • 400Validation error
  • 409Device not connected, or it has no phone number yet
  • 429More than 10 tests in an hour
  • 502The message could not be sent
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/test" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Example",
  "message_type": "text",
  "body": "Hi Sam, your order has shipped."
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/test', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "Example",
    "message_type": "text",
    "body": "Hi Sam, your order 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/blasts/test",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "name": "Example",
        "message_type": "text",
        "body": "Hi Sam, your order 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/blasts/test', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'name' => 'Example',
        'message_type' => 'text',
        'body' => 'Hi Sam, your order has shipped.',
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	body := strings.NewReader(`{
	  "name": "Example",
	  "message_type": "text",
	  "body": "Hi Sam, your order has shipped."
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/test", 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))
}
Response 200
{
  "ok": true,
  "status": "sent",
  "chat_id": "+447700900123"
}

List the campaigns of a device

GET/v1/sessions/{sessionId}/blasts

List the campaigns of a session, newest first.

Path parameters

  • sessionIdstringrequired

Responses

  • 200Campaigns
    Response fields
    • campaignsarray of objectrequired
    • campaigns[].idstringrequired
      ULID (26 characters)
    • campaigns[].session_idstringrequired
    • campaigns[].namestringrequired
    • campaigns[].statusstringrequired
      testing: an A/B test share is sent and the campaign waits for replies before sending the winner
      One of: draft, running, testing, paused, completed, failed, cancelled
    • campaigns[].bodystring | nullrequired
    • campaigns[].message_typestringrequired
    • campaigns[].total_recipientsintegerrequired
    • campaigns[].sent_countintegerrequired
    • campaigns[].failed_countintegerrequired
    • campaigns[].created_atintegerrequired
    • campaigns[].started_atinteger | nullrequired
    • campaigns[].completed_atinteger | nullrequired
    • campaigns[].consent_attested_atinteger | nullrequired
      When the sender confirmed the recipients agreed to be messaged (consent_attested), if ever
    • campaigns[].abstring | null
      A/B test as JSON: body/caption of message B, test_percent, wait_hours, phase (test or decided), winner
    • campaigns[].extra_sessionsstring | null
      JSON array of the extra sending devices (extra_session_ids), or null
    • campaigns[].paused_reasonstring | null
      Why the campaign paused by itself: all its devices disconnected; number_banned = WhatsApp banned one of the business's numbers, so every broadcast of the business stopped; number_restricted = WhatsApp started limiting the sending number (rate limit or restriction), so it stops messaging new contacts for 24 hours and its broadcast pauses; low_delivery = fewer than 35 % of the messages sent over 90 minutes ago reached the phones (at least 40 of them): WhatsApp may be limiting the number quietly; low_replies = fewer than 1 % of at least 100 people who never wrote before answered after 6 hours (resuming switches this check off for the broadcast); complaints = recipients of this broadcast blocked the number, opted out or replied like "who is this?" / "spam" (3 % of the messages sent, at least 5 people, after 30 sent); failures = a quarter of the sends failed (after 30). Starting it again resumes and counts afresh. Null when paused by hand or running
      One of: session_disconnected, complaints, failures, number_banned, number_restricted, low_delivery, low_replies
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	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))
}
Response 200
{
  "campaigns": [
    {
      "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
      "session_id": "YOUR_DEVICE_ID",
      "name": "Example",
      "status": "draft",
      "body": "Hi Sam, your order has shipped.",
      "message_type": "Hi Sam, your order has shipped.",
      "total_recipients": 12,
      "sent_count": 12,
      "failed_count": 12,
      "created_at": 1767225600000,
      "started_at": 1767225600000,
      "completed_at": 1767225600000,
      "consent_attested_at": 1767225600000,
      "ab": "string",
      "extra_sessions": "string",
      "paused_reason": "session_disconnected"
    }
  ]
}

Create a campaign

POST/v1/sessions/{sessionId}/blasts

Create a blast campaign (status draft). The audience is the explicit recipients plus the contacts matched by segment_id, group_id and/or tag (CRM filters combine with AND), deduplicated, max 50 000. Nothing is sent until /start. The server applies anti-ban pacing and per-country warm-up; people who already chatted with the sending device(s) go first; numbers that are not on WhatsApp are skipped before their turn (error: not_on_whatsapp); recipients who opted out are skipped automatically just before sending, and bulk sends are only released inside the tenant's send window (see send_window in /v1/settings/send_window).

Path parameters

  • sessionIdstringrequired

Request body

  • namestringrequired
    Campaign name (internal)
    Up to 200 characters
  • message_typestring
    One of: text, image, video, document, audioDefault: "text"
  • bodystring
    Message text. Personalization tokens: {name}, {first_name}, {phone}, {var1}…{var5}, {attr.<key>}; add a fallback with double braces: {{first_name|there}}, {{attr.plan|your plan}}. A token without a value and without a fallback becomes empty.
    Up to 65 536 characters
  • media_r2_keystring
    Media key from /v1/media/upload-url (for image/video/document/audio)
  • captionstring
    Up to 1 024 characters
  • footerstring
    Up to 200 characters
  • buttonsany
    Optional button configuration
  • delay_configobject
    Pause between recipients. Default 3 000–10 000 ms with 1 000–3 000 ms of simulated typing, and short breaks.
  • delay_config.min_msintegerrequired
  • delay_config.max_msintegerrequired
  • delay_config.typing_min_msintegerrequired
  • delay_config.typing_max_msintegerrequired
  • delay_config.restboolean
    Short breaks (default true): after every 40-60 messages a device pauses 10-20 minutes
  • extra_session_idsarray of string
    More devices of the same business to send from (up to 5 devices in all). Each device keeps its own pace and limits; people who already chatted with one of them get the message from that device; a device that disconnects hands its recipients to the others.
    Up to 4 items
  • simulate_typingboolean
    Show "typing…" before each message (default true)
  • recipientsarray of object
    Explicit recipients. Combined (deduplicated) with the CRM audience below.
    Up to 50 000 items
  • recipients[].chat_idstringrequired
    Phone number (+<country code><number>; local numbers use the business country) or JID
  • recipients[].namestring
    Up to 200 characters
  • recipients[].varsarray of string
    Values for {var1}…{var5}
    Up to 5 items
  • recipients[].attrsobject
    Per-recipient values for {attr.<key>}
  • segment_idstring
    Add every contact of this saved segment
  • group_idstring
    Add every contact of this contact group
  • tagstring
    Add every contact carrying this tag
  • consent_attestedboolean
    Confirms the recipients agreed to receive these messages. Required (here or when starting) if the tenant turned on require_attestation.
  • abobject
    A/B test: a random test share gets message A (body) or B; after wait_hours the variant with the higher reply rate (ties: A) goes to everyone else. See /results and /ab/decide.
  • ab.bodystring
    Message B (required for text broadcasts)
    Up to 65 536 characters
  • ab.captionstring
    Caption B (media broadcasts; body B may also be given)
    Up to 1 024 characters
  • ab.test_percentinteger
    Share of the recipients in the test, split evenly between A and B (default 20); the test needs at least 20 recipients
    From 10 to 50
  • ab.wait_hoursinteger
    Hours to wait for replies after the test share is sent (default 4)
    From 1 to 48

Responses

  • 201Draft created, with its risk (see /blasts/risk)
    Response fields
    • idstringrequired
      ULID (26 characters)
    • statusstringrequired
      One of: draft
    • total_recipientsintegerrequired
    • riskobjectrequired
    • risk.scoreintegerrequired
      0-100
    • risk.levelstringrequired
      high (60+) needs accept_risk: true to start
      One of: low, medium, high
    • risk.factorsarray of objectrequired
      Highest first
    • risk.factors[].idstringrequired
      One of: new_contacts, young_number, volume, failures, complaints, shortener, link, spam_words, caps, punctuation, identical, media_only, unsafe_link
    • risk.factors[].pointsintegerrequired
    • risk.factors[].paramsobjectrequired
      Numbers in the message, for translations
    • risk.factors[].messagestringrequired
    • risk.factors[].tipstringrequired
    • risk.statsobjectrequired
    • risk.stats.recipientsintegerrequired
    • risk.stats.new_contactsintegerrequired
      Recipients this number never had a chat with (estimated from a sample above 5 000)
    • risk.stats.new_contact_sharenumberrequired
    • risk.stats.spread_daysintegerrequired
      Days the new contacts are spread over by the number's daily limit
    • abobject
    • ab.test_percentintegerrequired
    • ab.wait_hoursintegerrequired
  • 400Validation error
  • 403On the Free plan: a message type or feature the plan does not include, or a link in the text (FREE_PLAN_RESTRICTED)
  • 404Segment or group not found
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "October promo",
  "body": "Hi {{first_name|there}}, 20% off everything this week!",
  "recipients": [
    {
      "chat_id": "+447700900123",
      "name": "Sam Carter",
      "attrs": {
        "plan": "Pro"
      }
    },
    {
      "chat_id": "+12025550123",
      "name": "Alex Kim"
    }
  ]
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "October promo",
    "body": "Hi {{first_name|there}}, 20% off everything this week!",
    "recipients": [
      {
        "chat_id": "+447700900123",
        "name": "Sam Carter",
        "attrs": {
          "plan": "Pro"
        }
      },
      {
        "chat_id": "+12025550123",
        "name": "Alex Kim"
      }
    ]
  }),
});
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/blasts",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "name": "October promo",
        "body": "Hi {{first_name|there}}, 20% off everything this week!",
        "recipients": [
            {
                "chat_id": "+447700900123",
                "name": "Sam Carter",
                "attrs": {
                    "plan": "Pro",
                },
            },
            {
                "chat_id": "+12025550123",
                "name": "Alex Kim",
            },
        ],
    },
    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/blasts', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'name' => 'October promo',
        'body' => 'Hi {{first_name|there}}, 20% off everything this week!',
        'recipients' => [
            [
                'chat_id' => '+447700900123',
                'name' => 'Sam Carter',
                'attrs' => [
                    'plan' => 'Pro',
                ],
            ],
            [
                'chat_id' => '+12025550123',
                'name' => 'Alex Kim',
            ],
        ],
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	body := strings.NewReader(`{
	  "name": "October promo",
	  "body": "Hi {{first_name|there}}, 20% off everything this week!",
	  "recipients": [
	    {
	      "chat_id": "+447700900123",
	      "name": "Sam Carter",
	      "attrs": {
	        "plan": "Pro"
	      }
	    },
	    {
	      "chat_id": "+12025550123",
	      "name": "Alex Kim"
	    }
	  ]
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts", 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))
}
Response 201
{
  "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "status": "draft",
  "total_recipients": 12,
  "risk": {
    "score": 1,
    "level": "low",
    "factors": [
      {
        "id": "new_contacts",
        "points": 1,
        "params": {},
        "message": "Hi Sam, your order has shipped.",
        "tip": "string"
      }
    ],
    "stats": {
      "recipients": 1,
      "new_contacts": 1,
      "new_contact_share": 0.5,
      "spread_days": 1
    }
  },
  "ab": {
    "test_percent": 1,
    "wait_hours": 1
  }
}

Get a campaign and its progress

GET/v1/sessions/{sessionId}/blasts/{campaignId}

Campaign detail with per-recipient status and progress counters. skipped_count counts recipients removed because they opted out or are not on WhatsApp. Without limit every recipient is returned; pass limit to page through large campaigns (the counters always cover the whole campaign).

Path parameters

  • sessionIdstringrequired
  • campaignIdstringrequired

Query parameters

  • limitinteger
    Page size (1-1000). Turns paging on.
    From 1 to 1 000
  • offsetinteger | null
    Recipients to skip, from next_offset of the previous page
  • statusstring
    Only recipients with this status (pending includes processing). Paging only.
    One of: pending, sent, failed, skipped, held, cancelled
  • qstring
    Search the number or name. Paging only.
    Up to 64 characters

Responses

  • 200Campaign
    Response fields
    • campaignobjectrequired
    • campaign.idstringrequired
      ULID (26 characters)
    • campaign.session_idstringrequired
    • campaign.namestringrequired
    • campaign.statusstringrequired
      testing: an A/B test share is sent and the campaign waits for replies before sending the winner
      One of: draft, running, testing, paused, completed, failed, cancelled
    • campaign.bodystring | nullrequired
    • campaign.message_typestringrequired
    • campaign.total_recipientsintegerrequired
    • campaign.sent_countintegerrequired
    • campaign.failed_countintegerrequired
    • campaign.created_atintegerrequired
    • campaign.started_atinteger | nullrequired
    • campaign.completed_atinteger | nullrequired
    • campaign.consent_attested_atinteger | nullrequired
      When the sender confirmed the recipients agreed to be messaged (consent_attested), if ever
    • campaign.abstring | null
      A/B test as JSON: body/caption of message B, test_percent, wait_hours, phase (test or decided), winner
    • campaign.extra_sessionsstring | null
      JSON array of the extra sending devices (extra_session_ids), or null
    • campaign.paused_reasonstring | null
      Why the campaign paused by itself: all its devices disconnected; number_banned = WhatsApp banned one of the business's numbers, so every broadcast of the business stopped; number_restricted = WhatsApp started limiting the sending number (rate limit or restriction), so it stops messaging new contacts for 24 hours and its broadcast pauses; low_delivery = fewer than 35 % of the messages sent over 90 minutes ago reached the phones (at least 40 of them): WhatsApp may be limiting the number quietly; low_replies = fewer than 1 % of at least 100 people who never wrote before answered after 6 hours (resuming switches this check off for the broadcast); complaints = recipients of this broadcast blocked the number, opted out or replied like "who is this?" / "spam" (3 % of the messages sent, at least 5 people, after 30 sent); failures = a quarter of the sends failed (after 30). Starting it again resumes and counts afresh. Null when paused by hand or running
      One of: session_disconnected, complaints, failures, number_banned, number_restricted, low_delivery, low_replies
    • recipientsarray of objectrequired
    • recipients[].idstringrequired
    • recipients[].chat_idstringrequired
    • recipients[].namestring | nullrequired
    • recipients[].statusstringrequired
      pending, processing, sent, failed, skipped (error opted_out or not_on_whatsapp), cancelled or held (waiting for the A/B winner)
    • recipients[].variantstring | null
      A/B test variant
      One of: A, B
    • recipients[].errorstring | nullrequired
    • recipients[].session_idstring | null
      Device it was (or will be) sent from; null = any device of the campaign
    • recipients[].priorityinteger
      1 = already chatted with a sending device (goes first)
    • pending_countintegerrequired
    • sent_countintegerrequired
    • failed_countintegerrequired
    • skipped_countintegerrequired
    • held_countintegerrequired
      Recipients waiting for the A/B winner
    • recipients_totalinteger
      With limit: recipients matching the filter
    • next_offsetinteger | null
      With limit: offset of the next page, or null on the last page
  • 404Campaign not found
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	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))
}
Response 200
{
  "campaign": {
    "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
    "session_id": "YOUR_DEVICE_ID",
    "name": "Example",
    "status": "draft",
    "body": "Hi Sam, your order has shipped.",
    "message_type": "Hi Sam, your order has shipped.",
    "total_recipients": 12,
    "sent_count": 12,
    "failed_count": 12,
    "created_at": 1767225600000,
    "started_at": 1767225600000,
    "completed_at": 1767225600000,
    "consent_attested_at": 1767225600000,
    "ab": "string",
    "extra_sessions": "string",
    "paused_reason": "session_disconnected"
  },
  "recipients": [
    {
      "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
      "chat_id": "+447700900123",
      "name": "Example",
      "status": "active",
      "variant": "A",
      "error": "string",
      "session_id": "YOUR_DEVICE_ID",
      "priority": 1
    }
  ],
  "pending_count": 12,
  "sent_count": 12,
  "failed_count": 12,
  "skipped_count": 12,
  "held_count": 12,
  "recipients_total": 12,
  "next_offset": 1
}

Delete a campaign

DEL/v1/sessions/{sessionId}/blasts/{campaignId}

Deletes the campaign and all its recipient rows, whatever its status. Messages that were already sent stay in the message history.

Path parameters

  • sessionIdstringrequired
    Session (device) id
  • campaignIdstringrequired
    Campaign id

Responses

  • 200Deleted
    Response fields
    • okbooleanrequired
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins
  • 404Campaign not found (NOT_FOUND); unknown session, or a session of another tenant
Request
curl -X DELETE "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.delete(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('DELETE', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	req, err := http.NewRequest("DELETE", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	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))
}
Response 200
{
  "ok": true
}

Start or resume a campaign

POST/v1/sessions/{sessionId}/blasts/{campaignId}/start

Start or resume a campaign. If the tenant turned on require_attestation (consent config) and the campaign was not attested at creation, the body must contain {"consent_attested": true}, otherwise the call fails with 400 CONSENT_ATTESTATION_REQUIRED. Opted-out recipients are removed (status skipped) before the first message. The risk is checked again on the remaining recipients: a high risk answers 409 BLAST_RISK_HIGH (with risk) until the call is repeated with accept_risk: true (recorded as blast.risk_accepted, asked once per campaign). A link that Google Safe Browsing lists as unsafe (when the platform has a key) answers 409 BLAST_LINK_UNSAFE with unsafe_links, and accept_risk does not override it. New contacts beyond the number's daily limit are sent on the following days automatically.

Path parameters

  • sessionIdstringrequired
  • campaignIdstringrequired

Request body

  • consent_attestedboolean
  • accept_riskboolean
    Start even though the risk is high

Responses

  • 200Started
    Response fields
    • okbooleanrequired
    • statusstringrequired
      One of: running
  • 400CONSENT_ATTESTATION_REQUIRED
  • 404Campaign not found
  • 409BLAST_RISK_HIGH: the body also has risk (see /blasts/risk); or BLAST_LINK_UNSAFE: the body also has unsafe_links
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/start" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "consent_attested": true
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/start', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "consent_attested": true
  }),
});
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/blasts/CAMPAIGN_ID/start",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "consent_attested": True,
    },
    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/blasts/CAMPAIGN_ID/start', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'consent_attested' => true,
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	body := strings.NewReader(`{
	  "consent_attested": true
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/start", 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))
}
Response 200
{
  "ok": true,
  "status": "running"
}

Get what a broadcast brought in

GET/v1/sessions/{sessionId}/blasts/{campaignId}/results

Of the recipients the campaign reached: replies, leads won and QRIS invoices paid within days (default 7) of each recipient's message. A customer reached by two broadcasts in that time counts for both. For an A/B test also the counts per variant, the phase and the winner.

Path parameters

  • sessionIdstringrequired
  • campaignIdstringrequired

Query parameters

  • daysinteger
    From 1 to 30

Responses

  • 200Results
    Response fields
    • sentintegerrequired
    • repliedintegerrequired
      Recipients who wrote back within the window
    • reply_ratenumberrequired
      Percent, one decimal
    • wonintegerrequired
      Leads that moved to won within the window (contacts by phone)
    • deal_valueintegerrequired
      Sum of their deal values, in currency
    • paidintegerrequired
      QRIS invoices of these chats paid within the window (sandbox excluded)
    • paid_amountintegerrequired
      Without the provider fee, in invoice_currency
    • window_daysintegerrequired
    • currencystringrequired
      Currency of deal values
    • invoice_currencystringrequired
      One of: IDR
    • abobject | nullrequired
    • ab.phasestringrequired
      One of: test, decided
    • ab.test_percentintegerrequired
    • ab.wait_hoursintegerrequired
    • ab.winnerstring | nullrequired
      One of: A, B
    • ab.decided_atinteger | nullrequired
    • ab.decided_bystring | nullrequired
      One of: auto, owner
    • ab.decides_atinteger | nullrequired
      When the winner is picked automatically
    • ab.heldintegerrequired
    • ab.aobjectrequired
    • ab.a.sentintegerrequired
    • ab.a.repliedintegerrequired
      Recipients who wrote back within the window
    • ab.a.reply_ratenumberrequired
      Percent, one decimal
    • ab.a.wonintegerrequired
      Leads that moved to won within the window (contacts by phone)
    • ab.a.deal_valueintegerrequired
      Sum of their deal values, in currency
    • ab.a.paidintegerrequired
      QRIS invoices of these chats paid within the window (sandbox excluded)
    • ab.a.paid_amountintegerrequired
      Without the provider fee, in invoice_currency
    • ab.bobjectrequired
    • ab.b.sentintegerrequired
    • ab.b.repliedintegerrequired
      Recipients who wrote back within the window
    • ab.b.reply_ratenumberrequired
      Percent, one decimal
    • ab.b.wonintegerrequired
      Leads that moved to won within the window (contacts by phone)
    • ab.b.deal_valueintegerrequired
      Sum of their deal values, in currency
    • ab.b.paidintegerrequired
      QRIS invoices of these chats paid within the window (sandbox excluded)
    • ab.b.paid_amountintegerrequired
      Without the provider fee, in invoice_currency
  • 400Validation error
  • 404Campaign not found
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/results" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/results', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/results",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/results', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/results", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	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))
}
Response 200
{
  "sent": 12,
  "replied": 1,
  "reply_rate": 0.5,
  "won": 1,
  "deal_value": 1,
  "paid": 1,
  "paid_amount": 150000,
  "window_days": 1,
  "currency": "IDR",
  "invoice_currency": "IDR",
  "ab": {
    "phase": "test",
    "test_percent": 1,
    "wait_hours": 1,
    "winner": "A",
    "decided_at": 1767225600000,
    "decided_by": "auto",
    "decides_at": 1767225600000,
    "held": 1,
    "a": {
      "sent": 12,
      "replied": 1,
      "reply_rate": 0.5,
      "won": 1,
      "deal_value": 1,
      "paid": 1,
      "paid_amount": 150000
    },
    "b": {
      "sent": 12,
      "replied": 1,
      "reply_rate": 0.5,
      "won": 1,
      "deal_value": 1,
      "paid": 1,
      "paid_amount": 150000
    }
  }
}

Send an A/B variant now

POST/v1/sessions/{sessionId}/blasts/{campaignId}/ab/decide

Ends the A/B wait: the given variant (or, without one, the higher reply rate so far; ties go to A) is sent to the held recipients. Recorded as blast.ab_decide.

Path parameters

  • sessionIdstringrequired
  • campaignIdstringrequired

Request body

  • variantstring
    One of: A, B

Responses

  • 200Decided
    Response fields
    • okbooleanrequired
    • winnerstringrequired
      One of: A, B
  • 400Validation error
  • 404Campaign not found
  • 409No A/B test waiting for a decision
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/ab/decide" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "variant": "A"
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/ab/decide', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "variant": "A"
  }),
});
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/blasts/CAMPAIGN_ID/ab/decide",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "variant": "A",
    },
    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/blasts/CAMPAIGN_ID/ab/decide', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'variant' => 'A',
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	body := strings.NewReader(`{
	  "variant": "A"
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/ab/decide", 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))
}
Response 200
{
  "ok": true,
  "winner": "A"
}

Pause a campaign

POST/v1/sessions/{sessionId}/blasts/{campaignId}/pause

Pause a running campaign (resume with /start).

Path parameters

  • sessionIdstringrequired
  • campaignIdstringrequired

Responses

  • 200Updated
    Response fields
    • okbooleanrequired
    • statusstringrequired
  • 404Campaign not found
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/pause" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/pause', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
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/blasts/CAMPAIGN_ID/pause",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    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/blasts/CAMPAIGN_ID/pause', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/pause", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	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))
}
Response 200
{
  "ok": true,
  "status": "active"
}

Cancel a campaign

POST/v1/sessions/{sessionId}/blasts/{campaignId}/cancel

Cancel a campaign; recipients that were still pending are cancelled.

Path parameters

  • sessionIdstringrequired
  • campaignIdstringrequired

Responses

  • 200Updated
    Response fields
    • okbooleanrequired
    • statusstringrequired
  • 404Campaign not found
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/cancel" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/cancel', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
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/blasts/CAMPAIGN_ID/cancel",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    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/blasts/CAMPAIGN_ID/cancel', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/blasts/CAMPAIGN_ID/cancel", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	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))
}
Response 200
{
  "ok": true,
  "status": "active"
}

List blast campaigns of all devices

GET/v1/blasts

Every blast campaign of the tenant across devices, newest first, without pagination. Campaigns are created per device with POST /v1/sessions/{sessionId}/blasts.

Responses

  • 200Campaigns
    Response fields
    • campaignsarray of objectrequired
    • campaigns[].idstringrequired
    • campaigns[].session_idstringrequired
    • campaigns[].api_key_idstringrequired
      Owning tenant
    • campaigns[].namestringrequired
    • campaigns[].statusstringrequired
      draft, running, paused, completed, failed or cancelled
    • campaigns[].message_typestringrequired
    • campaigns[].bodystring | nullrequired
    • campaigns[].total_recipientsinteger | nullrequired
    • campaigns[].sent_countinteger | nullrequired
    • campaigns[].failed_countinteger | nullrequired
    • campaigns[].skipped_countinteger | nullrequired
      Recipients skipped, e.g. because they opted out
    • campaigns[].created_atintegerrequired
      Unix time in milliseconds
    • campaigns[].started_atinteger | nullrequired
      Unix time in milliseconds, or null
    • campaigns[].completed_atinteger | nullrequired
      Unix time in milliseconds, or null
    • campaigns[].consent_attested_atinteger | nullrequired
      When the sender attested consent, or null
  • 401Missing, invalid or expired credentials
Request
curl "https://api.chatkomodo.com/v1/blasts" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/blasts', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/blasts",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/blasts', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

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

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/blasts", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	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))
}
Response 200
{
  "campaigns": [
    {
      "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
      "session_id": "YOUR_DEVICE_ID",
      "api_key_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
      "name": "Example",
      "status": "active",
      "message_type": "Hi Sam, your order has shipped.",
      "body": "Hi Sam, your order has shipped.",
      "total_recipients": 12,
      "sent_count": 12,
      "failed_count": 12,
      "skipped_count": 12,
      "created_at": 1767225600000,
      "started_at": 1767225600000,
      "completed_at": 1767225600000,
      "consent_attested_at": 1767225600000
    }
  ]
}