ChatKomodo Docs Home Sign in

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

GET/v1/sessions/{sessionId}/posts

Posts of this device, newest first (at most 200): posted, scheduled, failed, cancelled and deleted ones.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Query parameters

  • targetstring
    One of: status, channel
  • channel_idstring
    Only posts to this channel

Responses

  • 200Posts
    Response fields
    • postsarray of objectrequired
    • posts[].idstringrequired
    • posts[].session_idstringrequired
    • posts[].targetstringrequired
      One of: status, channel
    • posts[].channel_idstring | nullrequired
      Channel JID for a channel post
    • posts[].typestringrequired
      One of: text, image, video
    • posts[].textstring | nullrequired
      Text, or the caption of an image or video
    • posts[].media_r2_keystring | nullrequired
    • posts[].background_colorstring | nullrequired
      Text status background (#RRGGBB)
    • posts[].fontinteger | nullrequired
      Text status font
    • posts[].audienceobject | nullrequired
      Who a status is addressed to
    • posts[].audience.kindstringrequired
      all (default): people this device has chatted with plus your CRM contacts; chats; contacts; or numbers
      One of: all, chats, contacts, numbers
    • posts[].audience.numbersarray of string
      Phone numbers or JIDs, for numbers
    • posts[].recipientsinteger | nullrequired
      Number of people the status was addressed to
    • posts[].mentionstringrequired
      all: everyone in the audience is mentioned (status only)
      One of: none, all
    • posts[].mentionsinteger | nullrequired
      "Mentioned you in a status" notices queued
    • posts[].backgroundstring | nullrequired
      Text status background: solid, a gradient or a texture
    • posts[].audio_r2_keystring | nullrequired
      Background music file
    • posts[].audio_startnumber | nullrequired
      Music starts this many seconds into the file
    • posts[].statusstringrequired
      One of: scheduled, sending, posted, failed, cancelled, deleted
    • posts[].scheduled_atinteger | nullrequired
      When it is (or was) due (Unix epoch, milliseconds)
    • posts[].posted_atinteger | nullrequired
      When it reached WhatsApp (Unix epoch, milliseconds)
    • posts[].wa_message_idstring | nullrequired
    • posts[].errorstring | nullrequired
      Why it failed
    • posts[].created_atintegerrequired
      Creation time (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/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))
}
Response 200
{
  "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

POST/v1/sessions/{sessionId}/posts

Posts 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

  • sessionIdstringrequired
    Session (device) id

Request body

  • targetstringrequired
    One of: status, channel
  • channel_idstring
    Channel JID, for target: channel
  • typestring
    Default text
    One of: text, image, video
  • textstring
    Text, or the caption of an image or video
    Up to 4 096 characters
  • media_r2_keystring
  • background_colorstring
    #RRGGBB, text status only (default #0A7350)
  • fontinteger
  • audienceobject
  • audience.kindstringrequired
    all (default): people this device has chatted with plus your CRM contacts; chats; contacts; or numbers
    One of: all, chats, contacts, numbers
  • audience.numbersarray of string
    Phone numbers or JIDs, for numbers
  • scheduled_atinteger
    Post at this time instead of now (Unix epoch, milliseconds)
  • backgroundstring
    Text status only. solid (default) is WhatsApp's own text status with background_color. Gradients (sunset, ocean, forest, berry, night, gold) and textures over background_color (dots, stripes, grid, paper) are drawn as a 1080×1920 picture and posted as an image status
    One of: solid, sunset, ocean, forest, berry, night, gold, dots, stripes, grid, paper
  • audio_r2_keystring
    Text or image status: background music from an audio file uploaded with POST /v1/media/upload (use music you have the rights to). The status becomes a video of up to 30 seconds
  • audio_startnumber
    Start the music this many seconds into the file (default 0)
    From 0 to 3 600
  • mentionstring
    Status only. all mentions 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); mentions says how many were queued. Channels do not support mentions
    One of: none, all

Responses

  • 201Posted or scheduled
    Response fields
    • postobjectrequired
    • post.idstringrequired
    • post.session_idstringrequired
    • post.targetstringrequired
      One of: status, channel
    • post.channel_idstring | nullrequired
      Channel JID for a channel post
    • post.typestringrequired
      One of: text, image, video
    • post.textstring | nullrequired
      Text, or the caption of an image or video
    • post.media_r2_keystring | nullrequired
    • post.background_colorstring | nullrequired
      Text status background (#RRGGBB)
    • post.fontinteger | nullrequired
      Text status font
    • post.audienceobject | nullrequired
      Who a status is addressed to
    • post.audience.kindstringrequired
      all (default): people this device has chatted with plus your CRM contacts; chats; contacts; or numbers
      One of: all, chats, contacts, numbers
    • post.audience.numbersarray of string
      Phone numbers or JIDs, for numbers
    • post.recipientsinteger | nullrequired
      Number of people the status was addressed to
    • post.mentionstringrequired
      all: everyone in the audience is mentioned (status only)
      One of: none, all
    • post.mentionsinteger | nullrequired
      "Mentioned you in a status" notices queued
    • post.backgroundstring | nullrequired
      Text status background: solid, a gradient or a texture
    • post.audio_r2_keystring | nullrequired
      Background music file
    • post.audio_startnumber | nullrequired
      Music starts this many seconds into the file
    • post.statusstringrequired
      One of: scheduled, sending, posted, failed, cancelled, deleted
    • post.scheduled_atinteger | nullrequired
      When it is (or was) due (Unix epoch, milliseconds)
    • post.posted_atinteger | nullrequired
      When it reached WhatsApp (Unix epoch, milliseconds)
    • post.wa_message_idstring | nullrequired
    • post.errorstring | nullrequired
      Why it failed
    • post.created_atintegerrequired
      Creation 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 failed with the reason in post.error
  • 501Channels on a test device (SANDBOX_UNSUPPORTED)
Request
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))
}
Response 201
{
  "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

GET/v1/sessions/{sessionId}/posts/audience

How 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

  • sessionIdstringrequired
    Session (device) id

Responses

  • 200Audience sizes
    Response fields
    • allintegerrequired
    • chatsintegerrequired
    • contactsintegerrequired
    • maxintegerrequired
      Most people one status is addressed to
    • truncatedbooleanrequired
      all is larger than max; the first max are used
  • 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/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))
}
Response 200
{
  "all": 1,
  "chats": 1,
  "contacts": 1,
  "max": 1,
  "truncated": true
}

Cancel or delete a post

DEL/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

  • sessionIdstringrequired
    Session (device) id
  • idstringrequired
    Post id

Responses

  • 200Done
    Response fields
    • okbooleanrequired
    • statusstringrequired
      One of: cancelled, deleted, removed
  • 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)
Request
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))
}
Response 200
{
  "ok": true,
  "status": "cancelled"
}

Post a Status update (older form)

POST/v1/sessions/{sessionId}/status

Older form of POST …/posts with target: status. jid_list sets the audience (default: chats plus CRM contacts). Kept for existing integrations.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Request body

  • typestring
    Default text
    One of: text, image, video
  • bodystring
    Text of a text Status
  • media_r2_keystring
    Media key from /v1/media/upload
  • captionstring
  • jid_listarray of string
    Numbers or JIDs the Status is addressed to

Responses

  • 200Posted
    Response fields
    • okbooleanrequired
      true when WhatsApp accepted the post
    • post_idstringrequired
      Id in GET …/posts
    • recipientsinteger | nullrequired
      People the status was addressed to
    • errorstring
      Why WhatsApp refused it (with status 422)
    • message_idstringrequired
      Same as post_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
Request
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))
}
Response 200
{
  "ok": true,
  "post_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "recipients": 1,
  "error": "string",
  "message_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X"
}

Post a text Status (older form)

POST/v1/sessions/{sessionId}/status/text

Older form of POST …/posts with target: status, type: text, addressed to the default audience.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Request body

  • textstringrequired
    Status text
  • background_colorstring
    #RRGGBB
  • fontinteger

Responses

  • 200Posted
    Response fields
    • okbooleanrequired
      true when WhatsApp accepted the post
    • post_idstringrequired
      Id in GET …/posts
    • recipientsinteger | nullrequired
      People the status was addressed to
    • errorstring
      Why 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
Request
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))
}
Response 200
{
  "ok": true,
  "post_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "recipients": 1,
  "error": "string"
}

Post an image Status (older form)

POST/v1/sessions/{sessionId}/status/image

Downloads 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

  • sessionIdstringrequired
    Session (device) id

Request body

  • image_urlstringrequired
    Public http(s) URL of the image
  • captionstring

Responses

  • 200Posted
    Response fields
    • okbooleanrequired
      true when WhatsApp accepted the post
    • post_idstringrequired
      Id in GET …/posts
    • recipientsinteger | nullrequired
      People the status was addressed to
    • errorstring
      Why WhatsApp refused it (with status 422)
  • 400The body is not valid JSON, or image_url is missing, is not an http(s) URL, answers with an HTTP error, is larger than 5 MB, or points at a private/local address (error starts with image_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
  • 500WhatsApp operation failed
Request
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))
}
Response 200
{
  "ok": true,
  "post_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "recipients": 1,
  "error": "string"
}