Trigger a campaign
Campaigns
Trigger Campaign
Triggers an API-triggered campaign to send messages to a specific audience
POST
Trigger a campaign
Overview
Triggers an API-triggered campaign to send messages to a specific audience. This endpoint allows you to send immediate, one-off messages to designated users or broadcast to your entire audience using a pre-configured campaign. For a comprehensive guide on setting up and using API-triggered campaigns, see the API-Triggered Campaigns guide.Authentication
This endpoint requires authentication via the following HTTP headers:X-Clix-Project-ID: Your project IDX-Clix-API-Key: Your Clix Secret API Key
Path Parameters
Request Body
Audience Object
Target Object
Each target should specify one of the following:Properties
Custom properties are passed as key-value pairs and can be used for:- Message personalization: Insert values in message templates using
{{ trigger.property_name }} - Dynamic audience filtering: Reference values in audience conditions configured in the console
Example Requests
Broadcast to All Eligible Users
Send to all users matching the campaign’s segment definition:Target Specific Users
Send to specific users, but only those who match the campaign’s segment definition:Trigger Without Audience (Uses Campaign’s Default Audience)
Dynamic Filtering and Personalization
This example shows how to use properties for both audience filtering and message content. Campaign configuration in console:- Audience filter:
user_role == "store_staff" AND store_location == {{ trigger.store_location }} - Message title:
New pickup order - Message body:
Order #{{ trigger.order_id }} from {{ trigger.customer_name }}. {{ trigger.item_count }} items ready by {{ trigger.pickup_time }}.
- Filter to users where
user_role == "store_staff"ANDstore_location == "San Francisco" - Send a message with title “New pickup order”
- And body “Order #ORD-12345 from Sarah Johnson. 3 items ready by 2:30 PM.”
Response
Success Response (200 OK)
Returns a trigger identifier for tracking the campaign send:trigger_id can be used to track the status and results of this specific campaign trigger.
Error Responses
400 Bad Request
Returned when:campaign_idis missing or invalid- Request body is malformed
- Failed to send campaign trigger message
401 Unauthorized
Authentication failed or invalid API key.Notes
- Campaign must be configured as “API-Triggered” in the dashboard before it can be triggered via this endpoint
- Segment Filtering: All messages are filtered by the campaign’s segment definition:
- When
broadcastistrue, the campaign sends to all users who match the campaign’s segment criteria - When
broadcastisfalse(or omitted) andtargetsare specified, only the targeted users who also match the campaign’s segment criteria will receive the message - Users who don’t match the segment criteria will not receive messages, even if explicitly targeted
- When
- When targeting specific users, you can mix different target types (device_id, user_id, project_user_id) in the same request
- Properties are optional but highly recommended for personalized messaging
- The
trigger_idin the response can be used to track delivery results and campaign analytics - Message delivery is asynchronous - the API returns immediately with a trigger_id, and messages are processed in the background
- Rate limits apply based on your project plan
Authorizations
Project ID for authentication
API Key for authentication
Path Parameters
The unique identifier of the campaign to trigger
Body
application/json
Campaign trigger configuration
Response
Campaign triggered successfully
Response containing the trigger ID
Unique identifier for this campaign trigger