# Campaign
# Introduction
Promoting customer engagement is to make sure that your customers is awaring of what benefits they are going to earn as much as possible. WeOmniPlatform introduces a campaign platform that you can onboard your business campaigns and make them discoverable to your customers. WeCampaign is the platform that won't let your customers miss their special offers and keep them in seamless feeling with integration of well-known privilege platforms.
There are just 3 minimum things to do which are:
- Build configurable campaigns
- Discover matched campaigns
- Redeem desired campaigns
With these 3 things, it is enough to make sure that our deals will stay in our customer sights with controllable business rules and quota.
Now, WeCampaign supports scenarios of business campaigns such as:
- Freebie
- Bundle
- Discount
- Coupons
And supports control features such as:
- Project Based Campaigns
- Rule Matching.
- Active Period
- Quota
Moreover, to serve platform ecosystem, WeCampaign is opened for developers to contribute their adaptors to easily build their campaigns or integrate with other platforms such as loyalty, currency, or content platforms in platform federation.
# Creating a Campaign
This process will guide you to creation of campaign, if you already have a campaign you can Skip this process, and if you haven't create any project yet please goto Starter Guide.
After completion of creating a project, you will navigated to project's dashboard where several project management options are available according to your account level
On right side, there are management options. Click at Campaign(first option)
You will navigated to Campaign list, then click at top-right button that labeled as plus sign with text "Create a new Campaign"
Fill the creation form, if you have any question about Campaign creation please feel free to visit Basic campaign setup
Now you will see your campaign displayed in Campaign list
You can also using searching campaign by name, groupName, refCode and status by using search criteria fields like in picture. This is a partial search, so you can search with partial text.
# Basic Campaign Setup
WeOmniPlatform provides the web application to let the user manage their platforms more easier. Now, campaigns on WeCampaign can be managed in term of rules and quotas. This section is the part that explains how to set up campaign on WeBackoffice.
# New Campaign
To create a new campaign, when we have selected the project that we would like to work with, we have to click "Campaign" on the side bar menu to navigate to campaign list screen (default screen for campaign managment). At the top right, we can see the "Create a new campaign" button, and we just click that. Now, we are on the "New Campaign" page that we can set up our campaign before it is going to be launched. The first part is basic information for campaign.
Campaign Basic Fields Table
Field Name | Description |
---|---|
Name | The marketing name of the campaign |
Description | The overview explanation of the the campaign |
Image URL | Simple Image URL for marketing purpose. (Encourage to use CMS instead) |
Start Date | The date time that campaign is going to approximately start running |
End Date | The date time that campaign is going to approximately end running |
Ref Code | The unique that user have to define as the campaign reference |
Status | The value can be ENABLE or DISABLE. The campaign won't run if it is in DISABLE status |
Priority | The number to prioritize the campaign respectively which 1 is the most priority by default |
# Rule
Rule represents the business logic of the campaign.In a campaign, it can be built from many rules. A rule consists of two parts which are When and Then.
# Rule: When
A rule can consist of multiple When. When represents the composition of conditions. When all conditions have been met in all When once the user send matched attributes via /search or /redeem API, it will trigger Then as the result of the rule. A condition have these things inside:
When Condition Attributes Table
Field Name | Description |
---|---|
Attribute Type | The type of attribute that are sent from user to match the condition (please see Attribute Types Table) |
Attribute Name | The name of attribute that are sent from user to match the condition |
Operation | The operation to match the attribute (please see Operations Table) |
Value Type | The type of value (String or Number) |
Value | The value of the attribute considered to criteria for the condition |
Note | Just the note for the condition |
Attribute Types Table
Type | Description |
---|---|
Cart | The type that represents the cart of user (The condition with this attribute type must define attibute name following Cart Attribute Name Table) |
Cart Item | The type that represents the items in user's user (The condition with this attribute type must define attibute name following Cart Item Attribute Name Table) |
Custom | The type that user can define any attribute name in condition |
Cart Attribute Name Table
Attribute Name | Description |
---|---|
Total Price | The total price of the cart |
Currency | The currency of the total price |
Cart Item Attribute Name Table
Attribute Name | Description |
---|---|
SKU | SKU identifier of the cart item |
Amount | Amount of the items in the cart |
Price | Price of the items in the cart |
Tags | Related Tags of the items in the cart |
Condition Operation Table
Field Name | Description |
---|---|
eq | the input value must exactly match value |
neq | the input value must not match this value |
gt | the value must be greater than input value |
gte | the value must be greater than or equals input value |
lt | the value must be less than input value |
lte | the value must be less than input value |
in | the value has more than one possible values to match value must be in this format: ("value1","value2") Note : values of in operation is limited to 50 values. More than this, you should use tags attribute instead. (filtering by the value format can be seen in: Campaign Filtering (opens new window)) |
not_in | opposite of in operation |
matches | match string pattern |
not_matches | opposite of matches |
contains | the collection value must contain this value |
not_contains | the value must be less than input value |
# Exceed limit value of in operation
When you use in operation, the value is limited to 50. In another way, tags attribute is recommended for this solution. You should give a tag to each product which it is going to be applied by the campaign, then and only then you have to use the tag in request JSON. Using in operation with exceeding values would cause performance problem. The below examples are the things that you must Do and Don't.
Example: Creating campaign for 100 products called 50 percent discount for 100 products
Suppose you have 100 electronic products that are going to be put on sale of 50% discount and let says those 100 products are : fridge, kettle, microwave, TV and etc.
You must give a tag to each of them, let the tag is electronic, then use the tag in request JSON.
Request JSON : Do use tags attribute with contains operation
[{
"name": "50 percent discount for 100 products ",
"when": [{
"match": "ALL",
"conditions": [{
"type": "cartItem",
"attribute": "tags",
"op": "contains",
"value": "electronic",
"valueType": "STRING"
}]
}],
"thenOperator": "AND",
"then": [{
"action": "DISCOUNT",
"data": [{
"attribute": "amount",
"value": "50"
},
{
"attribute": "currency",
"value": "THB"
}]
}]
}]
Request JSON : Don't use in operation for SKU attribute
[{
"name": "50 percent discount for 100 products ",
"when": [{
"match": "ALL",
"conditions": [{
"type": "cartItem",
"attribute": "sku",
"op": "in",
"value": "(\"fridge\",\"kettle\",\"microwave\", ... )",
"valueType": "STRING"
}]
}],
"thenOperator": "AND",
"then": [{
"action": "DISCOUNT",
"data": [{
"attribute": "amount",
"value": "50"
},
{
"attribute": "currency",
"value": "THB"
}]
}]
}]
# Rule: Then
As same as When, a rule can consist of many When. It represents the related attributes of benefits that users should gain when they redeem the campaign.
Then Benefit Attributes Table
Field Name | Description |
---|---|
Attribute Name | The name of attribute that are sent to users representing information of benefit name |
Attribute Value | The value of attribute that are sent to users representing information of benefit value |
Is Formular | Represent that the attribute value has to be evaluated by expression |
# Operator
Benefit can be limited using Operator, it's a method that applies to multiple of Then rules within a campaign.
# Operator: Or
Applying Or operator to Then rules gives result of multiple selection of benefit in which client will have option to redeem promotions.
# Operator: And
Applying And operator to Then rules gives result of including all benefit when redeem.
# Quota
Campaign usage can be limited by quota configuration. Quota consists of 3 main things which are key, value, and valueField
# Quota: Value
The number that indicates limiting count or summation of the quota.
# Quota: Value Field
The field to sum value. It can refer to the value in search/redeem attributes or Then Benefit attributes
# Quota: Key
The quota key is a string that will be assigned to redemption transactions. In other word, we can say that it is label for redemption transaction to indicate quota portion that the transaction belong to. For example, if we have a quota with key "campaign001" and set value "10", it means that we cannot have transactions with label "campaign001" more than 10 transactions.
# Quota: Dynamic Keys
Each keys can be dynamic. When we put the expression ${your_attribute} in the quota key, the expression will be replaced by a request attribute or a Then Benefit attribute or reserved attributes.
# Quota: Reserved Attributes
Attribute Name | Description |
---|---|
campaignCode | Reference code of the campaign |
campaignId | UUID of the campaign |
channel | Channel of the campaign |
day | Day of month (1-31) |
month | Month of year (1-12) |
year | Year in AD |
# Quota: Example
- 100 transactions per campaign
{
"key": "${campaignCode}",
"value": 100
}
- 10 transactions per campaign per user
{
"key": "${campaignCode}-${userId}",
"value": 10
}
- 5 transactions per campaign per user per day
{
"key": "${campaignCode}-${userId}-${day}-${month}-${year}",
"value": 5
}
- 50 transactions per campaign per user per month
{
"key": "${campaignCode}-${userId}-${month}-${year}",
"value": 50
}
- 100 transactions per campaign per user per year
{
"key": "${campaignCode}-${userId}-${year}",
"value": 100
}
- 100000 points per campaign per user per year
{
"key": "${campaignCode}-${userId}-${year}-point",
"valueField": "point", // refer to point attribute in Then Benefit
"value": 100000
}
- search and redeem should include userId in attribute json node
{
"attribute": {
"userId": "USER000001",
...
},
"cart": {...}
}
# Marketplace Journey
For WeCampaign, the best user journey may be marketplace use cases. We commonly find every-day promotions in all popular marketplace applications. However, we don't want to stick with any specific kinds of applications. Marketplace application is just a familiar beginning before getting further on other applications.
The first concept of using WeCampaign on marketplace application is to collect the states the you think that they are necessary to be conditions in campaign redemption. Then just pass those states as search criteria through the search API, you will get benefit actions
After that, the application will be able to display benefits that user should be able to get based on returned benefit actions. Until the user decides to proceed checkout process (or any interaction that user will place transactions), the application redeems the benefits based on sent conditions get their confirmed benefits.
# Freebie
Freebie is the most common promotion you can think for marketplace application. Let say that we are selling product "A" on our application and we would like to give free product "B" to the buyers, how could it be done on WeCampaign?
We start from click "Create a new Campaign" button on campaign list page and put basic information for the campaign:
For the rules part, we set up the rule like this:
According to the campaign setting, you can see the expression '{cartItemSkuA01Amount}' that refers to item amount of sku A01 in the cart in term of buy 1 free 1.
In case of buy 2 free 1, you can express as '${cartItemSkuA01Amount}/2' (that you may need to floor the result of expression if the amount is not even number) or '${cartItemSkuA01Amount}*2' for buy 1 free 2
After the campaign has been correctly set and enabled the marketplace application will be able to communicate with WeCampaign with theses following sequences
Anytime user put an item into the cart and navigate to cart page, the application call /search with cart object in body that represents user's cart to WeCampaign
Search Request Body:
{
attribute: {...},
cart: {
totalPrice: "385",
currency: "THB",
items: [
{
sku: "A01",
amount: "1"
}
]
}
}
Search Response Body:
POST /search
{
actions: [
{
action: "FREE_GIFT",
actionRef: "909dc2e5-c667-4067-8b5e-e9076458aae7",
rule: {...},
campaign: {
refCode: "AGETB2019"
},
data: [
{ attribute: "sku", value: "B01"},
{ attribute: "amount", value: "1" }
]
}
]
}
After that, if the user decides to checkout the cart, the application have to call /redeem/campaign-code with the same body it called /search to WeCampaign. The redemption transaction will be recorded to WeCampaign.
Redeem Request Body:
POST /redeem/campaign-code
{
campaignCode: "AGETB2019",
attribute: {
...//same as search
},
cart: {
...//same as search
}
}
If we would like to see the whole process, the below diagram will describe it.
# Promo Code
For market place application, we usually publish our promo codes to promote our sales in a specific day. For example, we would like to create a campaign for 11/11 promo code to discount whole cart for 20 baht, we can create the campaign in WeBackoffice with rules like this:
If you have limited resources, you can set quota limit for the campaign. Let say we set it as 1000 times per campaign:
After you have created the campaign and make sure that it is active, the marketplace application can search by just putting promocode in custom attribute parameter along with cart items in the cart.
Search Request Body:
{
attribute: {
promoCode: "CODE1111_20"
},
cart: {
totalPrice: "38980",
currency: "THB",
items: [
{
sku: "OPPORENO10X",
amount: "1"
},
{
sku: "OPPOF9",
amount: "1"
}
]
}
}
Search Response Body:
POST /search
{
attribute: {
promoCode: "CODE1111_20"
},
actions: [
{
action: "CART_DISCOUNT",
actionRef: "909dc2e5-c667-4067-8b5e-e9076258aae7",
rule: {...},
campaign: {
refCode: "CODE1111"
},
data: [
{ attribute: "amount", value: "20" },
{ attribute: "currency", value: "THB"}
]
}
]
}
After the user decided to check out the cart, we can redeem the campaign by just using the campaign ref code and the same request body from search request in this redemption API call:
Redeem Request Body:
POST /redeem/campaign-code
{
campaignCode: "CODE1111",
attribute: {
//same as search
},
cart: {
//same as search
}
}
To wrap up the use case, we can look at the below sequence diagram:
# Freebie Selection
Let's think about freebie again. Sometime, we would like to have options for users because everyone loves options that they can choose by themselves. For this case, we can define when we create or editing our rules in 'then' part. There is a field with name 'operator' with values:AND, OR in dropdown. The operator AND means that users should take all then benefits defined in the rule. On the other hand, OR operator means that users can optionally takes only one or many benefits (This thing depends on interpretation of the application integrated with).
In the use case that we users will get "X" or "Y" product when they buy "A" product, we can set up the rule in then part like this (the conditions are the same with normal freebie case):
According to the campaign set up, when we search and the campaign matches with your searching, the actions should likely be this
"actions": [
{
"rule": {
"id": "e2fd185b-e3d4-461f-9055-4301f650b53c"
"thenOperator": "OR"
},
"campaign": {
"refCode": "FREEBIEXY"
},
"action": {
"action": "FREE_GIFT"
"actionRef": "3ad31331-d07d-4c70-b3af-86ca8395d8e4",
"data": [
{
"attribute": "sku",
"value": "X0001"
},
{
"attribute": "amount",
"value": "1"
}
]
}
},
{
"rule": {
"id": "e2fd185b-e3d4-461f-9055-4301f650b53c"
"thenOperator": "OR"
},
"campaign": {
"refCode": "FREEBIEXY"
},
"action": {
"action": "FREE_GIFT"
"actionRef": "3ad31331-d07d-4c70-b3af-86ca8395f2g6,
"data": [
{
"attribute": "sku",
"value": "Y0001"
},
{
"attribute": "amount",
"value": "1"
}
]
}
}
]
You can see that there is "OR" value in thenOperator" in the same rule that these two actions are belonging to. With this case, we will interprete this result that the user has to pick only one. So, when the user check out and redeem, the user will redeem only one from these two benefits by putting action ref in redemption request. If the user want to redeem only X0001, we can put only its "actionRef" in to the "actionRefs" array in the request.
Redeem Request Body:
POST /redeem/campaign-code
{
"campaignCode": "FREEBIEXY",
"actionRefs":["3ad31331-d07d-4c70-b3af-86ca8395d8e4"]
"attribute": {
//same as search
},
"cart": {
//same as search
}
}
Redeem Response Body:
POST /redeem/campaign-code
{
"actionTxs": [
{
"status": "COMPLETE",
"then": {
"action": "FREE_GIFT",
"actionRef": "3ad31331-d07d-4c70-b3af-86ca8395d8e4",
"data": [
{
"attribute": "sku",
"value": "X0001"
},
{
"attribute": "amount",
"value": "1"
}
]
}
}
]
}
Sequence Diagram:
# WeCampaign integrate with True You journey
Basic campaign setup for integrating with True You journey
- Campaign detail is similar to Campaign basic fields
- Setting rule When is similar to Campaign rule: When
- For rule Then, extra attributes must be added to the rule as they specify TruePoint used and TrueYou campaign code as client BFF has to redeem the point and the code to TrueYou for consistency between WeCampaign and TrueYou. You can use any attribute name but when redeeming, TruePoint and TrueYou campaign code must be collectedly redeem to TrueYou.
Example of rule Then:
...
"then": [
{
"action": "DISCOUNT",
"internalAction": false,
"actionRef": "be12c044-204b-4f22-a2f8-038c382bb472",
"data": [
{
"type": null,
"attribute": "amount",
"op": null,
"value": "20",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": null,
"attribute": "currency",
"op": null,
"value": "THB",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "use_point",
"op": null,
"value": "40",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "ty_code",
"op": null,
"value": "TY00001",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
]
...
- Campaign quota is similar to Campaign qouta
After you have followed all the steps, you will have a request that similar to the below example
Example of the request body
{
"createdBy": "66821078890",
"createdDate": "2020-03-13T06:38:11.793Z",
"lastModifiedBy": "66821078890",
"lastModifiedDate": "2020-03-17T07:33:42.655Z",
"id": "5e6b2a53879fc5000133c1e6",
"name": "True You electronic fair",
"description": null,
"startDate": "2020-03-10T17:00:00.000Z",
"endDate": "2020-03-14T17:00:00.000Z",
"refCode": "AAA",
"status": "ENABLE",
"channel": null,
"imageUrl": null,
"quotas": [
{
"id": null,
"key": "${day}-${month}-${year}",
"value": 500,
"description": null,
"valueField": "",
"campaign": null,
"projectId": null
}
],
"rules": [
{
"id": "6e20226e-86cd-40fb-9767-63584d7cc3c7",
"name": "TrueYou Electronic 20 THB off",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "cartItem",
"attribute": "tags",
"op": "contains",
"value": "apple",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "OR",
"then": [
{
"action": "DISCOUNT",
"internalAction": false,
"actionRef": "be12c044-204b-4f22-a2f8-038c382bb472",
"data": [
{
"type": null,
"attribute": "amount",
"op": null,
"value": "20",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": null,
"attribute": "currency",
"op": null,
"value": "THB",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "use_point",
"op": null,
"value": "40",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "ty_code",
"op": null,
"value": "TY00001",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
},
{
"action": "FREE_GIFT",
"internalAction": false,
"actionRef": "22da526e-d899-4024-b10f-b340a5b70ff9",
"data": [
{
"type": null,
"attribute": "sku",
"op": null,
"value": "cleaner X",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": null,
"attribute": "amount",
"op": null,
"value": "1",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "use_point",
"op": null,
"value": "90",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "ty_code",
"op": null,
"value": "TY00002",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
}
],
"projectId": "5d37e03673e87c00012c797d",
"version": 14,
"active": false
}
Sequence Diagram:
- When the cart is filling with items, Search API is fired to WeCampaign for available promotion
This is an example of request body:
{
"channel": "welove",
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"cart": {
"items": [
{
"name": "Ipad Pro 12.9",
"sku": "IPAD-2019",
"amount": 1,
"price": 39000,
"tags": [
"electronic",
"apple"
]
},
{
"name": "shampoo sunsilk",
"sku": "shampoo sunsilk mental cool",
"amount": 1,
"price": 180,
"tags": [
"shampoo"
]
}
]
}
}
- Suppose, TrueYou promotion is matched with the item in the cart and the Ref Code is DIST_CAMP_0071.(Note: This code is just a reference used between WeOmni platform and Client)
This is example of the response:
{
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"actions": [
{
"rule": {
"id": "6e20226e-86cd-40fb-9767-63584d7cc3c7",
"name": "TrueYou Electronic 20 THB off",
"thenOperator": "OR"
},
"campaign": {
"id": "5e6b2a53879fc5000133c1e6",
"name": "True You electronic fair",
"startDate": "2020-03-10T17:00:00Z",
"endDate": "2020-03-30T17:00:00Z",
"refCode": "DIST_CAMP_0071",
"imageUrl": null
},
"action": {
"action": "DISCOUNT",
"internalAction": false,
"actionRef": "be12c044-204b-4f22-a2f8-038c382bb472",
"data": [
{
"type": null,
"attribute": "amount",
"op": null,
"value": "20",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": null,
"attribute": "currency",
"op": null,
"value": "THB",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "use_point",
"op": null,
"value": "40",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "ty_code",
"op": null,
"value": "TY00001",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
}
]
}
Check with TrueYou for availability of True Point.
Affirmative response, which defines availability of True Point.
Redeem the promotion to WeCampaign.
This is an example of request body:
{
"campaignCode": "DIST_CAMP_0071",
"channel": "welove",
"attribute": {
"mobile": "081111111",
"action": "purchase",
"customerGrading": "diamond"
},
"cart": {
"items": [
{
"name": "Ipad Pro 12.9",
"sku": "IPAD-2019",
"amount": 1,
"price": 39000,
"tags": [
"electronic",
"apple"
]
},
{
"name": "shampoo sunsilk",
"sku": "shampoo sunsilk mental cool",
"amount": 1,
"price": 180,
"tags": [
"shampoo"
]
}
]
}
}
Affirmative response, which defines succession of the redeem.
Redeem to TrueYou for consistency of True Point.
Affirmative response, which defines succession of the redeem.
# WeCampaign customer grading
Sequence Diagram:
Basic campaign setup for the customer grading
- Create a campaign that suitable for grading the customers. The below request body is for creating the campaign:
Example of the request body
{
"createdBy": "trueid-21971788",
"createdDate": "2020-03-31T06:38:36.460Z",
"lastModifiedBy": "66821078890",
"lastModifiedDate": "2020-04-14T08:21:46.508Z",
"id": "5e82e56c879fc5000133c2a7",
"name": "Customer Grading",
"description": null,
"startDate": "2020-03-31T17:00:00.000Z",
"endDate": "2020-12-31T16:59:00.000Z",
"refCode": "TDGTIER",
"status": "ENABLE",
"channel": null,
"imageUrl": null,
"quotas": [],
"rules": [
{
"id": "448faf24-6aa2-47eb-b6b1-fdddf4de3a06",
"name": "blue4",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "aging_month",
"op": "gte",
"value": "0.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "lte",
"value": "12.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "1500.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "2000.0",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "e9640048-4718-42a9-926c-ded40fef43ec",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "blue",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "O",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8411",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "4f7e4d09-692c-4bd0-90ba-6114c90aeaa9",
"name": "blue1",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "60.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "250.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "600.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "bd9dcc50-19d5-4824-beb8-e4e43ccf7c9a",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "blue",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "O",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8414",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "74e0c188-1cfa-4b14-bbe8-d1dabb6816e8",
"name": "blue2",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "12.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "lte",
"value": "120.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "600.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "1000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "6a4081af-451a-4c34-b8cb-d4268dd3b1c2",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "blue",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "O",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8413",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "cee852f4-5679-46e1-957f-e8790a4e6063",
"name": "red2",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "24.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "1000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "1500.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "2248eeb3-ecc4-47aa-85c0-1e9312022dd7",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "red",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "G",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8208",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "85735252-9d9c-447f-9262-834a0a9586e3",
"name": "red1",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "120.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "600.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "1000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "29490c30-ccd5-4a96-904e-a3ee1a705d44",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "red",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "G",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8209",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "7130cca0-cbfe-4aa6-9fee-b37b6a1f7970",
"name": "black2",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "60.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "2000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "3000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "48802515-d406-45be-b8c1-6b7c7798306d",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "black",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "P",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8107",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "52268cce-10ea-494a-8920-ccdda1e29855",
"name": "black3",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "0.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "3000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "98481a64-9460-4c04-980f-59c9edaf5f8b",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "black",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "P",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8106",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "9b3184a9-18fa-43e3-b68d-62a563a7c124",
"name": "red3",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "12.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "lte",
"value": "120.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "1500.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "2000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "5c6ff907-afc3-41ab-a9d9-7bd3ff614a71",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "red",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "G",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8207",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "c55a3893-95f2-450e-9676-b4de87770adf",
"name": "blue3",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "aging_month",
"op": "gte",
"value": "0.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "lte",
"value": "24.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "1000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "1500.0",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "bab6ece1-23e5-4e38-8a29-0849a976d598",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "blue",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "O",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8412",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "d9babf5d-ba1d-42c8-90f0-13448bb87d35",
"name": "green2",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "aging_month",
"op": "gte",
"value": "0.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "lte",
"value": "12.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "600.0",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "1000.0",
"valueType": "STRING",
"note": "",
"resolveAction": false
},
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "94f20118-03a3-484c-9b2c-af4b7bba2e18",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "green",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "Y",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8512",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "8cfe81e0-4165-469a-88b8-e99b3dc52c0f",
"name": "green1",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gte",
"value": "0.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "250.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "600.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "lte",
"value": "60.0",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "b6d91659-3870-4741-ace5-c71790e4bbf4",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "green",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "Y",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8511",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "2ff7f9e5-68d2-404b-ac7a-99dc149cb200",
"name": "red4",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gte",
"value": "0.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "lte",
"value": "60.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "2000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "3000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "b00bec5f-8c8c-4207-9db1-c7572fc4d5e7",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "red",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "G",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8206",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
},
{
"id": "3e2ce906-de1f-462d-96c8-5c3af74ac07d",
"name": "black1",
"description": null,
"when": [
{
"match": "ALL",
"conditions": [
{
"type": "custom",
"attribute": "event",
"op": "eq",
"value": "grading",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "aging_month",
"op": "gt",
"value": "120.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "gte",
"value": "1500.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "spending",
"op": "lt",
"value": "2000.0",
"valueType": "NUMBER",
"note": null,
"resolveAction": false
}
]
}
],
"thenOperator": "AND",
"then": [
{
"action": null,
"internalAction": false,
"actionRef": "69079a35-c54f-4ddd-ba01-9aeafd6826f9",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "black",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "P",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8108",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
],
"validFrom": null,
"validTo": null,
"campaign": null
}
],
"projectId": "5d0b454f2c97280001d4076a",
"version": 46,
"active": true
}
- Request to get customer's grade with attributes aging_month, spending, event which are given in the creating campaign section. The below is an example of the request:
Example of the request body
{
"name": "payment",
"channel": "tsm",
"attribute": {
"aging_month": "2.0",
"spending": "250",
"event": "grading"
}
}
Example of the response
{
"attribute": {
"aging_month": "2.0",
"spending": "250",
"event": "grading"
},
"actions": [
{
"rule": {
"id": "8cfe81e0-4165-469a-88b8-e99b3dc52c0f",
"name": "green1",
"thenOperator": "AND"
},
"campaign": {
"id": "5e82e56c879fc5000133c2a7",
"name": "Customer Grading",
"startDate": "2020-03-31T17:00:00Z",
"endDate": "2020-12-31T16:59:00Z",
"refCode": "TDGTIER",
"imageUrl": null
},
"action": {
"action": null,
"internalAction": false,
"actionRef": "b6d91659-3870-4741-ace5-c71790e4bbf4",
"data": [
{
"type": "custom",
"attribute": "grade",
"op": null,
"value": "green",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "cust_type",
"op": null,
"value": "NOR",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "card_type",
"op": null,
"value": "Y",
"valueType": "STRING",
"note": null,
"resolveAction": false
},
{
"type": "custom",
"attribute": "reason_code",
"op": null,
"value": "8511",
"valueType": "STRING",
"note": null,
"resolveAction": false
}
]
}
}
]
}
← Starter Guide Coupon →