Campaigns
Create ruleset (V2)
Changed on[!note] Management API endpoints are not meant to be used in real-time integrations that directly serve your end users. Rate limit: 3 requests per second.
Create a ruleset from promotion and strikethrough rules in the V2 JSON block format. A ruleset is a revision of all the rules of a campaign.
Only the first block of a rule can be a condition. Every other block must be an effect.
post/v2/applications/{applicationId}/campaigns/{campaignId}/rulesets
Request
- Base URLhttps://yourbaseurl.talon.one
- Auth
- API key in header Authorization
- or API key in header Authorization
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
applicationIdinteger required
The ID of the Application. It is displayed in your Talon.One deployment URL.
campaignIdinteger required
The ID of the campaign. It is displayed in your Talon.One deployment URL.
Request body
Example request
{
"id": 6,
"userId": 385,
"campaignId": 320,
"templateId": 3,
"promotionRules": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"title": "10% off for loyalty members",
"blocks": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
]
}
],
"strikethroughRules": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"title": "10% off for loyalty members",
"blocks": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
]
}
],
"selectors": [
{
"name": "discountedCartItems",
"type": "selector",
"source": "$Session.CartItems",
"steps": [
{
"type": "filter",
"predicate": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
]
}
],
"bundles": [
{
"id": "1b671a64-40d5-491e-99b0-da01ff1f3341",
"name": "meal_deal",
"type": "bundle",
"sources": [
"{{$mains}}",
"{{$drinks}}"
],
"counts": [
1,
2
],
"matchers": [
"color"
]
}
],
"parameters": [
{
"name": "minCartTotal",
"value": 50,
"valueType": "number",
"maxValue": 10000,
"description": "Minimum cart total to trigger the campaign.",
"attribute": 42
}
]
}Response
Created
Example response
{
"id": 6,
"userId": 385,
"campaignId": 320,
"templateId": 3,
"promotionRules": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"title": "10% off for loyalty members",
"blocks": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
]
}
],
"strikethroughRules": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"title": "10% off for loyalty members",
"blocks": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
]
}
],
"selectors": [
{
"name": "discountedCartItems",
"type": "selector",
"source": "$Session.CartItems",
"steps": [
{
"type": "filter",
"predicate": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}
]
}
],
"bundles": [
{
"id": "1b671a64-40d5-491e-99b0-da01ff1f3341",
"name": "meal_deal",
"type": "bundle",
"sources": [
"{{$mains}}",
"{{$drinks}}"
],
"counts": [
1,
2
],
"matchers": [
"color"
]
}
],
"parameters": [
{
"name": "minCartTotal",
"value": 50,
"valueType": "number",
"maxValue": 10000,
"description": "Minimum cart total to trigger the campaign.",
"attribute": 42
}
]
}Changes
- info
endpoint added
- info