Skip to content
WhatSync/DocsAPI v1

Add opted-in campaign recipients

Append up to 500 recipients to a draft campaign.

POST/api/v1/tools/add_campaign_recipientsWrite
Key permissions
Read chats and messages + Run campaigns
Authentication
Authorization: Bearer $WHATSYNC_API_KEY
How keys work

How it works

Deduplicates phone numbers across batches and records declared opt-in source/time and template values.

Declared evidence does not independently prove consent.

Body parameters

idempotencyKeystringbody or header

A fresh random UUID for each new action; never build it from dates, names, counters or step numbers, which repeat across runs. Reuse it exactly only to retry the same action.

campaignIdstring · uuidrequired

Campaign ID returned by create_campaign or get_campaign.

recipientsobject[]required

See the example and input schema for this value.

Conditions and pagination

  • Use a unique idempotency key for each intended action. Reuse the same key and exactly the same input on a retry. The body key takes precedence over Idempotency-Key.

Response

The response wraps tool-specific data in result. Save operation_id and inspect get_operation with operationId if the outcome is uncertain. completed means the operation completed; it does not prove message delivery or Meta approval. An uncertain operation returns HTTP 409 with error.operation_id.

Every response includes X-Request-Id. Errors use the shared error format and retry rules.

Schemas

Input JSON Schema
Input JSON Schema
{
  "type": "object",
  "properties": {
    "idempotencyKey": {
      "type": "string",
      "pattern": "^[A-Za-z0-9._:-]{8,128}$",
      "description": "A fresh random UUID for each new action; never build it from dates, names, counters or step numbers, which repeat across runs. Reuse it exactly only to retry the same action."
    },
    "campaignId": {
      "type": "string",
      "format": "uuid"
    },
    "recipients": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "phoneNumber": {
            "type": "string",
            "pattern": "^[1-9]\\d{6,14}$"
          },
          "parameters": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            },
            "maxItems": 20
          },
          "consentSource": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "consentAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "phoneNumber",
          "consentSource",
          "consentAt"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 500
    }
  },
  "required": [
    "idempotencyKey",
    "campaignId",
    "recipients"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
Response JSON Schema
Response JSON Schema
{
  "type": "object",
  "properties": {
    "operation_id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "completed"
      ]
    },
    "replayed": {
      "type": "boolean"
    },
    "result": {
      "type": "object",
      "properties": {
        "campaign_id": {
          "type": "string"
        },
        "added": {
          "type": "number"
        },
        "duplicates": {
          "type": "number"
        },
        "recipient_count": {
          "type": "number"
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "operation_id",
    "status",
    "result"
  ],
  "additionalProperties": true
}