Creating a sub campaign (reward campaign)

The sub-campaign consists of a reward logic, limitation rules, and optionally, a trigger (if the campaign is automated). As previously mentioned, this type of campaign needs to have a parent which will be the main campaign we just created.

In case you'd like the campaign to generate voucher(s) automatically, you will have to set the parameter triggers_on. It determines what kind of trigger will this campaign react on. In our case, we set it to "redemption", which means sub-campaign will be triggered by any redemption sent to our API.

Here are some examples of possible campaign configurations:

curl --request POST \
     --user "username:password" \
     --url "https://preview.vouchery.io/api/v2.0/campaigns" \
     --header "Content-Type: application/json" \
     --data \ 
'
{
    "type": "SubCampaign",
    "triggers_on": "redemption",
    "parent_id": 2,
    "name": "Test Sub Campaign",
    "customer_information": "customer_information Text that can be displayed to the customer once the redemption is validated or confirmed.",
    "max_total_budget": 20000
}
'
{
    "type": "SubCampaign",
    "id": 4,
    "triggers_on": "redemption",
    "status": "draft",
    "name": "Test Sub Campaign",
    "description": null,
    "customer_information": "customer_information Text that can be displayed to the customer once the redemption is validated or confirmed.",
    "currency": "GBP",
    "currency_symbol": "£",
    "voucher_type": null,
    "max_redemptions": null,
    "team": null,
    "channel": null,
    "purpose": null,
    "medium": null,
    "budget_code": null,
    "start_at": null,
    "end_at": null,
    "created_at": "2019-06-03T08:57:20.631Z",
    "updated_at": "2019-06-06T13:48:45.529Z",
    "parent_id": 3,
    "max_total_budget": 20000,
    "minimum_value": null,
    "maximum_value": null,
    "vouchers_count": 0,
    "vouchers_distributed_count": 0,
    "redemptions_count": 0,
    "total_budget_spent": 0,
    "vouchers_file_name": "BAgiG3Rlc3Rwcm9qZWN0L0NhbXBhaWduLzQ%3D--1bfcd96b345e8acd0ead2e3769116d2d29a491d6",
    "created_by": {
        "email": "[email protected]",
        "name": null
    },
    "updated_by": {
        "email": "[email protected]",
        "name": null
    }
}