Skip to main content

Overview

Trigger campaigns enable on-demand messaging through webhook integrations and API calls. Unlike bulk campaigns that send once to everyone, trigger campaigns activate when external events occur, making them perfect for personalized, real-time communication.

Webhook Integration

Trigger messages from your app, website, or third-party services via API calls

Dynamic Personalization

Send personalized messages using data passed in the trigger request

How Trigger Campaigns Work

Trigger campaigns operate through a webhook-based system:
1

Set Up Campaign

Configure the campaign flow and map data attributes to message variables
2

Deploy Campaign

Activate the campaign to make it available for webhook triggers
3

Send API Requests

Trigger messages by sending POST requests with contact data to the campaign endpoint

Creating a Trigger Campaign

1. Start New Campaign

Navigate to Campaigns and click Create Campaign, then select Trigger. Create trigger campaign

2. Configure Trigger Node

Set up attribute mapping to define how data from API calls maps to contact attributes:
  • Phone Number Mapping: Map the field containing the contact’s phone number (required)
  • Custom Attributes: Map additional fields like name, email, purchase details
  • Data Validation: Define expected data types and required fields
[{
  "phone": "+1234567890",
  "name": "John Doe",
  "email": "[email protected]",
  "product": "Supima T-Shirt",
  "order_id": "ORD-12345"
}]

3. Add Message Actions

Configure the WhatsApp message to send when triggered:
  • Template Selection: Choose an approved WhatsApp template
  • Variable Mapping: Map API payload fields to template variables
  • Variable Replacement: All template variables will be replaced by contact attributes before sending the message
  • Personalization: Use dynamic data for personalized messaging

4. Deploy Campaign

Activate the campaign to start accepting webhook triggers:
  • Webhook URL: Copy the generated webhook endpoint
  • Authentication: Note any API keys or authentication requirements
  • Rate Limits: Review sending limits and throttling

API Integration

Webhook Endpoint

Once deployed, your trigger campaign exposes a webhook endpoint:
POST https://api.swiftsell.com/outbound/{campaignId}

Authentication

Include your API key in the request headers:
curl -X POST https://api.swiftsell.com/outbound/{campaignId} \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "name": "Customer Name",
    "product": "Product Name"
  }'

Request Schema

The API validates requests against your configured attribute mapping:
phone
string
required
Contact’s phone number in E.164 format (must map to phoneNumber attribute)
[custom_fields]
string
Any additional fields you’ve mapped in the trigger configuration

Campaign Status Management

Trigger campaigns have different status behaviors than bulk campaigns:
Campaign is configured but not accepting webhook triggers. Make configuration changes safely.
Active trigger campaigns will immediately process and send messages for valid API requests. Ensure your configuration is correct before deploying.

Use Cases

Send order confirmations, shipping updates, and delivery notifications triggered by purchase events in your store.
Notify customers when support tickets are created, updated, or resolved through your helpdesk system.
Send appointment confirmations and reminders triggered by your booking system or calendar.
Welcome new users and guide them through onboarding steps based on registration or first login events.
Re-engage customers who leave items in their cart with personalized reminder messages.

Best Practices

Data Mapping

  • Required Fields: Always map phone number to the phoneNumber attribute
  • Validation: Include data validation to prevent errors from malformed requests
  • Fallbacks: Plan for missing or invalid data in API payloads

Message Personalization

  • Dynamic Content: Use mapped attributes to personalize message content
  • Conditional Logic: Include fallback text for when optional data is missing
  • Testing: Test with various data scenarios before going live

Error Handling

  • Retry Logic: Implement retry mechanisms for failed API calls
  • Logging: Monitor API responses and error rates
  • Graceful Degradation: Handle cases where the webhook service is unavailable

Integration Examples

Shopify Integration

// Trigger campaign when order is created
app.post('/webhooks/orders/create', (req, res) => {
  const order = req.body

  // Send order confirmation via trigger campaign
  fetch(`https://api.swiftsell.com/outbound/${CAMPAIGN_ID}`, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      phone: order.billing_address.phone,
      name: order.billing_address.first_name,
      order_number: order.name,
      total_amount: order.total_price,
    }),
  })

  res.status(200).send('OK')
})

Zapier Integration

Connect trigger campaigns to 1000+ apps through Zapier webhooks:
  1. Create a Zap with your trigger app (Gmail, Google Sheets, etc.)
  2. Add a Webhook action pointing to your campaign endpoint
  3. Map form fields to your campaign’s attribute schema
  4. Test and activate the Zap

Monitoring and Analytics

Track trigger campaign performance through:
  • Request Volume: Monitor API request frequency and patterns
  • Success Rates: Track successful vs. failed message deliveries
  • Response Times: Monitor webhook response performance
  • Error Analysis: Review common failure reasons and validation errors
  • CSV Export: Download detailed campaign logs as a CSV file for comprehensive analytics, including phone numbers, template messages, delivery status, and specific error reasons for failed messages

Troubleshooting

Verify the campaign is in “Active” status and the webhook URL is correct. Check API authentication and request format.
Ensure phone numbers are in E.164 format (+country code + number) and properly mapped in the attribute configuration.
Check that all template variables have corresponding mapped attributes in the trigger configuration.
Monitor request frequency and implement appropriate throttling in your application to stay within API limits.

Next Steps