Campaigns

Understanding the various campaigns in Flow Retail and how to create and maintain sales campaigns through the APIs.

Flow Retail fully supports creating all common types of sales campaigns for the stores, and any campaign can be assigned to any specific or all stores.

The campaign is always either of the following types: CAMPAIGN or PRICELIST.

  • PRICELIST: This type is simply a list of products with specific discount prices. No rules are applied.

  • CAMPAIGN: This type has a set of rules that must be applied before the campaign is valid. You can specify which product(s) the rule applies to and which product will receive the discount.

'PRICELIST' Campaign Type

The PRICELIST campaign type is the simplest form of campaign. It consists of a price list with a specific set of products at specified prices. You can set a time range for when the pricelist should be active using the validFrom and validTo fields.

Creating a new PRICELIST Campaign

Before creating a new PRICELIST campaign, you must first create a new pricelist or locate an existing pricelist to use. You can create a new pricelist via the create new pricelist endpoint.

To create the new campaign, use the create new campaign endpoint. The required fields are:

  • name: The internal name of the campaign.

  • displayName: The name of the campaign displayed to the customer (e.g., on receipts).

  • validFrom / validTo: The time period during which the campaign should be valid.

  • type: The campaign type.

  • discountType: Specifies how the discount should be applied (for PRICELIST campaigns, the only valid type is QUALIFIED_PRODUCT).

  • storeUids: A list of stores where the campaign should be active.

  • pricelistUid: The pricelist that should be used for this campaign.

The optional fields applicable for PRICELIST campaigns are:

  • priority: The priority of the campaign if more than one campaign applies. A lower number indicates higher priority.

  • campaignUid: An identifier for the current campaign.

  • campaignCode: A campaign code to manually activate the campaign. Leave it empty to automatically activate the campaign.

  • preventCombinations: A flag to indicate if the campaign can be combined with other campaigns.

Example request

POST https://api.flowretail.com/v2/tenants/{tenantUid}/campaigns:

{
  "name": "August 2024",
  "displayName": "Back to school!",
  "validFrom": "2024-08-04T08:00:00Z",
  "validTo": "2024-08-20T23:59:59Z",
  "type": "PRICELIST",
  "discountType": "QUALIFIED_PRODUCT",
  "storeUids": [
    "sandnes-1",
    "sandnes-2"
  ],
  "pricelistUid": "pricelist-august-2024"
}

The response will be something like this:

{
  "amountThreshold": 0,
  "campaignCode": "",
  "campaignUid": "backtoschool",
  "discountAmount": 0,
  "discountPercent": 0,
  "discountType": "QUALIFIED_PRODUCT",
  "displayName": "Back to school!",
  "maxUsage": 0,
  "name": "August 2024",
  "preventCombinations": false,
  "pricelist": {
    "name": "Kampanje - August 2024",
    "pricelistUid": "pricelist-august-2024"
  },
  "priority": 0,
  "quantityThreshold": 0,
  "selection": {
    "exclude": {
      "brands": [],
      "categories": [],
      "productGroups": [],
      "products": []
    },
    "include": {
      "brands": [],
      "categories": [],
      "productGroups": [],
      "products": []
    }
  },
  "status": "NEW",
  "stores": [
    {
      "name": "Apple Store Sandnes sentrum",
      "storeUid": "sandnes-1"
    },
    {
      "name": "Apple Store Sandnes Kvadrat",
      "storeUid": "sandnes-2"
    }
  ],
  "type": "PRICELIST",
  "validFrom": "2024-08-04T10:00:00+02:00",
  "validTo": "2024-08-21T01:59:59+02:00"
}

You will then need to activate the campaign by updating its status.

PUT https://api.flowretail.com/v2/tenants/{tenantUid}/campaigns/{campaignUid}

{
  "status": "ACTIVE"
}

Once a campaign is active, you cannot change its details, but you can add or remove products from the pricelist.

'CAMPAIGN' Campaign Type

The CAMPAIGN campaign type is rule-based. In this campaign, you can specify brands, categories, product groups, or specific products that should be applicable. The campaign types include:

  • QUALIFIED_PRODUCT: The discount applies to all products that qualify for the campaign.

  • CHEAPEST_PRODUCT: The discount is applied only to the cheapest product.

  • ORDER_DISCOUNT: The discount is applied to the entire order.

The discount can be either a specific amount or a percentage, specified by the fields discountAmount and discountPercent. Only one of these can be specified.

  • amountThreshold and quantityThreshold can be used to set thresholds for when the campaign should be active. quantityThreshold limits it by the number of products in the order, while amountThreshold limits it based on the order's total sum.

  • The maxUsage field limits the number of times a rule can be applied to an order, which is mostly used in "X for Y" type campaigns.

Selection

The selection of products is vital for the CAMPAIGN type. To specify which products are included or excluded from the campaign, you need to set up a selection.

When including or excluding products, you can use four types of identifiers: product group, category, brand, or product uid.

The selection of included products happens when you activate the campaign. If you create a campaign for a specific product group, activate the campaign, and then add new products to that group, the new products will not be included in the campaign until you deactivate and reactivate the campaign.

Example Scenarios

  • Example 1: Set up a campaign for all products of the brand "Samsung". Create a new selection that includes the brand "Samsung".

  • Example 2: Create a general campaign for all products in your store except for those in the "SERVICES" product group. Create a new selection that excludes the "SERVICES" product group.

  • Example 3: Set up a campaign for all products in the "PHONES" product group, but exclude the brand "Apple". Create a new selection that includes the "PHONES" product group but excludes the "Apple" brand.

Creating a new CAMPAIGN

To create a new campaign, use the create new campaign endpoint. The required fields are:

  • name: The internal name of the campaign.

  • displayName: The name of the campaign displayed to the customer (e.g., on receipts).

  • validFrom / validTo: The time period during which the campaign should be valid.

  • type: The campaign type.

  • discountType: Specifies how the discount should be applied.

  • storeUids: A list of stores where the campaign should be active.

  • discountAmount or discountPercent: The discount as a percentage or a specific amount.

Optional fields applicable for CAMPAIGN types include:

  • quantityThreshold: The quantity required for the campaign to be active.

  • amountThreshold: The order amount required for the campaign to be active.

  • maxUsage: The maximum number of times the campaign can be applied to an order.

  • priority: The priority of the campaign if more than one campaign applies. A lower number indicates higher priority.

  • campaignUid: An identifier for the current campaign.

  • campaignCode: A campaign code to manually activate the campaign. Leave it empty to automatically activate the campaign.

  • preventCombinations: A flag to indicate if the campaign can be combined with other campaigns.

Example - a X for Y campaign can be created like this:

{
  "name": "3 for 2 - Socks",
  "displayName": "Socks: 3 for 2",
  "validFrom": "2024-08-04T08:00:00Z",
  "validTo": "2024-08-20T23:59:59Z",
  "type": "CAMPAIGN",
  "discountType": "CHEAPEST_PRODUCT",
  "storeUids": [
    "store-1"
  ],
  "discountPercentage": 100,
  "quantityThreshold": 3,
  "maxUsage": 1,
  "campaignUid": "3for2socks"
}

When the campaign is created, you need to add the selection for the products to be included in the campaign:

PUT https://api.flowretail.com/v2/tenants/{tenantUid}/campaigns/{campaignUid}/selections

{
  "create": {
    "include": {
      "productGroupUids": [
        "string"
      ],
      "brandUids": [
        "string"
      ],
      "categoryUids": [
        "string"
      ],
      "productUids": [
        "string"
      ]
    },
    "exclude": {
      "productGroupUids": [
        "string"
      ],
      "brandUids": [
        "string"
      ],
      "categoryUids": [
        "string"
      ],
      "productUids": [
        "string"
      ]
    }
  }
}

Last updated

Logo

Copyright 1995-2024 Flow Retail