Customizing rewards using campaigns

Using campaigns to control the look and feel of the rewards you send.

You may have noticed that rewards you've sent have used boilerplate language and branding. This guide will explain how to add those things using campaigns.

Campaigns

Campaigns are reusable templates that group together design, copy, and product selection settings for rewards. They're useful when you're sending similar rewards to different recipients over time.

Campaigns let you customize design and copy

By using campaigns, you can insert your organization's branding into the reward, and customize the copy that your recipients will see.

Campaigns store product sets

When creating a campaign, you'll also select which products the recipients can choose from. The products that you select will be the products available to recipients for each reward sent using this campaign.

Using campaigns in the API

Incorporating campaigns into your API calls can further simplify your integration.

1. Create a campaign

To create a campaign, first log into the dashboard. Click on "Campaign templates" to access your campaigns, and follow the steps shown to create one.

2. Obtain your campaign ID

Once you've created a campaign, you'll need to obtain it's ID so you can use it in the API. There are two ways to do this:

Via UI
Log into the web dashboard and click on Campaign Templates in the sidebar. You'll see the ID associated with the campaign:

Via API
You can query for campaign templates directly from the API with this call:

curl --header 'Authorization: Bearer YOUR-API-KEY-HERE'\
     --url 'https://testflight.tremendous.com/api/v2/campaigns'

It will return a response similar to what's shown below. Grab the ID of the campaign that you'd like to use.

{
  "campaigns": [
    {
      "id": "YMS6V0BPDVJT",
      "products": [
        "SRDHFATO9KHN",
        "OKMHM2X2OHYV",
        "Q24BD9EZ332JT",
        "KV934TZ93NQM"
      ],
      "description": "Campaign for demoing the API",
      "name": "My Custom Campaign"
    }
  ]
}

Pass the campaign_id into the payload when creating an order

The campaign_id gets passed into the reward object that is nested in the payload. Also, because a campaign includes a product set, you can omit the products key from the payload

🚧

If you provide both a campaign_id and an array of products , the products field will take precedence over the products configured in the campaign. This can be useful if you want to use the branding from a campaign, but alter the products available on the fly.

This is rarely used, and so you should probably omit the products field from a reward.

Here's an example order creation query that uses a campaign_id to specify the design, copy, and products available for a reward:

curl --url 'https://testflight.tremendous.com/api/v2/orders' \
     --header 'Authorization: Bearer YOUR-API-KEY' \
     --header 'Content-Type: application/json' \
     --data '
{
    "payment": {
        "funding_source_id": "YOUR-FUNDING-SOURCE-ID"
    },
    "reward": {
        "value": {
            "denomination": 50
        },
        "delivery": {
            "method": "EMAIL"
        },
        "recipient": {
            "name": "Jane Doe",
            "email": "[email protected]"
        },
        "campaign_id": "YOUR-CAMPAIGN-ID"
    }
}
'

Voila! We've programmatically created a reward with a custom look and feel.