Skip to main content

Campaigns

Campaigns define reusable message templates and parameter strategies for marketing messages. They are associated with channels and can be used to create flows that send messages to multiple contacts.

Create Campaign

POST /campaigns

Creates a new campaign with the specified template and parameters.

Request Body

string
required
Channel UID to associate with the campaign
string
required
Campaign name
object
Campaign description
string
required
Campaign status: ACTIVE, PENDING, DEPRECATED, INACTIVE, or BLOCKED
string
required
WhatsApp template name (must be approved by Meta)
string
required
Strategy for filling template parameters: USE_DEFAULT or USE_CONTACT_ASSOCIATION
object
Template parameter mapping. Keys are parameter names, values can be:
  • Single value: "name"
  • Fallback chain: "age, default" (tries age first, then default)
  • Multiple fallbacks: "favoriteColor, favoriteSport, default"

Response

message
string
Success message
data
object

List Campaigns

GET /campaigns

Retrieves a paginated list of campaigns with filtering options.

Query Parameters

number
required
Workspace ID to filter campaigns
number
Channel ID to filter campaigns
string
Filter campaigns by name (partial match)
string
Filter by status: ACTIVE, PENDING, DEPRECATED, INACTIVE, BLOCKED
string
Cursor for pagination (from previous response)
number
Maximum number of results (default: 20, max: 100)

Response

data
array
Array of campaign objects
nextCursor
string
Cursor for next page (null if no next page)
prevCursor
string
Cursor for previous page (null if no previous page)
total
number
Total number of campaigns matching the filters

Get Campaign

GET /campaigns/{uid}

Retrieves detailed information about a specific campaign.
uid
string
required
Campaign unique identifier (UUID)

Update Campaign

PATCH /campaigns/{uid}

Updates an existing campaign. Only provided fields will be updated. Channel UID cannot be changed.
uid
string
required
Campaign unique identifier (UUID)

Request Body

Same fields as Create Campaign (all optional).

Delete Campaign

DELETE /campaigns/{uid}

Deletes a campaign. Cannot delete if it has running flows.
uid
string
required
Campaign unique identifier (UUID)

Template Parameters

Template parameters can be mapped using fallback chains:
{
  "templateParameters": {
    "name": "name",
    "age": "age, default",
    "interests": "favoriteColor, favoriteSport, favoriteAnimal, default"
  }
}
This means:
  • name parameter uses the contact’s name field
  • age parameter tries age field first, falls back to template default
  • interests tries multiple fields in order, then defaults

Campaign Status

  • ACTIVE - Campaign is active and can be used in flows
  • PENDING - Campaign is pending approval or setup
  • DEPRECATED - Campaign is deprecated (still works but not recommended)
  • INACTIVE - Campaign is inactive
  • BLOCKED - Campaign is blocked (cannot be used)

Examples

Create Campaign

curl -X POST https://api.plati.ai/campaigns \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channelUid": "channel-uuid-123",
    "name": "Black Friday 2024",
    "status": "ACTIVE",
    "templateName": "black_friday_promo",
    "templateParamsStrategy": "USE_CONTACT_ASSOCIATION",
    "templateParameters": {
      "customerName": "name",
      "discount": "discountCode, default",
      "product": "lastPurchase, favoriteCategory, default"
    }
  }'

List Campaigns

curl -X GET "https://api.plati.ai/campaigns?workspaceId=1&status=ACTIVE&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"

Update Campaign

curl -X PATCH https://api.plati.ai/campaigns/campaign-uuid-123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "INACTIVE"
  }'

Next Steps