. Create an API key under API keys.API reference · WhatsApp features
Status & posts
Post WhatsApp Status updates (stories) and channel posts, now or scheduled, and read their history. See the Status & channels guide.
List Status and Channel posts
/v1/sessions/{sessionId}/postsPosts of this device, newest first (at most 200): posted, scheduled, failed, cancelled and deleted ones.
Path parameters
sessionIdstringrequiredSession (device) id
Query parameters
targetstringchannel_idstringOnly posts to this channel
Responses
- 200Posts
Response fields
postsarray of objectrequiredposts[].idstringrequiredposts[].session_idstringrequiredposts[].targetstringrequiredposts[].channel_idstring | nullrequiredChannel JID for a channel postposts[].typestringrequiredposts[].textstring | nullrequiredText, or the caption of an image or videoposts[].media_r2_keystring | nullrequiredposts[].background_colorstring | nullrequiredText status background (#RRGGBB)posts[].fontinteger | nullrequiredText status fontposts[].audienceobject | nullrequiredWho a status is addressed toposts[].audience.kindstringrequiredall(default): people this device has chatted with plus your CRM contacts;chats;contacts; ornumbersposts[].audience.numbersarray of stringPhone numbers or JIDs, fornumbersposts[].recipientsinteger | nullrequiredNumber of people the status was addressed toposts[].mentionstringrequiredall: everyone in the audience is mentioned (status only)posts[].mentionsinteger | nullrequired"Mentioned you in a status" notices queuedposts[].backgroundstring | nullrequiredText status background:solid, a gradient or a textureposts[].audio_r2_keystring | nullrequiredBackground music fileposts[].audio_startnumber | nullrequiredMusic starts this many seconds into the fileposts[].statusstringrequiredposts[].scheduled_atinteger | nullrequiredWhen it is (or was) due (Unix epoch, milliseconds)posts[].posted_atinteger | nullrequiredWhen it reached WhatsApp (Unix epoch, milliseconds)posts[].wa_message_idstring | nullrequiredposts[].errorstring | nullrequiredWhy it failedposts[].created_atintegerrequiredCreation time (Unix epoch, milliseconds)
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts', {
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/posts",
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/posts', [
'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/posts", 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))
}{
"posts": [
{
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"target": "status",
"channel_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"type": "text",
"text": "Hi Sam, your order has shipped.",
"media_r2_key": "uploads/abc123.jpg",
"background_color": "#0a7350",
"font": 1,
"audience": {
"kind": "all",
"numbers": [
"+447700900123"
]
},
"recipients": 1,
"mention": "none",
"mentions": 1,
"background": "string",
"audio_r2_key": "uploads/abc123.jpg",
"audio_start": 0.5,
"status": "scheduled",
"scheduled_at": 1767225600000
}
]
}Post a Status or Channel update
/v1/sessions/{sessionId}/postsPosts to the WhatsApp Status (stories) of the device, or to one of its channels, now or at scheduled_at (up to 90 days ahead).
Status: WhatsApp shows a status only to the people it is addressed to, and of those only to the ones who saved your number. audience picks them (default: everyone the device has chatted with plus your CRM contacts, without opted-out people, at most 2 000). A text status takes background_color and font (0 default, 1, 2 script, 6 bold, 7, 8, 9, 10 typewriter).
Channel: the channel must be created or linked first (POST …/channels, POST …/channels/link), and the device must own or administer it.
Media comes from POST /v1/media/upload (media_r2_key). Not available on the Free plan. A post that WhatsApp refused is stored as failed and answered with 422.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
targetstringrequiredchannel_idstringChannel JID, fortarget: channeltypestringDefaulttexttextstringText, or the caption of an image or videomedia_r2_keystringbackground_colorstring#RRGGBB, text status only (default #0A7350)fontintegeraudienceobjectaudience.kindstringrequiredall(default): people this device has chatted with plus your CRM contacts;chats;contacts; ornumbersaudience.numbersarray of stringPhone numbers or JIDs, fornumbersscheduled_atintegerPost at this time instead of now (Unix epoch, milliseconds)backgroundstringText status only.solid(default) is WhatsApp's own text status withbackground_color. Gradients (sunset,ocean,forest,berry,night,gold) and textures overbackground_color(dots,stripes,grid,paper) are drawn as a 1080×1920 picture and posted as an image statusaudio_r2_keystringText or image status: background music from an audio file uploaded withPOST /v1/media/upload(use music you have the rights to). The status becomes a video of up to 30 secondsaudio_startnumberStart the music this many seconds into the file (default 0)mentionstringStatus only.allmentions everyone in the audience (at most 500; at most 100 during the number's first 14 days): each gets a "mentioned you in a status" notice, sent gradually through the anti-ban queue and counted as messages. People the number never chatted with are mentioned only within today's new-contact limit (none while WhatsApp limits the number);mentionssays how many were queued. Channels do not support mentions
Responses
- 201Posted or scheduled
Response fields
postobjectrequiredpost.idstringrequiredpost.session_idstringrequiredpost.targetstringrequiredpost.channel_idstring | nullrequiredChannel JID for a channel postpost.typestringrequiredpost.textstring | nullrequiredText, or the caption of an image or videopost.media_r2_keystring | nullrequiredpost.background_colorstring | nullrequiredText status background (#RRGGBB)post.fontinteger | nullrequiredText status fontpost.audienceobject | nullrequiredWho a status is addressed topost.audience.kindstringrequiredall(default): people this device has chatted with plus your CRM contacts;chats;contacts; ornumberspost.audience.numbersarray of stringPhone numbers or JIDs, fornumberspost.recipientsinteger | nullrequiredNumber of people the status was addressed topost.mentionstringrequiredall: everyone in the audience is mentioned (status only)post.mentionsinteger | nullrequired"Mentioned you in a status" notices queuedpost.backgroundstring | nullrequiredText status background:solid, a gradient or a texturepost.audio_r2_keystring | nullrequiredBackground music filepost.audio_startnumber | nullrequiredMusic starts this many seconds into the filepost.statusstringrequiredpost.scheduled_atinteger | nullrequiredWhen it is (or was) due (Unix epoch, milliseconds)post.posted_atinteger | nullrequiredWhen it reached WhatsApp (Unix epoch, milliseconds)post.wa_message_idstring | nullrequiredpost.errorstring | nullrequiredWhy it failedpost.created_atintegerrequiredCreation time (Unix epoch, milliseconds)
- 400Missing text or media, unknown font or background, more than 90 days ahead, an empty number list, a mention in a channel post, or music on a video or channel post (
VALIDATION_FAILED) - 401Missing or invalid credentials
- 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins; or, on the Free plan: a message type or feature the plan does not include, or a link in the text (
FREE_PLAN_RESTRICTED) - 404Unknown channel, media or audio file (
NOT_FOUND); unknown session, or a session of another tenant - 409The device is not connected and the post is not scheduled (
CONFLICT) - 422WhatsApp refused the post; it is stored as
failedwith the reason inpost.error - 501Channels on a test device (
SANDBOX_UNSUPPORTED)
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target": "status",
"type": "text",
"text": "New menu this week 🍜",
"background_color": "#0A7350",
"font": 6,
"audience": {
"kind": "all"
}
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"target": "status",
"type": "text",
"text": "New menu this week 🍜",
"background_color": "#0A7350",
"font": 6,
"audience": {
"kind": "all"
}
}),
});
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/posts",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"target": "status",
"type": "text",
"text": "New menu this week 🍜",
"background_color": "#0A7350",
"font": 6,
"audience": {
"kind": "all",
},
},
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/posts', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'target' => 'status',
'type' => 'text',
'text' => 'New menu this week 🍜',
'background_color' => '#0A7350',
'font' => 6,
'audience' => [
'kind' => 'all',
],
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"target": "status",
"type": "text",
"text": "New menu this week 🍜",
"background_color": "#0A7350",
"font": 6,
"audience": {
"kind": "all"
}
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts", 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))
}{
"post": {
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"target": "status",
"channel_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"type": "text",
"text": "Hi Sam, your order has shipped.",
"media_r2_key": "uploads/abc123.jpg",
"background_color": "#0a7350",
"font": 1,
"audience": {
"kind": "all",
"numbers": [
"+447700900123"
]
},
"recipients": 1,
"mention": "none",
"mentions": 1,
"background": "string",
"audio_r2_key": "uploads/abc123.jpg",
"audio_start": 0.5,
"status": "scheduled",
"scheduled_at": 1767225600000
}
}Status audience sizes
/v1/sessions/{sessionId}/posts/audienceHow many people a status would be addressed to with each audience: 1:1 chats of this device, CRM contacts, or both. Opted-out people are left out; at most 2000 per status.
Path parameters
sessionIdstringrequiredSession (device) id
Responses
- 200Audience sizes
Response fields
allintegerrequiredchatsintegerrequiredcontactsintegerrequiredmaxintegerrequiredMost people one status is addressed totruncatedbooleanrequiredallis larger thanmax; the firstmaxare used
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts/audience" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts/audience', {
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/posts/audience",
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/posts/audience', [
'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/posts/audience", 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))
}{
"all": 1,
"chats": 1,
"contacts": 1,
"max": 1,
"truncated": true
}Cancel or delete a post
/v1/sessions/{sessionId}/posts/{id}A scheduled post is cancelled. A posted status is removed from WhatsApp for everyone. A failed or cancelled post is dropped from the history. Channel posts cannot be removed through the API (do it in WhatsApp).
Path parameters
sessionIdstringrequiredSession (device) ididstringrequiredPost id
Responses
- 200Done
Response fields
okbooleanrequiredstatusstringrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins
- 404Post not found (
NOT_FOUND); unknown session, or a session of another tenant - 409A channel post (
NOT_SUPPORTED), a post being sent, or the device is not connected (CONFLICT)
curl -X DELETE "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts/ID" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/posts/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/posts/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/posts/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/posts/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,
"status": "cancelled"
}Post a Status update (older form)
/v1/sessions/{sessionId}/statusOlder form of POST …/posts with target: status. jid_list sets the audience (default: chats plus CRM contacts). Kept for existing integrations.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
typestringDefaulttextbodystringText of a text Statusmedia_r2_keystringMedia key from/v1/media/uploadcaptionstringjid_listarray of stringNumbers or JIDs the Status is addressed to
Responses
- 200Posted
Response fields
okbooleanrequiredtruewhen WhatsApp accepted the postpost_idstringrequiredId inGET …/postsrecipientsinteger | nullrequiredPeople the status was addressed toerrorstringWhy WhatsApp refused it (with status 422)message_idstringrequiredSame aspost_id
- 400Missing text or media, unknown font or background, more than 90 days ahead, an empty number list, a mention in a channel post, or music on a video or channel post (
VALIDATION_FAILED) - 401Missing or invalid credentials
- 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins; or, on the Free plan: a message type or feature the plan does not include, or a link in the text (
FREE_PLAN_RESTRICTED) - 404Unknown channel, media or audio file (
NOT_FOUND); unknown session, or a session of another tenant - 409The device is not connected and the post is not scheduled (
CONFLICT) - 422WhatsApp refused the post
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "text",
"body": "New menu this week 🍜"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"type": "text",
"body": "New menu this week 🍜"
}),
});
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/status",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"type": "text",
"body": "New menu this week 🍜",
},
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/status', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'type' => 'text',
'body' => 'New menu this week 🍜',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"type": "text",
"body": "New menu this week 🍜"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status", 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,
"post_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"recipients": 1,
"error": "string",
"message_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X"
}Post a text Status (older form)
/v1/sessions/{sessionId}/status/textOlder form of POST …/posts with target: status, type: text, addressed to the default audience.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
textstringrequiredStatus textbackground_colorstring#RRGGBBfontinteger
Responses
- 200Posted
Response fields
okbooleanrequiredtruewhen WhatsApp accepted the postpost_idstringrequiredId inGET …/postsrecipientsinteger | nullrequiredPeople the status was addressed toerrorstringWhy WhatsApp refused it (with status 422)
- 400Missing text or media, unknown font or background, more than 90 days ahead, an empty number list, a mention in a channel post, or music on a video or channel post (
VALIDATION_FAILED) - 401Missing or invalid credentials
- 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins; or, on the Free plan: a message type or feature the plan does not include, or a link in the text (
FREE_PLAN_RESTRICTED) - 404Unknown channel, media or audio file (
NOT_FOUND); unknown session, or a session of another tenant - 409The device is not connected and the post is not scheduled (
CONFLICT) - 422WhatsApp refused the post
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status/text" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "New menu this week 🍜",
"background_color": "#0a7350"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status/text', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "New menu this week 🍜",
"background_color": "#0a7350"
}),
});
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/status/text",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"text": "New menu this week 🍜",
"background_color": "#0a7350",
},
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/status/text', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'text' => 'New menu this week 🍜',
'background_color' => '#0a7350',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"text": "New menu this week 🍜",
"background_color": "#0a7350"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status/text", 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,
"post_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"recipients": 1,
"error": "string"
}Post an image Status (older form)
/v1/sessions/{sessionId}/status/imageDownloads an image from a public URL (max 5 MB, 15-second limit, private addresses refused) and posts it as a Status to the default audience.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
image_urlstringrequiredPublic http(s) URL of the imagecaptionstring
Responses
- 200Posted
Response fields
okbooleanrequiredtruewhen WhatsApp accepted the postpost_idstringrequiredId inGET …/postsrecipientsinteger | nullrequiredPeople the status was addressed toerrorstringWhy WhatsApp refused it (with status 422)
- 400The body is not valid JSON, or
image_urlis missing, is not an http(s) URL, answers with an HTTP error, is larger than 5 MB, or points at a private/local address (errorstarts withimage_url) - 401Missing or invalid credentials
- 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins; or, on the Free plan: a message type or feature the plan does not include, or a link in the text (
FREE_PLAN_RESTRICTED) - 404Unknown channel, media or audio file (
NOT_FOUND); unknown session, or a session of another tenant - 409The device is not connected and the post is not scheduled (
CONFLICT) - 422WhatsApp refused the post
- 500
WhatsApp operation failed
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status/image" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/new-menu.jpg",
"caption": "New menu this week 🍜"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status/image', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"image_url": "https://example.com/new-menu.jpg",
"caption": "New menu this week 🍜"
}),
});
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/status/image",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"image_url": "https://example.com/new-menu.jpg",
"caption": "New menu this week 🍜",
},
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/status/image', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'image_url' => 'https://example.com/new-menu.jpg',
'caption' => 'New menu this week 🍜',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"image_url": "https://example.com/new-menu.jpg",
"caption": "New menu this week 🍜"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/status/image", 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,
"post_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"recipients": 1,
"error": "string"
}