. Create an API key under API keys.API reference · WhatsApp features
WhatsApp Business
Update the business profile
/v1/sessions/{sessionId}/business/profileChanges the WhatsApp Business profile of the device: description, address, e-mail, websites and opening hours. Only the fields you send change; give at least one. Unknown fields are rejected. A device on the ordinary WhatsApp app (not WhatsApp Business) answers 409 NOT_A_BUSINESS_ACCOUNT.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
descriptionstringThe business description shown on the profile (up to 512 characters)addressstringStreet address (up to 256 characters)emailstring (email)Contact e-mail addresswebsitesarray of string (uri)Up to two website addresseshoursobjectOpening hourshours.timezonestringrequiredIANA time zone, for exampleAsia/Jakartahours.daysarray of objectrequiredhours.days[].daystringrequiredhours.days[].modestringrequiredhours.days[].openstringrequiredOpening time, 24-hour HH:MMhours.days[].closestringrequiredClosing time, 24-hour HH:MM (later thanopen)
Responses
- 200Updated
Response fields
okbooleanrequiredupdatedarray of stringrequiredThe fields that were sent to WhatsApp
- 400A field is missing, too long or not valid (
VALIDATION_ERROR) - 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
- 409Not connected, or not a WhatsApp Business account (
NOT_A_BUSINESS_ACCOUNT) - 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/business/profile" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Gentle dental care in central Jakarta",
"email": "hello@example.com",
"websites": [
"https://example.com"
],
"hours": {
"timezone": "Asia/Jakarta",
"days": [
{
"day": "mon",
"mode": "specific_hours",
"open": "09:00",
"close": "17:00"
},
{
"day": "sat",
"mode": "appointment_only"
}
]
}
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/profile', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"description": "Gentle dental care in central Jakarta",
"email": "hello@example.com",
"websites": [
"https://example.com"
],
"hours": {
"timezone": "Asia/Jakarta",
"days": [
{
"day": "mon",
"mode": "specific_hours",
"open": "09:00",
"close": "17:00"
},
{
"day": "sat",
"mode": "appointment_only"
}
]
}
}),
});
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/business/profile",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"description": "Gentle dental care in central Jakarta",
"email": "hello@example.com",
"websites": [
"https://example.com",
],
"hours": {
"timezone": "Asia/Jakarta",
"days": [
{
"day": "mon",
"mode": "specific_hours",
"open": "09:00",
"close": "17:00",
},
{
"day": "sat",
"mode": "appointment_only",
},
],
},
},
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/business/profile', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'description' => 'Gentle dental care in central Jakarta',
'email' => 'hello@example.com',
'websites' => [
'https://example.com',
],
'hours' => [
'timezone' => 'Asia/Jakarta',
'days' => [
[
'day' => 'mon',
'mode' => 'specific_hours',
'open' => '09:00',
'close' => '17:00',
],
[
'day' => 'sat',
'mode' => 'appointment_only',
],
],
],
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"description": "Gentle dental care in central Jakarta",
"email": "hello@example.com",
"websites": [
"https://example.com"
],
"hours": {
"timezone": "Asia/Jakarta",
"days": [
{
"day": "mon",
"mode": "specific_hours",
"open": "09:00",
"close": "17:00"
},
{
"day": "sat",
"mode": "appointment_only"
}
]
}
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/profile", 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,
"updated": [
"string"
]
}List catalog products
/v1/sessions/{sessionId}/business/catalogFetches up to 100 products of a business catalog from WhatsApp. There is no paging parameter, so nextPageCursor cannot be followed.
Path parameters
sessionIdstringrequiredSession (device) id
Query parameters
jidstringBusiness whose catalog to read; defaults to the account of the session
Responses
- 200Catalog
Response fields
productsarray of objectrequiredproducts[].idstringrequiredproducts[].namestringrequiredproducts[].descriptionstringproducts[].pricenumberproducts[].currencystringproducts[].retailerIdstringproducts[].urlstringproducts[].isHiddenbooleanproducts[].imageUrlsobjectproducts[].availabilitystringproducts[].reviewStatusobjectnextPageCursorstring
- 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/business/catalog" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog', {
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/business/catalog",
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/business/catalog', [
'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/business/catalog", 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))
}{
"products": [
{
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"retailerId": "SKU-1042",
"url": "https://example.com/file.jpg",
"isHidden": true,
"imageUrls": {},
"availability": "string",
"reviewStatus": {}
}
],
"nextPageCursor": "string"
}Create a catalog product
/v1/sessions/{sessionId}/business/catalog/productsCreates a product in the catalog of the account. Each image is downloaded by the gateway through the outbound-URL guard (http/https only, max 5 MB, no private or local addresses) and uploaded as bytes; anything else in images is a 400. The remaining fields are passed unchanged to the WhatsApp library and not validated by the gateway; they follow the library's product type.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
namestringrequiredProduct namedescriptionstringrequiredProduct descriptionpricenumberrequiredPrice as the WhatsApp library expects itcurrencystringrequiredCurrency codeimagesarray of objectrequiredProduct images, each given as{ "url": "https://…" }(at most 10)images[].urlstringrequiredPublic http(s) URL of the image (max 5 MB). The gateway downloads it itself; private and local addresses are refusedretailerIdstringYour own product idurlstringLink to the product pageisHiddenbooleanoriginCountryCodestringISO country code of origin
Responses
- 200Product created
Response fields
idstringrequirednamestringrequireddescriptionstringpricenumbercurrencystringretailerIdstringurlstringisHiddenbooleanimageUrlsobjectavailabilitystringreviewStatusobject
- 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: 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/business/catalog/products" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg"
}
],
"retailerId": "SKU-1042",
"url": "https://example.com/file.jpg"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg"
}
],
"retailerId": "SKU-1042",
"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.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg",
},
],
"retailerId": "SKU-1042",
"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('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'name' => 'Iced coffee 250 ml',
'description' => 'Short description',
'price' => 150000,
'currency' => 'IDR',
'images' => [
[
'url' => 'https://example.com/file.jpg',
],
],
'retailerId' => 'SKU-1042',
'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(`{
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg"
}
],
"retailerId": "SKU-1042",
"url": "https://example.com/file.jpg"
}`)
req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products", 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": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"retailerId": "SKU-1042",
"url": "https://example.com/file.jpg",
"isHidden": true,
"imageUrls": {},
"availability": "string",
"reviewStatus": {}
}Delete catalog products
/v1/sessions/{sessionId}/business/catalog/productsDeletes products from the catalog; the ids travel in the JSON body of this DELETE request.
Path parameters
sessionIdstringrequiredSession (device) id
Request body
product_idsarray of stringrequiredProduct ids
Responses
- 200Result
Response fields
deletedintegerrequiredProducts deleted
- 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/business/catalog/products" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"product_ids": [
"01JA5V6Q8M2H7G4K9P3T0R1S2X"
]
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"product_ids": [
"01JA5V6Q8M2H7G4K9P3T0R1S2X"
]
}),
});
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/business/catalog/products",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"product_ids": [
"01JA5V6Q8M2H7G4K9P3T0R1S2X",
],
},
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/business/catalog/products', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'product_ids' => [
'01JA5V6Q8M2H7G4K9P3T0R1S2X',
],
],
]);
print_r(json_decode((string) $res->getBody(), true));package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"product_ids": [
"01JA5V6Q8M2H7G4K9P3T0R1S2X"
]
}`)
req, err := http.NewRequest("DELETE", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products", 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))
}{
"deleted": 1
}Update a catalog product
/v1/sessions/{sessionId}/business/catalog/products/{pid}Updates a catalog product. Images are handled as in POST …/business/catalog/products (downloaded by the gateway, never fetched from a URL by the library). The remaining fields are passed unchanged to the WhatsApp library and not validated by the gateway.
Path parameters
sessionIdstringrequiredSession (device) idpidstringrequiredProduct id
Request body
namestringrequiredProduct namedescriptionstringrequiredProduct descriptionpricenumberrequiredPrice as the WhatsApp library expects itcurrencystringrequiredCurrency codeimagesarray of objectrequiredProduct images, each given as{ "url": "https://…" }(at most 10)images[].urlstringrequiredPublic http(s) URL of the image (max 5 MB). The gateway downloads it itself; private and local addresses are refusedretailerIdstringYour own product idurlstringLink to the product pageisHiddenboolean
Responses
- 200Product updated
Response fields
idstringrequirednamestringrequireddescriptionstringpricenumbercurrencystringretailerIdstringurlstringisHiddenbooleanimageUrlsobjectavailabilitystringreviewStatusobject
- 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: 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/business/catalog/products/7012345678901234" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg"
}
],
"retailerId": "SKU-1042",
"url": "https://example.com/file.jpg"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products/7012345678901234', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg"
}
],
"retailerId": "SKU-1042",
"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/business/catalog/products/7012345678901234",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg",
},
],
"retailerId": "SKU-1042",
"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/business/catalog/products/7012345678901234', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'name' => 'Iced coffee 250 ml',
'description' => 'Short description',
'price' => 150000,
'currency' => 'IDR',
'images' => [
[
'url' => 'https://example.com/file.jpg',
],
],
'retailerId' => 'SKU-1042',
'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(`{
"name": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"images": [
{
"url": "https://example.com/file.jpg"
}
],
"retailerId": "SKU-1042",
"url": "https://example.com/file.jpg"
}`)
req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/business/catalog/products/7012345678901234", 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": "Iced coffee 250 ml",
"description": "Short description",
"price": 150000,
"currency": "IDR",
"retailerId": "SKU-1042",
"url": "https://example.com/file.jpg",
"isHidden": true,
"imageUrls": {},
"availability": "string",
"reviewStatus": {}
}List WhatsApp Business labels
/v1/sessions/{sessionId}/labelsNot available yet: the WhatsApp library version in use (Baileys 6.7.23) has no getLabels method, so this answers 501 NOT_SUPPORTED. The handler would return { "labels": [...] }.
Path parameters
sessionIdstringrequiredSession (device) id
Responses
- 200Labels
Response fields
labelsarray of objectrequiredlabels[].idstringrequiredlabels[].namestringrequired
- 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 - 501
NOT_SUPPORTED: the WhatsApp library version in use (Baileys 6.7.x) has no such operation, so the call is not available yet
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/labels" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/labels', {
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/labels",
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/labels', [
'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/labels", 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))
}{
"labels": [
{
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"name": "Example"
}
]
}