Create Campaign
Campaigns are the core of your loyalty program. See the sample example of how this can be configured. Links to more detailed instructions can be found at the end of the article.
How this example works
OpenLoyalty allows you to create various types of campaigns to engage and reward your customers. You can set up point-based campaigns, referral campaigns, or even time-based promotions.
Creating campaigns is a complex process, but using the admin panel can simplify it.
In this example, we will create a campaign that rewards a member with 100 points for each transaction.
Try yourself
Create a campaign Endpoint:
POST /api/{storeCode}/campaign
{ "campaign": { "type": "direct", "trigger": "transaction", "translations": { "en": { "name": "Get 100 points for any transaction", "description": "" } }, "activity": { "startsAt": "2024-01-01 00:00+00:00", "endsAt": null }, "rules": [ { "effects": [ { "effect": "give_points", "pointsRule": "100", "walletCode": "default" } ] } ], "labels": [], "limits": {}, "active": true } }
Endpoints used
This method allows creating a new Campaign.
Store code
POST /api/{storeCode}/campaign HTTP/1.1
Host: openloyalty.localhost
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 776
{
"campaign": {
"translations": {
"en": {
"name": "text",
"description": "text"
},
"pl": {
"name": "text",
"description": "text"
}
},
"displayOrder": 1,
"type": "direct",
"trigger": "transaction",
"triggerStrategy": {
"type": "daily"
},
"activity": {
"startsAt": "2025-07-09T13:18:30.816Z",
"endsAt": "2025-07-09T13:18:30.816Z"
},
"labels": [
{
"key": "text",
"value": "text"
}
],
"visibility": {
"target": "segment"
},
"audience": {
"target": "segment"
},
"active": true,
"rules": [
{
"name": "text",
"description": "text",
"effects": [
{
"effect": "give_points",
"data": {}
}
],
"conditions": [
{
"attribute": "text",
"operator": "expression"
}
]
}
],
"limits": {
"points": {
"interval": {
"type": "days",
"value": 1
},
"value": 1
},
"pointsPerMember": {
"interval": {
"type": "days",
"value": 1
},
"value": 1
},
"executionsPerMember": {
"interval": {
"type": "days",
"value": 1
},
"value": 1
}
}
}
}
{
"campaignId": "00000000-0000-0000-0000-000000000000"
}
More resources
For a detailed overview and description of the campaign creation and management, please refer to these series of articles:
CampaignsIn this section, you will get to know everything related to Campaigns.Last updated
Was this helpful?