. Create an API key under API keys.API reference · WhatsApp features
WhatsApp account
Send a presence update
/v1/sessions/{sessionId}/presenceSets the presence of the account, or shows "typing" or "recording" in a chat.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
typestringrequiredjidstringChat the update is for (typing and recording indicators)
Responses
- 200Sent
Response fields
okbooleanrequired
- 400The body is not valid JSON
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 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/presence" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "available",
"jid": "447700900123@s.whatsapp.net"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/presence', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"type": "available",
"jid": "447700900123@s.whatsapp.net"
}),
});
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/presence",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"type": "available",
"jid": "447700900123@s.whatsapp.net",
},
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/presence', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'type' => 'available',
'jid' => '447700900123@s.whatsapp.net',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"type": "available",
"jid": "447700900123@s.whatsapp.net"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/presence", 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
}Get WhatsApp privacy settings
/v1/sessions/{sessionId}/privacyFetches the privacy settings of the account from WhatsApp. The result is a map of setting name to value exactly as WhatsApp returns it. For data-subject export and erasure see the privacy tag.
Path parameters
sessionIdstringrequiredSession (device) id
Responses
- 200Privacy settings
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 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 "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy', {
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/privacy",
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/privacy', [
'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/privacy", 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))
}{}Set read receipts privacy
/v1/sessions/{sessionId}/privacy/read-receiptsTurns read receipts on or off for the account.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
valuestringrequiredallsends read receipts,nonedoes not
Responses
- 200Updated
Response fields
okbooleanrequired
- 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
- 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 PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/read-receipts" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "all"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/read-receipts', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"value": "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.put(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/read-receipts",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"value": "all",
},
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/privacy/read-receipts', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'value' => 'all',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"value": "all"
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/read-receipts", 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
}Set online visibility privacy
/v1/sessions/{sessionId}/privacy/onlineControls who can see when the account is online.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
valuestringrequiredall: everyone;match_last_seen: same audience as last seen
Responses
- 200Updated
Response fields
okbooleanrequired
- 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
- 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 PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/online" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "all"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/online', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"value": "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.put(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/online",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"value": "all",
},
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/privacy/online', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'value' => 'all',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"value": "all"
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/privacy/online", 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
}Set a profile picture
/v1/sessions/{sessionId}/profile/pictureSets the picture of the account (default) or of a group the device administers, from a file uploaded with POST /v1/media (media_r2_key) or from a public URL (image_url: max 5 MB, 15-second limit, private addresses refused). JPEG or PNG; WhatsApp crops it to a square.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
jidstringJID whose picture is set: the account itself (default) or a groupmedia_r2_keystringKey of an image uploaded to ChatKomodoimage_urlstringPublic http(s) URL of the image (when no media_r2_key)
Responses
- 200Updated
Response fields
okbooleanrequired
- 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
- 404Unknown session, or a session of another tenant
- 409The session is not connected
- 500
WhatsApp operation failed
curl -X PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/picture" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jid": "447700900123@s.whatsapp.net",
"media_r2_key": "uploads/abc123.jpg",
"image_url": "https://example.com/file.jpg"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/picture', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"jid": "447700900123@s.whatsapp.net",
"media_r2_key": "uploads/abc123.jpg",
"image_url": "https://example.com/file.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/profile/picture",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"jid": "447700900123@s.whatsapp.net",
"media_r2_key": "uploads/abc123.jpg",
"image_url": "https://example.com/file.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/profile/picture', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'jid' => '447700900123@s.whatsapp.net',
'media_r2_key' => 'uploads/abc123.jpg',
'image_url' => 'https://example.com/file.jpg',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"jid": "447700900123@s.whatsapp.net",
"media_r2_key": "uploads/abc123.jpg",
"image_url": "https://example.com/file.jpg"
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/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
}Remove the profile picture
/v1/sessions/{sessionId}/profile/pictureRemoves the picture of the account (default) or of a group (?jid=).
Path parameters
sessionIdstringrequiredSession (device) id
Query parameters
jidstringGroup JID; default: the account itself
Responses
- 200Removed
Response fields
okbooleanrequired
- 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
- 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 DELETE "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/picture" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/picture', {
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/profile/picture",
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/profile/picture', [
'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/profile/picture", 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
}Change the WhatsApp name
/v1/sessions/{sessionId}/profile/nameChanges the name people see for this number (1-25 characters, as in the WhatsApp app). On WhatsApp Business the name may be reviewed by WhatsApp before it shows.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
namestringrequiredNew name
Responses
- 200Updated
Response fields
okbooleanrequirednamestringrequired
- 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
- 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 PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/name" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Example"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/name', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Example"
}),
});
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/profile/name",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"name": "Example",
},
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/profile/name', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'name' => 'Example',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"name": "Example"
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/name", 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,
"name": "Example"
}Set the About text
/v1/sessions/{sessionId}/profile/statusChanges the About (status text) of the account, up to 139 characters as in the WhatsApp app.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
statusstringrequiredNew About text
Responses
- 200Updated
Response fields
okbooleanrequired
- 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
- 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 PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/status" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "Open Mon–Sat 9:00–17:00"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/status', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"status": "Open Mon–Sat 9:00–17:00"
}),
});
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/profile/status",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"status": "Open Mon–Sat 9:00–17:00",
},
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/profile/status', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'status' => 'Open Mon–Sat 9:00–17:00',
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"status": "Open Mon–Sat 9:00–17:00"
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile/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
}Turn call auto-reject on or off
/v1/sessions/{sessionId}/calls/auto-rejectWhen on, incoming WhatsApp call offers on this session are rejected automatically. The setting is stored without contacting WhatsApp, so it also works while the session is offline; only the value true turns it on.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
enabledbooleanrequired
Responses
- 200Saved
Response fields
okbooleanrequiredauto_rejectbooleanrequiredThe submitted value
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/calls/auto-reject" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/calls/auto-reject', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"enabled": true
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/calls/auto-reject",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"enabled": True,
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/calls/auto-reject', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'enabled' => true,
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"enabled": true
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/calls/auto-reject", 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,
"auto_reject": true
}