CloudContactAI Contact API - Do Not Text Integration Guide

API Reference

Set Do-Not-Text Status

  • Endpoint: PUT https://core.cloudcontactai.com/api/account/do-not-text
  • Content-Type: application/json
  • Authorization: Bearer <YOUR_API_KEY>

Request Body

FieldTypeRequiredDescription
clientIdstringYesYour CloudContactAI client ID
contactIdstringNo*The contact's unique ID
phonestringNo*The contact's phone number (E.164 format)
doNotTextbooleanYestrue to opt out, false to opt back in
  • You must provide either contactId or phone to identify the contact.

Response Body

FieldTypeDescription
contactIdstringThe contact's unique ID
phonestringThe contact's phone number
doNotTextbooleanThe updated do-not-text status

JavaScript Examples

1. Set Do-Not-Text by Contact ID

const response = await fetch("https://core.cloudcontactai.com/api/account/do-not-text", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json",
    "Accept": "*/*"
  },
  body: JSON.stringify({
    clientId: "<YOUR_CLIENT_ID>",
    contactId: "your-contact-id",
    doNotText: true
  })
});

const data = await response.json();
console.log(`Contact ${data.contactId} do not text set to ${data.doNotText}`);

2. Set Do-Not-Text by Phone Number

const response = await fetch("https://core.cloudcontactai.com/api/account/do-not-text", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json",
    "Accept": "*/*"
  },
  body: JSON.stringify({
    clientId: "<YOUR_CLIENT_ID>",
    phone: "+15551234567",
    doNotText: true
  })
});

const data = await response.json();
console.log(`Contact ${data.contactId} (${data.phone}) do not text set to ${data.doNotText}`);

3. Remove Do-Not-Text Status

const response = await fetch("https://core.cloudcontactai.com/api/account/do-not-text", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json",
    "Accept": "*/*"
  },
  body: JSON.stringify({
    clientId: "<YOUR_CLIENT_ID>",
    contactId: "your-contact-id",
    doNotText: false
  })
});

const data = await response.json();
console.log(`Contact ${data.contactId} do not text removed: ${data.doNotText}`);

cURL Example

curl -X PUT "https://core.cloudcontactai.com/api/account/do-not-text" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -H "Accept: */*" \
  -d '{
    "clientId": "<YOUR_CLIENT_ID>",
    "contactId": "your-contact-id",
    "doNotText": true
  }'