LogoLogo
HomepageCase studiesBook a demo
Technical Guide
Technical Guide
  • Introduction
  • Getting Started Guide
    • Authentication
    • Member Registration Configuration
    • Add Webhook
    • Add Member
    • Create Campaign
    • Add Transaction
    • Add Custom Event Schema
    • Create Achievement
    • Add Custom Event
  • Terms Reference
  • Backward Compatibility Policy
  • API Reference
  • Postman Collection
  • User Guide
  • Integration
    • Introduction
    • Overview of Integration Methods
    • Tools and Technologies
    • Integration Examples
      • Lambda
      • Zapier
      • AWS EventBridge
      • Kafka
  • API Fundamentals
    • Overview
    • Environments Capabilities
    • How to Query
    • Limits
    • Best Practices
  • Authentication
    • Admin Token
    • Access Token (API Key)
    • Enabling SSO Login
      • Okta
      • Microsoft Entra ID
  • Webhooks
    • Overview
    • Best Practices
  • S3 Bucket Data exports
    • Overview
    • Set Up S3 Bucket Integration
    • Data Structure and Types
      • Achievements
      • Achievement Usage
      • Campaigns
      • Campaign Calculated Effect Result
      • Campaign Execution
      • Custom Events
      • Members
      • Rewards
      • Rewards Redemption
      • Tiers
      • Transactions
      • Tenants
      • Unit Transfers
Powered by GitBook
  1. Getting Started Guide

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.

Last updated 10 months ago

Was this helpful?

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

  • Input the previous saved and in the request header

  • 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


More resources

For a detailed overview and description of the campaign creation and management, please refer to these series of articles:

token
storeCode
CampaignsIn this section, you will get to know everything related to Campaigns.

Create a new campaign

post

This method allows creating a new Campaign.

Authorizations
Path parameters
storeCodestringRequired

Store code

Body
one ofOptional
or
or
Responses
200
Return created campaign ID.
application/json
400
Bad request.
application/json
401Error
application/json
403
Forbidden.
application/json
404
Not found.
application/json
post
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-05-09T06:03:47.583Z",
      "endsAt": "2025-05-09T06:03:47.583Z"
    },
    "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"
}