. Create an API key under API keys.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
/v1/sessions/{sessionId}/blasts/riskHow 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
namestringrequiredCampaign name (internal)message_typestringbodystringMessage 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.media_r2_keystringMedia key from /v1/media/upload-url (for image/video/document/audio)captionstringfooterstringbuttonsanyOptional button configurationdelay_configobjectPause between recipients. Default 3 000–10 000 ms with 1 000–3 000 ms of simulated typing, and short breaks.delay_config.min_msintegerrequireddelay_config.max_msintegerrequireddelay_config.typing_min_msintegerrequireddelay_config.typing_max_msintegerrequireddelay_config.restbooleanShort breaks (default true): after every 40-60 messages a device pauses 10-20 minutesextra_session_idsarray of stringMore 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.simulate_typingbooleanShow "typing…" before each message (default true)recipientsarray of objectExplicit recipients. Combined (deduplicated) with the CRM audience below.recipients[].chat_idstringrequiredPhone number (+<country code><number>; local numbers use the business country) or JIDrecipients[].namestringrecipients[].varsarray of stringValues for{var1}…{var5}recipients[].attrsobjectPer-recipient values for{attr.<key>}segment_idstringAdd every contact of this saved segmentgroup_idstringAdd every contact of this contact grouptagstringAdd every contact carrying this tagconsent_attestedbooleanConfirms the recipients agreed to receive these messages. Required (here or when starting) if the tenant turned onrequire_attestation.abobjectA/B test: a random test share gets message A (body) or B; afterwait_hoursthe variant with the higher reply rate (ties: A) goes to everyone else. See/resultsand/ab/decide.ab.bodystringMessage B (required for text broadcasts)ab.captionstringCaption B (media broadcasts; body B may also be given)ab.test_percentintegerShare of the recipients in the test, split evenly between A and B (default 20); the test needs at least 20 recipientsab.wait_hoursintegerHours to wait for replies after the test share is sent (default 4)
Responses
- 200Risk
Response fields
scoreintegerrequired0-100levelstringrequiredhigh(60+) needsaccept_risk: trueto startfactorsarray of objectrequiredHighest firstfactors[].idstringrequiredfactors[].pointsintegerrequiredfactors[].paramsobjectrequiredNumbers in the message, for translationsfactors[].messagestringrequiredfactors[].tipstringrequiredstatsobjectrequiredstats.recipientsintegerrequiredstats.new_contactsintegerrequiredRecipients this number never had a chat with (estimated from a sample above 5 000)stats.new_contact_sharenumberrequiredstats.spread_daysintegerrequiredDays the new contacts are spread over by the number's daily limit
- 400Validation error
- 404Segment or group not found
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))
}{
"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
/v1/sessions/{sessionId}/blasts/check-recipientsWhich 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
Responses
- 200Check
Response fields
totalintegerrequiredblockedarray of stringrequiredopted_outarray of stringrequiredrecently_broadcastarray of stringrequiredgap_daysintegerrequiredknown_sharenumberrequired
- 400Validation error
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))
}{
"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
/v1/sessions/{sessionId}/blasts/testSends 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
namestringrequiredCampaign name (internal)message_typestringbodystringMessage 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.media_r2_keystringMedia key from /v1/media/upload-url (for image/video/document/audio)captionstringfooterstringbuttonsanyOptional button configurationdelay_configobjectPause between recipients. Default 3 000–10 000 ms with 1 000–3 000 ms of simulated typing, and short breaks.delay_config.min_msintegerrequireddelay_config.max_msintegerrequireddelay_config.typing_min_msintegerrequireddelay_config.typing_max_msintegerrequireddelay_config.restbooleanShort breaks (default true): after every 40-60 messages a device pauses 10-20 minutesextra_session_idsarray of stringMore 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.simulate_typingbooleanShow "typing…" before each message (default true)recipientsarray of objectExplicit recipients. Combined (deduplicated) with the CRM audience below.recipients[].chat_idstringrequiredPhone number (+<country code><number>; local numbers use the business country) or JIDrecipients[].namestringrecipients[].varsarray of stringValues for{var1}…{var5}recipients[].attrsobjectPer-recipient values for{attr.<key>}segment_idstringAdd every contact of this saved segmentgroup_idstringAdd every contact of this contact grouptagstringAdd every contact carrying this tagconsent_attestedbooleanConfirms the recipients agreed to receive these messages. Required (here or when starting) if the tenant turned onrequire_attestation.abobjectA/B test: a random test share gets message A (body) or B; afterwait_hoursthe variant with the higher reply rate (ties: A) goes to everyone else. See/resultsand/ab/decide.ab.bodystringMessage B (required for text broadcasts)ab.captionstringCaption B (media broadcasts; body B may also be given)ab.test_percentintegerShare of the recipients in the test, split evenly between A and B (default 20); the test needs at least 20 recipientsab.wait_hoursintegerHours to wait for replies after the test share is sent (default 4)
Responses
- 200Sent
Response fields
okbooleanrequiredstatusstringrequiredchat_idstringrequiredThe 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
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))
}{
"ok": true,
"status": "sent",
"chat_id": "+447700900123"
}List the campaigns of a device
/v1/sessions/{sessionId}/blastsList the campaigns of a session, newest first.
Path parameters
sessionIdstringrequired
Responses
- 200Campaigns
Response fields
campaignsarray of objectrequiredcampaigns[].idstringrequiredcampaigns[].session_idstringrequiredcampaigns[].namestringrequiredcampaigns[].statusstringrequiredtesting: an A/B test share is sent and the campaign waits for replies before sending the winnercampaigns[].bodystring | nullrequiredcampaigns[].message_typestringrequiredcampaigns[].total_recipientsintegerrequiredcampaigns[].sent_countintegerrequiredcampaigns[].failed_countintegerrequiredcampaigns[].created_atintegerrequiredcampaigns[].started_atinteger | nullrequiredcampaigns[].completed_atinteger | nullrequiredcampaigns[].consent_attested_atinteger | nullrequiredWhen the sender confirmed the recipients agreed to be messaged (consent_attested), if evercampaigns[].abstring | nullA/B test as JSON:body/captionof message B,test_percent,wait_hours,phase(testordecided),winnercampaigns[].extra_sessionsstring | nullJSON array of the extra sending devices (extra_session_ids), or nullcampaigns[].paused_reasonstring | nullWhy 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
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))
}{
"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
/v1/sessions/{sessionId}/blastsCreate 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
namestringrequiredCampaign name (internal)message_typestringbodystringMessage 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.media_r2_keystringMedia key from /v1/media/upload-url (for image/video/document/audio)captionstringfooterstringbuttonsanyOptional button configurationdelay_configobjectPause between recipients. Default 3 000–10 000 ms with 1 000–3 000 ms of simulated typing, and short breaks.delay_config.min_msintegerrequireddelay_config.max_msintegerrequireddelay_config.typing_min_msintegerrequireddelay_config.typing_max_msintegerrequireddelay_config.restbooleanShort breaks (default true): after every 40-60 messages a device pauses 10-20 minutesextra_session_idsarray of stringMore 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.simulate_typingbooleanShow "typing…" before each message (default true)recipientsarray of objectExplicit recipients. Combined (deduplicated) with the CRM audience below.recipients[].chat_idstringrequiredPhone number (+<country code><number>; local numbers use the business country) or JIDrecipients[].namestringrecipients[].varsarray of stringValues for{var1}…{var5}recipients[].attrsobjectPer-recipient values for{attr.<key>}segment_idstringAdd every contact of this saved segmentgroup_idstringAdd every contact of this contact grouptagstringAdd every contact carrying this tagconsent_attestedbooleanConfirms the recipients agreed to receive these messages. Required (here or when starting) if the tenant turned onrequire_attestation.abobjectA/B test: a random test share gets message A (body) or B; afterwait_hoursthe variant with the higher reply rate (ties: A) goes to everyone else. See/resultsand/ab/decide.ab.bodystringMessage B (required for text broadcasts)ab.captionstringCaption B (media broadcasts; body B may also be given)ab.test_percentintegerShare of the recipients in the test, split evenly between A and B (default 20); the test needs at least 20 recipientsab.wait_hoursintegerHours to wait for replies after the test share is sent (default 4)
Responses
- 201Draft created, with its risk (see
/blasts/risk)Response fields
idstringrequiredstatusstringrequiredtotal_recipientsintegerrequiredriskobjectrequiredrisk.scoreintegerrequired0-100risk.levelstringrequiredhigh(60+) needsaccept_risk: trueto startrisk.factorsarray of objectrequiredHighest firstrisk.factors[].idstringrequiredrisk.factors[].pointsintegerrequiredrisk.factors[].paramsobjectrequiredNumbers in the message, for translationsrisk.factors[].messagestringrequiredrisk.factors[].tipstringrequiredrisk.statsobjectrequiredrisk.stats.recipientsintegerrequiredrisk.stats.new_contactsintegerrequiredRecipients this number never had a chat with (estimated from a sample above 5 000)risk.stats.new_contact_sharenumberrequiredrisk.stats.spread_daysintegerrequiredDays the new contacts are spread over by the number's daily limitabobjectab.test_percentintegerrequiredab.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
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))
}{
"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
/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
sessionIdstringrequiredcampaignIdstringrequired
Query parameters
limitintegerPage size (1-1000). Turns paging on.offsetinteger | nullRecipients to skip, fromnext_offsetof the previous pagestatusstringOnly recipients with this status (pendingincludesprocessing). Paging only.qstringSearch the number or name. Paging only.
Responses
- 200Campaign
Response fields
campaignobjectrequiredcampaign.idstringrequiredcampaign.session_idstringrequiredcampaign.namestringrequiredcampaign.statusstringrequiredtesting: an A/B test share is sent and the campaign waits for replies before sending the winnercampaign.bodystring | nullrequiredcampaign.message_typestringrequiredcampaign.total_recipientsintegerrequiredcampaign.sent_countintegerrequiredcampaign.failed_countintegerrequiredcampaign.created_atintegerrequiredcampaign.started_atinteger | nullrequiredcampaign.completed_atinteger | nullrequiredcampaign.consent_attested_atinteger | nullrequiredWhen the sender confirmed the recipients agreed to be messaged (consent_attested), if evercampaign.abstring | nullA/B test as JSON:body/captionof message B,test_percent,wait_hours,phase(testordecided),winnercampaign.extra_sessionsstring | nullJSON array of the extra sending devices (extra_session_ids), or nullcampaign.paused_reasonstring | nullWhy 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 runningrecipientsarray of objectrequiredrecipients[].idstringrequiredrecipients[].chat_idstringrequiredrecipients[].namestring | nullrequiredrecipients[].statusstringrequiredpending,processing,sent,failed,skipped(erroropted_outornot_on_whatsapp),cancelledorheld(waiting for the A/B winner)recipients[].variantstring | nullA/B test variantrecipients[].errorstring | nullrequiredrecipients[].session_idstring | nullDevice it was (or will be) sent from; null = any device of the campaignrecipients[].priorityinteger1 = already chatted with a sending device (goes first)pending_countintegerrequiredsent_countintegerrequiredfailed_countintegerrequiredskipped_countintegerrequiredheld_countintegerrequiredRecipients waiting for the A/B winnerrecipients_totalintegerWithlimit: recipients matching the filternext_offsetinteger | nullWithlimit: offset of the next page, or null on the last page
- 404Campaign not found
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))
}{
"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
/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
sessionIdstringrequiredSession (device) idcampaignIdstringrequiredCampaign 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
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))
}{
"ok": true
}Start or resume a campaign
/v1/sessions/{sessionId}/blasts/{campaignId}/startStart 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
sessionIdstringrequiredcampaignIdstringrequired
Request body
consent_attestedbooleanaccept_riskbooleanStart even though the risk is high
Responses
- 200Started
Response fields
okbooleanrequiredstatusstringrequired
- 400
CONSENT_ATTESTATION_REQUIRED - 404Campaign not found
- 409
BLAST_RISK_HIGH: the body also hasrisk(see/blasts/risk); orBLAST_LINK_UNSAFE: the body also hasunsafe_links
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))
}{
"ok": true,
"status": "running"
}Get what a broadcast brought in
/v1/sessions/{sessionId}/blasts/{campaignId}/resultsOf 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
sessionIdstringrequiredcampaignIdstringrequired
Query parameters
daysinteger
Responses
- 200Results
Response fields
sentintegerrequiredrepliedintegerrequiredRecipients who wrote back within the windowreply_ratenumberrequiredPercent, one decimalwonintegerrequiredLeads that moved to won within the window (contacts by phone)deal_valueintegerrequiredSum of their deal values, incurrencypaidintegerrequiredQRIS invoices of these chats paid within the window (sandbox excluded)paid_amountintegerrequiredWithout the provider fee, ininvoice_currencywindow_daysintegerrequiredcurrencystringrequiredCurrency of deal valuesinvoice_currencystringrequiredabobject | nullrequiredab.phasestringrequiredab.test_percentintegerrequiredab.wait_hoursintegerrequiredab.winnerstring | nullrequiredab.decided_atinteger | nullrequiredab.decided_bystring | nullrequiredab.decides_atinteger | nullrequiredWhen the winner is picked automaticallyab.heldintegerrequiredab.aobjectrequiredab.a.sentintegerrequiredab.a.repliedintegerrequiredRecipients who wrote back within the windowab.a.reply_ratenumberrequiredPercent, one decimalab.a.wonintegerrequiredLeads that moved to won within the window (contacts by phone)ab.a.deal_valueintegerrequiredSum of their deal values, incurrencyab.a.paidintegerrequiredQRIS invoices of these chats paid within the window (sandbox excluded)ab.a.paid_amountintegerrequiredWithout the provider fee, ininvoice_currencyab.bobjectrequiredab.b.sentintegerrequiredab.b.repliedintegerrequiredRecipients who wrote back within the windowab.b.reply_ratenumberrequiredPercent, one decimalab.b.wonintegerrequiredLeads that moved to won within the window (contacts by phone)ab.b.deal_valueintegerrequiredSum of their deal values, incurrencyab.b.paidintegerrequiredQRIS invoices of these chats paid within the window (sandbox excluded)ab.b.paid_amountintegerrequiredWithout the provider fee, ininvoice_currency
- 400Validation error
- 404Campaign not found
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))
}{
"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
/v1/sessions/{sessionId}/blasts/{campaignId}/ab/decideEnds 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
sessionIdstringrequiredcampaignIdstringrequired
Request body
variantstring
Responses
- 200Decided
Response fields
okbooleanrequiredwinnerstringrequired
- 400Validation error
- 404Campaign not found
- 409No A/B test waiting for a decision
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))
}{
"ok": true,
"winner": "A"
}Pause a campaign
/v1/sessions/{sessionId}/blasts/{campaignId}/pausePause a running campaign (resume with /start).
Path parameters
sessionIdstringrequiredcampaignIdstringrequired
Responses
- 200Updated
Response fields
okbooleanrequiredstatusstringrequired
- 404Campaign not found
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))
}{
"ok": true,
"status": "active"
}Cancel a campaign
/v1/sessions/{sessionId}/blasts/{campaignId}/cancelCancel a campaign; recipients that were still pending are cancelled.
Path parameters
sessionIdstringrequiredcampaignIdstringrequired
Responses
- 200Updated
Response fields
okbooleanrequiredstatusstringrequired
- 404Campaign not found
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))
}{
"ok": true,
"status": "active"
}List blast campaigns of all devices
/v1/blastsEvery 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 objectrequiredcampaigns[].idstringrequiredcampaigns[].session_idstringrequiredcampaigns[].api_key_idstringrequiredOwning tenantcampaigns[].namestringrequiredcampaigns[].statusstringrequireddraft,running,paused,completed,failedorcancelledcampaigns[].message_typestringrequiredcampaigns[].bodystring | nullrequiredcampaigns[].total_recipientsinteger | nullrequiredcampaigns[].sent_countinteger | nullrequiredcampaigns[].failed_countinteger | nullrequiredcampaigns[].skipped_countinteger | nullrequiredRecipients skipped, e.g. because they opted outcampaigns[].created_atintegerrequiredUnix time in millisecondscampaigns[].started_atinteger | nullrequiredUnix time in milliseconds, or nullcampaigns[].completed_atinteger | nullrequiredUnix time in milliseconds, or nullcampaigns[].consent_attested_atinteger | nullrequiredWhen the sender attested consent, or null
- 401Missing, invalid or expired credentials
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))
}{
"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
}
]
}