younifyd
Menu

Create Campaign From Template

Create campaign from campaign template

POST/v1/applications/{applicationId}/create_campaign_from_template

Use it in a workflow

  1. Add a step and choose the Talon.One connector.
  2. Pick the Create Campaign From Template action (under management).
  3. Fill in the fields below, then reference the result from later steps as {{createCampaignFromTemplate.response.data}}.

Request

Path parameters

applicationIdinteger (int64)required

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

Request body

Enter the body as JSON in the step's Body field.

namestringrequired

A user-facing name for this campaign.

descriptionstring

A detailed description of the campaign.

templateIdinteger (int64)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.

templateParamValuesarray<object>

Actual values to replace the template placeholder values in the Ruleset bindings. Values for all Template Parameters must be provided.

namestringrequired

A descriptive name for the value to be bound.

typestring

The kind of binding. Possible values are: - `bundle` - `cartItemFilter` - `subledgerBalance` - `templateParameter`

expressionarray<object>required

A Talang expression that will be evaluated and its result attached to the name of the binding.

valueTypestring

Can be one of the following: - `string` - `number` - `boolean`

minValuenumber

The minimum value allowed for this placeholder.

maxValuenumber

The maximum value allowed for this placeholder.

attributeIdinteger (int64)

Id of the attribute attached to the placeholder.

descriptionstring

Describes the placeholder field and value in the template. This description can be used when creating campaigns from this template.

limitOverridesarray<object>

Limits for this Campaign. If the Campaign Template or Application define default values for the same limits, they will be overridden.

actionstringrequired

The limitable action to which this limit applies. For example: - `setDiscount` - `setDiscountEffect` - `redeemCoupon` - `createCoupon`

limitnumberrequired

The value to set for the limit.

periodstring

The period on which the budget limit recurs.

One ofdailyweeklymonthlyyearly

entitiesarray<string>required

The entity that this limit applies to.

campaignGroupsarray<integer (int64)>

The IDs of the [campaign groups](https://docs.talon.one/docs/product/account/account-settings/managing-campaign-groups) this campaign belongs to.

tagsarray<string>

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

evaluationGroupIdinteger (int64)

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

linkedStoreIdsarray<integer (int64)>

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](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) that references a linked store.

json
{
  "name": "Discount campaign",
  "templateId": 4,
  "description": "This template is for discount campaigns.",
  "campaignAttributesOverrides": {},
  "templateParamValues": [
    {
      "attributeId": 100,
      "minValue": 0,
      "expression": [
        "string1",
        "string2"
      ],
      "maxValue": 19.9,
      "valueType": "string",
      "name": "my property",
      "description": "This is a template parameter of type `number`.",
      "type": "templateParameter"
    }
  ],
  "limitOverrides": [
    {
      "period": "yearly",
      "entities": [
        "Coupon"
      ],
      "limit": 1000,
      "action": "createCoupon"
    }
  ],
  "campaignGroups": [
    1,
    3
  ],
  "tags": [
    "summer"
  ],
  "evaluationGroupId": 2,
  "linkedStoreIds": [
    1,
    2,
    3
  ]
}

Response

Returns 201 with an object. Read it in later steps with {{createCampaignFromTemplate.response.data.<field>}}.

campaignobject
idinteger (int64)required

Unique ID for this entity.

createdstring (date-time)required

The exact moment this entity was created.

applicationIdinteger (int64)required

The ID of the Application that owns this entity.

userIdinteger (int64)required

The ID of the user associated with this entity.

namestringrequired

A user-facing name for this campaign.

descriptionstringrequired

A detailed description of the campaign.

startTimestring (date-time)

Timestamp when the campaign will become active.

endTimestring (date-time)

Timestamp when the campaign will become inactive.

attributesobject

Arbitrary properties associated with this campaign.

statestringrequired

A disabled or archived campaign is not evaluated for rules or coupons.

One ofenableddisabledarchivedDefault "enabled"

activeRulesetIdinteger (int64)

[ID of Ruleset](https://docs.talon.one/management-api#tag/Campaigns/operation/getRulesets) this campaign applies on customer session evaluation.

tagsarray<string>required

A list of tags for the campaign.

reevaluateOnReturnbooleanrequired

Indicates whether this campaign should be reevaluated when a customer returns an item.

featuresarray<string>required

The features enabled in this campaign.

couponSettingsobject2 fields
referralSettingsobject2 fields
limitsarray<object>required4 fields

The set of [budget limits](https://docs.talon.one/docs/product/campaigns/settings/managing-campaign-budgets) for this campaign.

campaignGroupsarray<integer (int64)>

The IDs of the [campaign groups](https://docs.talon.one/docs/product/account/managing-campaign-groups) this campaign belongs to.

typestringrequired

The campaign type. Possible type values: - `cartItem`: Type of campaign that can apply effects only to cart items. - `advanced`: Type of campaign that can apply effects to customer sessions and cart items.

One ofcartItemadvancedDefault "advanced"

linkedStoreIdsarray<integer (int64)>

A list of store IDs that you want to link to the campaign. **Note:** Campaigns with linked store IDs will only be evaluated when there is a [customer session update](https://docs.talon.one/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) that references a linked store.

couponAttributesobject

Arbitrary properties associated with coupons in this campaign.

budgetsarray<object>3 fields

A list of all the budgets that are defined by this campaign and their usage. **Note:** Budgets that are not defined do not appear in this list and their usage is not counted until they are defined.

couponRedemptionCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Number of coupons redeemed in the campaign.

referralRedemptionCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Number of referral codes redeemed in the campaign.

discountCountnumber

This property is **deprecated**. The count should be available under *budgets* property. Total amount of discounts redeemed in the campaign.

discountEffectCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of times discounts were redeemed in this campaign.

couponCreationCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of coupons created by rules in this campaign.

customEffectCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of custom effects triggered by rules in this campaign.

referralCreationCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of referrals created by rules in this campaign.

addFreeItemEffectCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of times the [add free item effect](https://docs.talon.one/docs/dev/integration-api/api-effects#addfreeitem) can be triggered in this campaign.

awardedGiveawaysCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of giveaways awarded by rules in this campaign.

createdLoyaltyPointsCountnumber

This property is **deprecated**. The count should be available under *budgets* property. Total number of loyalty points created by rules in this campaign.

createdLoyaltyPointsEffectCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of loyalty point creation effects triggered by rules in this campaign.

redeemedLoyaltyPointsCountnumber

This property is **deprecated**. The count should be available under *budgets* property. Total number of loyalty points redeemed by rules in this campaign.

redeemedLoyaltyPointsEffectCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of loyalty point redemption effects triggered by rules in this campaign.

callApiEffectCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of webhooks triggered by rules in this campaign.

reservecouponEffectCountinteger (int64)

This property is **deprecated**. The count should be available under *budgets* property. Total number of reserve coupon effects triggered by rules in this campaign.

lastActivitystring (date-time)

Timestamp of the most recent event received by this campaign.

updatedstring (date-time)

Timestamp of the most recent update to the campaign's property. Updates to external entities used in this campaign are **not** registered by this property, such as collection or coupon updates.

createdBystring

Name of the user who created this campaign if available.

rulesetobject
idinteger (int64)required

The internal ID of this entity.

createdstring (date-time)required

The time this entity was created.

userIdinteger (int64)required

The ID of the user associated with this entity.

rulesarray<object>required7 fields

Set of rules to apply.

strikethroughRulesarray<object>7 fields

Set of rules to apply for strikethrough.

bindingsarray<object>required8 fields

An array that provides objects with variable names (name) and talang expressions to whose result they are bound (expression) during rule evaluation. The order of the evaluation is decided by the position in the array.

rbVersionstring

The version of the rulebuilder used to create this ruleset.

activateboolean

Indicates whether this created ruleset should be activated for the campaign that owns it.

campaignIdinteger (int64)

The ID of the campaign that owns this entity.

templateIdinteger (int64)

The ID of the campaign template that owns this entity.

activatedAtstring (date-time)

Timestamp indicating when this Ruleset was activated.

collectionsarray<object>
idinteger (int64)required

The internal ID of this entity.

createdstring (date-time)required

The time this entity was created.

accountIdinteger (int64)required

The ID of the account that owns this entity.

modifiedstring (date-time)required

The time this entity was last modified.

descriptionstring

A short description of the purpose of this collection.

subscribedApplicationsIdsarray<integer (int64)>

A list of the IDs of the Applications where this collection is enabled.

namestringrequired

The name of this collection.

modifiedByinteger (int64)

ID of the user who last updated this effect if available.

createdByinteger (int64)required

ID of the user who created this effect.

applicationIdinteger (int64)

The ID of the Application that owns this entity.

campaignIdinteger (int64)

The ID of the campaign that owns this entity.

payloadarray<string>

The content of the collection.

json
{
  "campaign": {
    "type": "advanced",
    "templateId": 3,
    "customEffectCount": 0,
    "activeRevisionId": 6,
    "features": [
      "coupons",
      "referrals"
    ],
    "createdLoyaltyPointsCount": 9,
    "storesImported": true,
    "couponSettings": {
      "couponPattern": "SUMMER-####-####",
      "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"
      ]
    },
    "experimentId": 1,
    "id": 4,
    "state": "enabled",
    "couponAttributes": "{}",
    "reservecouponEffectCount": 9,
    "updatedBy": "Jane Doe",
    "frontendState": "running",
    "created": {},
    "referralCreationCount": 8,
    "stageRevision": false,
    "couponRedemptionCount": 163,
    "couponCreationCount": 16,
    "version": 6,
    "campaignGroups": [
      1,
      3
    ],
    "tags": [
      "summer"
    ],
    "discountEffectCount": 343,
    "budgets": [
      {
        "limit": 1000,
        "action": "createCoupon",
        "counter": 42
      },
      {
        "limit": 1000,
        "action": "createCoupon",
        "counter": 42
      }
    ],
    "redeemedLoyaltyPointsCount": 8,
    "name": "Summer promotions",
    "valueMapsIds": [
      100,
      215
    ],
    "applicationId": 322,
    "updated": {},
    "callApiEffectCount": 0,
    "createdLoyaltyPointsEffectCount": 2,
    "discountCount": 288,
    "revisionFrontendState": "revised",
    "description": "Campaign for all summer 2021 promotions",
    "activeRevisionVersionId": 6,
    "currentRevisionVersionId": 6,
    "startTime": {},
    "currentRevisionId": 6,
    "limits": [
      {
        "period": "yearly",
        "entities": [
          "Coupon"
        ],
        "limit": 1000,
        "action": "createCoupon"
      },
      {
        "period": "yearly",
        "entities": [
          "Coupon"
        ],
        "limit": 1000,
        "action": "createCoupon"
      }
    ],
    "activeRulesetId": 6,
    "reevaluateOnReturn": true,
    "userId": 388,
    "awardedGiveawaysCount": 9,
    "redeemedLoyaltyPointsEffectCount": 9,
    "linkedStoreIds": [
      1,
      2,
      3
    ],
    "createdBy": "John Doe",
    "addFreeItemEffectCount": 0,
    "referralSettings": {
      "couponPattern": "SUMMER-####-####",
      "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"
      ]
    },
    "attributes": "{}",
    "lastActivity": {},
    "endTime": {},
    "referralRedemptionCount": 3
  },
  "ruleset": {
    "rbVersion": "v2",
    "created": {},
    "campaignId": 320,
    "bindings": [],
    "activatedAt": {},
    "activate": true,
    "rules": [
      {
        "condition": [
          "and",
          [
            "couponValid"
          ]
        ],
        "effects": [
          "catch",
          [
            "noop"
          ],
          [
            "setDiscount",
            "10% off",
            [
              "*",
              [
                ".",
                "Session",
                "Total"
              ],
              [
                "/",
                10,
                100
              ]
            ]
          ]
        ],
        "bindings": [
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          },
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          }
        ],
        "description": "Creates a discount when a coupon is valid",
        "id": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "title": "Give discount via coupon",
        "parentId": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23"
      },
      {
        "condition": [
          "and",
          [
            "couponValid"
          ]
        ],
        "effects": [
          "catch",
          [
            "noop"
          ],
          [
            "setDiscount",
            "10% off",
            [
              "*",
              [
                ".",
                "Session",
                "Total"
              ],
              [
                "/",
                10,
                100
              ]
            ]
          ]
        ],
        "bindings": [
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          },
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          }
        ],
        "description": "Creates a discount when a coupon is valid",
        "id": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "title": "Give discount via coupon",
        "parentId": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23"
      }
    ],
    "id": 6,
    "strikethroughRules": [
      {
        "condition": [
          "and",
          [
            "couponValid"
          ]
        ],
        "effects": [
          "catch",
          [
            "noop"
          ],
          [
            "setDiscount",
            "10% off",
            [
              "*",
              [
                ".",
                "Session",
                "Total"
              ],
              [
                "/",
                10,
                100
              ]
            ]
          ]
        ],
        "bindings": [
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          },
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          }
        ],
        "description": "Creates a discount when a coupon is valid",
        "id": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "title": "Give discount via coupon",
        "parentId": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23"
      },
      {
        "condition": [
          "and",
          [
            "couponValid"
          ]
        ],
        "effects": [
          "catch",
          [
            "noop"
          ],
          [
            "setDiscount",
            "10% off",
            [
              "*",
              [
                ".",
                "Session",
                "Total"
              ],
              [
                "/",
                10,
                100
              ]
            ]
          ]
        ],
        "bindings": [
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          },
          {
            "attributeId": 100,
            "minValue": 0,
            "expression": [
              "string1",
              "string2"
            ],
            "maxValue": 19.9,
            "valueType": "string",
            "name": "my property",
            "description": "This is a template parameter of type `number`.",
            "type": "templateParameter"
          }
        ],
        "description": "Creates a discount when a coupon is valid",
        "id": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23",
        "title": "Give discount via coupon",
        "parentId": "7fa800a8-ac8d-4792-85dc-c4650dcc8f23"
      }
    ],
    "templateId": 3,
    "userId": 388
  },
  "collections": [
    {
      "accountId": 3886,
      "createdBy": 134,
      "payload": [
        "KTL-WH-ET-1",
        "KTL-BL-ET-1"
      ],
      "created": {},
      "campaignId": 7,
      "subscribedApplicationsIds": [
        1,
        2,
        3
      ],
      "name": "My collection",
      "modified": {},
      "description": "My collection of SKUs",
      "modifiedBy": 48,
      "id": 6,
      "applicationId": 1
    }
  ]
}

Need more? See the Talon.One guide for connection setup and behaviour shared by every action.