ChatKomodo Docs Home Sign in

API reference · Customers

Consent

Who agreed to be messaged and who asked to stop. Replies such as STOP opt people out automatically; broadcasts skip them.

Set consent for many numbers

POST/v1/consent/bulk

Set the consent status of up to 10 000 numbers at once (e.g. importing a suppression list).

Request body

  • phonesarray of stringrequired
    1–10 000 items
  • statusstringrequired
    One of: opted_in, opted_out
  • notestring | null
    Up to 200 characters

Responses

  • 200Result
    Response fields
    • changedintegerrequired
    • unchangedintegerrequired
    • invalidintegerrequired
Request
curl -X POST "https://api.chatkomodo.com/v1/consent/bulk" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phones": [
    "+447700900123",
    "+12025550123"
  ],
  "status": "opted_out"
}'
const res = await fetch('https://api.chatkomodo.com/v1/consent/bulk', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "phones": [
      "+447700900123",
      "+12025550123"
    ],
    "status": "opted_out"
  }),
});
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/consent/bulk",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "phones": [
            "+447700900123",
            "+12025550123",
        ],
        "status": "opted_out",
    },
    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/consent/bulk', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'phones' => [
            '+447700900123',
            '+12025550123',
        ],
        'status' => 'opted_out',
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
Response 200
{
  "changed": 1,
  "unchanged": 1,
  "invalid": 1
}