ChatKomodo Docs Home Sign in

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

GET/v1/sessions/{sessionId}/channels

Channels this device can post to: created through the API or dashboard, or linked by invite link.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Responses

  • 200Channels
    Response fields
    • channelsarray of objectrequired
    • channels[].idstringrequired
      Channel JID, <id>@newsletter
    • channels[].session_idstringrequired
    • channels[].namestringrequired
    • channels[].descriptionstring | nullrequired
    • channels[].invite_linkstring | nullrequired
      https://whatsapp.com/channel/…
    • channels[].rolestring | nullrequired
      Role of the device in the channel: owner, admin, …
    • channels[].subscribersinteger | nullrequired
      Followers, as of the last refresh
    • channels[].created_herebooleanrequired
    • channels[].updated_atintegerrequired
      Last refresh (Unix epoch, milliseconds)
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions
  • 404Unknown session, or a session of another tenant
Request
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))
}
Response 200
{
  "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

POST/v1/sessions/{sessionId}/channels

Creates 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

  • sessionIdstringrequired
    Session (device) id

Request body

  • namestringrequired
    Up to 100 characters
  • descriptionstring
    Up to 2 048 characters
  • picture_r2_keystring
    Uploaded image for the channel picture
    Up to 256 characters

Responses

  • 201Channel created
    Response fields
    • channelobjectrequired
    • channel.idstringrequired
      Channel JID, <id>@newsletter
    • channel.session_idstringrequired
    • channel.namestringrequired
    • channel.descriptionstring | nullrequired
    • channel.invite_linkstring | nullrequired
      https://whatsapp.com/channel/…
    • channel.rolestring | nullrequired
      Role of the device in the channel: owner, admin, …
    • channel.subscribersinteger | nullrequired
      Followers, as of the last refresh
    • channel.created_herebooleanrequired
    • channel.updated_atintegerrequired
      Last refresh (Unix epoch, milliseconds)
    • picture_errorstring
      Only 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)
Request
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))
}
Response 201
{
  "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

PUT/v1/sessions/{sessionId}/channels/{jid}/picture

Sets the picture of a channel this device owns or administers, from an uploaded image (at most 5 MB).

Path parameters

  • sessionIdstringrequired
    Session (device) id
  • jidstringrequired
    Channel JID

Request body

  • media_r2_keystringrequired
    Up to 256 characters

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

Link an existing channel

POST/v1/sessions/{sessionId}/channels/link

Adds a channel the device already owns or administers, by its invite link (https://whatsapp.com/channel/…), invite code or JID.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Request body

  • linkstringrequired
    Invite link, invite code or <id>@newsletter

Responses

  • 201Channel linked
    Response fields
    • channelobjectrequired
    • channel.idstringrequired
      Channel JID, <id>@newsletter
    • channel.session_idstringrequired
    • channel.namestringrequired
    • channel.descriptionstring | nullrequired
    • channel.invite_linkstring | nullrequired
      https://whatsapp.com/channel/…
    • channel.rolestring | nullrequired
      Role of the device in the channel: owner, admin, …
    • channel.subscribersinteger | nullrequired
      Followers, as of the last refresh
    • channel.created_herebooleanrequired
    • channel.updated_atintegerrequired
      Last 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)
Request
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))
}
Response 201
{
  "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

POST/v1/sessions/{sessionId}/channels/{jid}/refresh

Reads the name, description, followers and role of the device again from WhatsApp.

Path parameters

  • sessionIdstringrequired
    Session (device) id
  • jidstringrequired
    Channel JID

Responses

  • 200Refreshed
    Response fields
    • channelobjectrequired
    • channel.idstringrequired
      Channel JID, <id>@newsletter
    • channel.session_idstringrequired
    • channel.namestringrequired
    • channel.descriptionstring | nullrequired
    • channel.invite_linkstring | nullrequired
      https://whatsapp.com/channel/…
    • channel.rolestring | nullrequired
      Role of the device in the channel: owner, admin, …
    • channel.subscribersinteger | nullrequired
      Followers, as of the last refresh
    • channel.created_herebooleanrequired
    • channel.updated_atintegerrequired
      Last 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)
Request
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))
}
Response 200
{
  "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

DEL/v1/sessions/{sessionId}/channels/{jid}

Removes the channel from this list and cancels its scheduled posts. The channel itself stays on WhatsApp.

Path parameters

  • sessionIdstringrequired
    Session (device) id
  • jidstringrequired
    Channel 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
Request
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))
}
Response 200
{
  "ok": true
}

Create a channel

POST/v1/sessions/{sessionId}/newsletter/create

Creates a WhatsApp channel (newsletter) and remembers it for this device. Prefer POST …/channels.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Request body

  • namestringrequired
    Channel name
  • descriptionstring

Responses

  • 200Channel created
    Response fields
    • idstringrequired
      Channel JID, <id>@newsletter
    • namestringrequired
    • descriptionstring
    • invitestring
    • creation_timeinteger
    • subscribersinteger
  • 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
  • 500WhatsApp 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
Request
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))
}
Response 200
{
  "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "name": "Acme news",
  "description": "Short description",
  "invite": "string",
  "creation_time": 1767225600000,
  "subscribers": 1
}

Post to a channel (older form)

POST/v1/sessions/{sessionId}/newsletter/{nid}/post

Older form of POST …/posts with target: channel, type: text. The channel is remembered for this device.

Path parameters

  • sessionIdstringrequired
    Session (device) id
  • nidstringrequired
    Channel JID, <id>@newsletter

Request body

  • textstringrequired
    Post text

Responses

  • 200Posted
    Response fields
    • okbooleanrequired
    • post_idstringrequired
    • recipientsinteger | nullrequired
    • errorstring
  • 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
Request
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))
}
Response 200
{
  "ok": true,
  "post_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "recipients": 1,
  "error": "string"
}