Campaign templates

Create campaign from campaign template

[!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.

Use the campaign template referenced in the request body to create a new campaign in one of the connected Applications.

If the template was created from a campaign with rules referencing campaign collections, the corresponding collections for the new campaign are created automatically.

post/v1/applications/{applicationId}/create_campaign_from_template

Request

Path parameters

applicationIdinteger required

The ID of the Application. It is displayed in your Talon.One deployment URL.

Request body

namestring required

A user-facing name for this campaign.

descriptionstring

A detailed description of the campaign.

templateIdinteger required

The ID of the Campaign Template which will be used in order to create the Campaign.

campaignAttributesOverridesobject

Custom Campaign Attributes. If the Campaign Template defines the same values, they will be overridden.

campaignGroupsinteger[]

The IDs of the campaign groups this campaign belongs to.

tagsstring[]

A list of tags for the campaign. If the campaign template has tags, they will be overridden by this list.

evaluationGroupIdinteger

The ID of the campaign evaluation group the campaign belongs to.

linkedStoreIdsinteger[]

A list of store IDs that are linked to the campaign.

Note: Campaigns with linked store IDs will only be evaluated when there is a customer session update that references a linked store.

Example request

{
  "name": "Discount campaign",
  "description": "This template is for discount campaigns.",
  "templateId": 4,
  "templateParamValues": [
    {
      "name": "Discount percentage",
      "type": "templateParameter",
      "expression": [
        "identity",
        10
      ],
      "valueType": "number",
      "maxValue": 19.9,
      "attributeId": 100,
      "description": "The percentage discount applied to the cart total."
    }
  ],
  "limitOverrides": [
    {
      "action": "createCoupon",
      "limit": 1000,
      "period": "yearly",
      "entities": [
        "Coupon"
      ]
    }
  ],
  "campaignGroups": [
    1,
    3
  ],
  "tags": [
    "summer"
  ],
  "evaluationGroupId": 2,
  "linkedStoreIds": [
    1,
    2,
    3
  ]
}

Response

Created

Example response

{
  "campaign": {
    "id": 4,
    "created": "2020-06-10T09:05:27.993483Z",
    "applicationId": 322,
    "userId": 388,
    "name": "Summer promotions",
    "description": "Campaign for all summer 2021 promotions",
    "startTime": "2021-07-20T22:00:00Z",
    "endTime": "2021-09-22T22:00:00Z",
    "state": "enabled",
    "activeRulesetId": 6,
    "tags": [
      "summer"
    ],
    "reevaluateOnReturn": true,
    "features": [
      "coupons",
      "referrals"
    ],
    "couponSettings": {
      "validCharacters": [
        "A",
        "B",
        "C",
        "D",
        "E",
        "F",
        "G",
        "H",
        "I",
        "J",
        "K",
        "L",
        "M",
        "N",
        "O",
        "P",
        "Q",
        "R",
        "S",
        "T",
        "U",
        "V",
        "W",
        "X",
        "Y",
        "Z",
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9"
      ],
      "couponPattern": "SUMMER-####-####"
    },
    "referralSettings": {
      "validCharacters": [
        "A",
        "B",
        "C",
        "D",
        "E",
        "F",
        "G",
        "H",
        "I",
        "J",
        "K",
        "L",
        "M",
        "N",
        "O",
        "P",
        "Q",
        "R",
        "S",
        "T",
        "U",
        "V",
        "W",
        "X",
        "Y",
        "Z",
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9"
      ],
      "couponPattern": "SUMMER-####-####"
    },
    "limits": [
      {
        "action": "createCoupon",
        "limit": 1000,
        "period": "yearly",
        "entities": [
          "Coupon"
        ]
      }
    ],
    "campaignGroups": [
      1,
      3
    ],
    "type": "advanced",
    "linkedStoreIds": [
      1,
      2,
      3
    ],
    "budgets": [
      {
        "action": "createCoupon",
        "limit": 1000,
        "counter": 42
      }
    ],
    "couponRedemptionCount": 163,
    "referralRedemptionCount": 3,
    "discountCount": 288,
    "discountEffectCount": 343,
    "couponCreationCount": 16,
    "referralCreationCount": 8,
    "awardedGiveawaysCount": 9,
    "createdLoyaltyPointsCount": 9,
    "createdLoyaltyPointsEffectCount": 2,
    "redeemedLoyaltyPointsCount": 8,
    "redeemedLoyaltyPointsEffectCount": 9,
    "reservecouponEffectCount": 9,
    "lastActivity": "2022-11-10T23:00:00Z",
    "updated": "2022-10-27T15:00:00Z",
    "createdBy": "John Doe",
    "updatedBy": "Jane Doe",
    "templateId": 3,
    "frontendState": "running",
    "storesImported": true,
    "valueMapsIds": [
      100,
      215
    ],
    "experimentId": 1,
    "revisionFrontendState": "revised",
    "activeRevisionId": 6,
    "activeRevisionVersionId": 6,
    "version": 6,
    "currentRevisionId": 6,
    "currentRevisionVersionId": 6
  },
  "ruleset": {
    "id": 6,
    "created": "2020-06-10T09:05:27.993483Z",
    "userId": 388,
    "rules": [
      {
        "id": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "parentId": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "title": "Give discount via coupon",
        "description": "Creates a discount when a coupon is valid",
        "bindings": [
          {
            "name": "Discount percentage",
            "type": "templateParameter",
            "expression": [
              "identity",
              10
            ],
            "valueType": "number",
            "maxValue": 19.9,
            "attributeId": 100,
            "description": "The percentage discount applied to the cart total."
          }
        ],
        "condition": [
          "and",
          [
            "couponValid"
          ]
        ],
        "effects": [
          "catch",
          [
            "noop"
          ],
          [
            "setDiscount",
            "10% off",
            [
              "*",
              [
                ".",
                "Session",
                "Total"
              ],
              [
                "/",
                10,
                100
              ]
            ]
          ]
        ]
      }
    ],
    "strikethroughRules": [
      {
        "id": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "parentId": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "title": "Give discount via coupon",
        "description": "Creates a discount when a coupon is valid",
        "bindings": [
          {
            "name": "Discount percentage",
            "type": "templateParameter",
            "expression": [
              "identity",
              10
            ],
            "valueType": "number",
            "maxValue": 19.9,
            "attributeId": 100,
            "description": "The percentage discount applied to the cart total."
          }
        ],
        "condition": [
          "and",
          [
            "couponValid"
          ]
        ],
        "effects": [
          "catch",
          [
            "noop"
          ],
          [
            "setDiscount",
            "10% off",
            [
              "*",
              [
                ".",
                "Session",
                "Total"
              ],
              [
                "/",
                10,
                100
              ]
            ]
          ]
        ]
      }
    ],
    "bindings": [],
    "rbVersion": "v2",
    "activate": true,
    "campaignId": 320,
    "templateId": 3
  },
  "collections": [
    {
      "id": 6,
      "created": "2020-06-10T09:05:27.993483Z",
      "accountId": 3886,
      "modified": "2021-09-12T10:12:42Z",
      "description": "My collection of SKUs",
      "subscribedApplicationsIds": [
        1,
        2,
        3
      ],
      "name": "My collection",
      "modifiedBy": 48,
      "createdBy": 134,
      "applicationId": 1,
      "campaignId": 7,
      "payload": [
        "KTL-WH-ET-1",
        "KTL-BL-ET-1"
      ]
    }
  ]
}

Changes

No recorded changes to this operation across all 2 revisions of this API.