. Create an API key under API keys.API reference · WhatsApp features
Channels
WhatsApp channels (newsletters): create one (optionally with a picture), or link one the device owns or administers, then post to it with POST …/posts. Set or change the channel picture from an uploaded image with PUT …/channels/{jid}/picture (media_r2_key, at most 5 MB). See the Status & channels guide.
List channels of the device
/v1/sessions/{sessionId}/channelsChannels this device can post to: created through the API or dashboard, or linked by invite link.
Path parameters
sessionIdstringrequiredSession (device) id
Responses
- 200Channels
Response fields
channelsarray of objectrequiredchannels[].idstringrequiredChannel JID,<id>@newsletterchannels[].session_idstringrequiredchannels[].namestringrequiredchannels[].descriptionstring | nullrequiredchannels[].invite_linkstring | nullrequiredhttps://whatsapp.com/channel/…channels[].rolestring | nullrequiredRole of the device in the channel:owner,admin, …channels[].subscribersinteger | nullrequiredFollowers, as of the last refreshchannels[].created_herebooleanrequiredchannels[].updated_atintegerrequiredLast refresh (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/channels" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels', {
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/channels",
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/channels', [
'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/channels", 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))
}{
"channels": [
{
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"name": "Example",
"description": "Short description",
"invite_link": "https://example.com/file.jpg",
"role": "agent",
"subscribers": 1,
"created_here": true,
"updated_at": 1767225600000
}
]
}Create a channel
/v1/sessions/{sessionId}/channelsCreates a WhatsApp channel owned by this device and remembers it. With picture_r2_key (an image uploaded with /v1/media/upload-url, at most 5 MB) the channel picture is set too; if WhatsApp refuses it the channel is still created and picture_error says why. The answer includes invite_link, read back from WhatsApp when the create call did not return it. Not available on the Free plan or on test devices.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
namestringrequireddescriptionstringpicture_r2_keystringUploaded image for the channel picture
Responses
- 201Channel created
Response fields
channelobjectrequiredchannel.idstringrequiredChannel JID,<id>@newsletterchannel.session_idstringrequiredchannel.namestringrequiredchannel.descriptionstring | nullrequiredchannel.invite_linkstring | nullrequiredhttps://whatsapp.com/channel/…channel.rolestring | nullrequiredRole of the device in the channel:owner,admin, …channel.subscribersinteger | nullrequiredFollowers, as of the last refreshchannel.created_herebooleanrequiredchannel.updated_atintegerrequiredLast refresh (Unix epoch, milliseconds)picture_errorstringOnly when the picture could not be set
- 400Picture larger than 5 MB (
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) - 404picture_r2_key not found (
NOT_FOUND); unknown session, or a session of another tenant - 409The session is not connected (
CONFLICT) - 501Test device (
SANDBOX_UNSUPPORTED) - 502WhatsApp did not return the channel (
UPSTREAM_ERROR)
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Coffee News",
"description": "New beans, offers and opening hours"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Acme Coffee News",
"description": "New beans, offers and opening hours"
}),
});
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/channels",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"name": "Acme Coffee News",
"description": "New beans, offers and opening hours",
},
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/channels', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'name' => 'Acme Coffee News',
'description' => 'New beans, offers and opening hours',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"name": "Acme Coffee News",
"description": "New beans, offers and opening hours"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels", 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))
}{
"channel": {
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"name": "Example",
"description": "Short description",
"invite_link": "https://example.com/file.jpg",
"role": "agent",
"subscribers": 1,
"created_here": true,
"updated_at": 1767225600000
},
"picture_error": "string"
}Change a channel picture
/v1/sessions/{sessionId}/channels/{jid}/pictureSets the picture of a channel this device owns or administers, from an uploaded image (at most 5 MB).
Path parameters
sessionIdstringrequiredSession (device) idjidstringrequiredChannel JID
Request body
media_r2_keystringrequired
Responses
- 200Picture changed
Response fields
okbooleanrequired
- 400Picture larger than 5 MB (
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) - 404Channel or image not found (
NOT_FOUND); unknown session, or a session of another tenant - 409The session is not connected (
CONFLICT) - 501Test device (
SANDBOX_UNSUPPORTED)
curl -X PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID/picture" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"media_r2_key": "uploads/abc123.jpg"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID/picture', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"media_r2_key": "uploads/abc123.jpg"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.put(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID/picture",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"media_r2_key": "uploads/abc123.jpg",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('PUT', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID/picture', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'media_r2_key' => 'uploads/abc123.jpg',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"media_r2_key": "uploads/abc123.jpg"
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID/picture", 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
}Link an existing channel
/v1/sessions/{sessionId}/channels/linkAdds a channel the device already owns or administers, by its invite link (https://whatsapp.com/channel/…), invite code or JID.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
linkstringrequiredInvite link, invite code or<id>@newsletter
Responses
- 201Channel linked
Response fields
channelobjectrequiredchannel.idstringrequiredChannel JID,<id>@newsletterchannel.session_idstringrequiredchannel.namestringrequiredchannel.descriptionstring | nullrequiredchannel.invite_linkstring | nullrequiredhttps://whatsapp.com/channel/…channel.rolestring | nullrequiredRole of the device in the channel:owner,admin, …channel.subscribersinteger | nullrequiredFollowers, as of the last refreshchannel.created_herebooleanrequiredchannel.updated_atintegerrequiredLast refresh (Unix epoch, milliseconds)
- 400Not a channel link (
VALIDATION_FAILED) - 401Missing or invalid credentials
- 403The device is not an owner or admin of the channel (
FORBIDDEN); the 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) - 404Channel not found (
NOT_FOUND); unknown session, or a session of another tenant - 409The session is not connected (
CONFLICT) - 501Test device (
SANDBOX_UNSUPPORTED)
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/link" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"link": "https://whatsapp.com/channel/0029VaAbCdEfGhIjKlMn"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/link', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"link": "https://whatsapp.com/channel/0029VaAbCdEfGhIjKlMn"
}),
});
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/channels/link",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"link": "https://whatsapp.com/channel/0029VaAbCdEfGhIjKlMn",
},
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/channels/link', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'link' => 'https://whatsapp.com/channel/0029VaAbCdEfGhIjKlMn',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"link": "https://whatsapp.com/channel/0029VaAbCdEfGhIjKlMn"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/link", 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))
}{
"channel": {
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"name": "Example",
"description": "Short description",
"invite_link": "https://example.com/file.jpg",
"role": "agent",
"subscribers": 1,
"created_here": true,
"updated_at": 1767225600000
}
}Refresh a channel
/v1/sessions/{sessionId}/channels/{jid}/refreshReads the name, description, followers and role of the device again from WhatsApp.
Path parameters
sessionIdstringrequiredSession (device) idjidstringrequiredChannel JID
Responses
- 200Refreshed
Response fields
channelobjectrequiredchannel.idstringrequiredChannel JID,<id>@newsletterchannel.session_idstringrequiredchannel.namestringrequiredchannel.descriptionstring | nullrequiredchannel.invite_linkstring | nullrequiredhttps://whatsapp.com/channel/…channel.rolestring | nullrequiredRole of the device in the channel:owner,admin, …channel.subscribersinteger | nullrequiredFollowers, as of the last refreshchannel.created_herebooleanrequiredchannel.updated_atintegerrequiredLast refresh (Unix epoch, milliseconds)
- 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) - 404Channel not found (
NOT_FOUND); unknown session, or a session of another tenant - 409The session is not connected (
CONFLICT) - 501Test device (
SANDBOX_UNSUPPORTED)
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID/refresh" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID/refresh', {
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/channels/JID/refresh",
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/channels/JID/refresh', [
'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/channels/JID/refresh", 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))
}{
"channel": {
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"name": "Example",
"description": "Short description",
"invite_link": "https://example.com/file.jpg",
"role": "agent",
"subscribers": 1,
"created_here": true,
"updated_at": 1767225600000
}
}Forget a channel
/v1/sessions/{sessionId}/channels/{jid}Removes the channel from this list and cancels its scheduled posts. The channel itself stays on WhatsApp.
Path parameters
sessionIdstringrequiredSession (device) idjidstringrequiredChannel JID
Responses
- 200Removed
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
- 404Channel not found (
NOT_FOUND); unknown session, or a session of another tenant
curl -X DELETE "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/channels/JID', {
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/channels/JID",
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/channels/JID', [
'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/channels/JID", 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
}Create a channel
/v1/sessions/{sessionId}/newsletter/createCreates a WhatsApp channel (newsletter) and remembers it for this device. Prefer POST …/channels.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
namestringrequiredChannel namedescriptionstring
Responses
- 200Channel created
Response fields
idstringrequiredChannel JID,<id>@newsletternamestringrequireddescriptionstringinvitestringcreation_timeintegersubscribersinteger
- 400The body is not valid JSON
- 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 session, or a session of another tenant
- 409The session is not connected
- 500
WhatsApp operation failed: WhatsApp or the library rejected the call. The gateway does not validate this body, so missing or malformed fields end up here too
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/newsletter/create" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme news",
"description": "Short description"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/newsletter/create', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Acme news",
"description": "Short description"
}),
});
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/newsletter/create",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"name": "Acme news",
"description": "Short description",
},
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/newsletter/create', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'name' => 'Acme news',
'description' => 'Short description',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"name": "Acme news",
"description": "Short description"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/newsletter/create", 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",
"name": "Acme news",
"description": "Short description",
"invite": "string",
"creation_time": 1767225600000,
"subscribers": 1
}Post to a channel (older form)
/v1/sessions/{sessionId}/newsletter/{nid}/postOlder form of POST …/posts with target: channel, type: text. The channel is remembered for this device.
Path parameters
sessionIdstringrequiredSession (device) idnidstringrequiredChannel JID,<id>@newsletter
Request body
textstringrequiredPost text
Responses
- 200Posted
Response fields
okbooleanrequiredpost_idstringrequiredrecipientsinteger | nullrequirederrorstring
- 400Invalid channel id or empty text (
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 session, or a session of another tenant
- 409The session is not connected (
CONFLICT) - 422WhatsApp refused the post
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/newsletter/120363098765432109%40newsletter/post" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "This week only: 20% off all coffee beans."
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/newsletter/120363098765432109%40newsletter/post', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "This week only: 20% off all coffee beans."
}),
});
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/newsletter/120363098765432109%40newsletter/post",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"text": "This week only: 20% off all coffee beans.",
},
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/newsletter/120363098765432109%40newsletter/post', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'text' => 'This week only: 20% off all coffee beans.',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"text": "This week only: 20% off all coffee beans."
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/newsletter/120363098765432109%40newsletter/post", 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"
}