Personalizing Campaign Content

A campaign's content isn't static - it can pull in details specific to the customer reading it, so "you spent $340 on dining out this month" reads as a real observation, not a template.

Content variables

GET /drive-api/v1/campaigns/content-variables

Lists every variable available for use inside a headline or message, along with the parameters each one takes:

{
  "name": "total_spending_per_category",
  "label": "Total Spending Per Category",
  "description": "The customer's total spend in a given category over a time window.",
  "type": "currency",
  "parameters": [
    { "name": "category", "type": "category_l2", "label": "Category" },
    { "name": "intervals", "type": "integer", "label": "Intervals" },
    { "name": "interval_type", "type": "interval_type", "label": "Interval Type" }
  ]
}

Reference a variable in your content with {{ }} - for example, {{ first_name }} for a simple field, or {{ total_spending_per_category "eating_out" 9 "WEEK" }} for one that takes parameters.

Editing draft content

Campaign content is edited as a draft and only goes live when you (re)publish the campaign:

GET /drive-api/v1/campaigns/{campaign_id}/content

Returns both the current (live) content and any draft in progress, so you can compare before publishing:

PUT /drive-api/v1/campaigns/{campaign_id}/content
{
  "name": "This is a new campaign - updated!",
  "audience": "b308ce11-50ff-4a85-aa49-5124d04bdb30",
  "channels": {
    "web": {
      "headline": "This is your new headline",
      "message": "Welcome to this campaign"
    }
  },
  "schedule": { "type": "when_published" },
  "duration": { "intervals": 90, "interval_type": "DAY" }
}

Once the draft looks right, publish it with PUT /drive-api/v1/campaigns/{campaign_id}/status (see Creating and Managing Campaigns).


Did this page help you?