docs
  1. SCAYLE Resource Center
  2. User Guide
  3. Shops
  4. Promotions
  5. Tutorials
  6. Run a flash sale for your VIP audience

Run a flash sale for your VIP audience

Flash sales designed for your VIP customers are a smart marketing move in today's fast-paced business world. These sales not only make customers feel special but also bring many advantages for both businesses and their VIP audience. By making things urgent and exclusive, VIP flash sales enhance the overall customer experience, build strong brand loyalty, and play a big role in the success of marketing efforts.

In this tutorial, you will learn how to run such a promotion using a real-life scenario.

We'll cover these areas:

  • Creating the VIP audience
  • Create the promotion using the Flash sale template in the SCAYLE Panel
  • Communicate the promotion using Storefront API
  • Apply the promotion using Storefront API

Creating the VIP audience in the SCAYLE Panel

To create the VIP audience

  1. Select the required Shop. From the left menu, select Audiences, then click + NEW AUDIENCES.
  2. In the Name field, enter “VIP” and add a description, for example “This audience includes only customers who are considered as VIP customers”.
  3. Click the + CUSTOMERS button and paste in all customer IDs that should belong to this audience. A list containing customer IDs can be exported from a Customer Relationship Management (CRM) system.
  4. Click CREATE.

You created your first audience that you can now use as a condition for promotions.

Create the promotion using the Flash sale template in the SCAYLE Panel

To create a new promotion:

  1. Select the Shop where you want to create your promotion and go to Promotions > Flash Sale.
  2. Click the + New Flash Sale button.
  3. Name: enter a name for the promotion. In our case, we can call the promotion “Flash sale for VIP only”.
  4. Priority: enter the priority of the promotion compared to others. Enter 0 in this field, as no other promotions are currently active.
  5. Start date: enter the date and time when the promotion starts running.
  6. End date: enter the date and time when the promotion becomes inactive.
    Flash sales should only run for a short time, to increase the exclusivity.
  7. Enter the Flash Sale Discount.
  8. Select Product: If you select the Product while searching for an ID, you can select single Attribute Group variants.
    Products included in the flash sale should be desired by your VIP audience, such as premium brand items.
  9. Click Save.

Communicate the promotion using Storefront API

We want to communicate the promotion during its runtime, but only to customers belonging to the audience “VIP”.

To achieve that, we can request the endpoint GET /promotions using the Storefront API, which will give us back the currently running and active promotions, please refer to Fetch Promotions.

Additionally, include the following parameters in our request: shopId: Represents the identifier of the shop-country activeAt: Represents the current time accessToken: Access token of the customer. Used to narrow down the results to promotions, only applicable to audiences of this customer.

An example of a response body:

{
    "pagination": {
        "current": 1,
        "total": 1,
        "perPage": 100,
        "page": 1,
        "first": 1,
        "prev": 1,
        "next": 1,
        "last": 1
    },
    "entities": [
        {
            "id": "65438f563a404c7e45779f17",
            "name": "Flash Sale for VIP only",
            "schedule": {
                "from": "2023-11-30T23:00:00Z",
                "to": "2023-11-31T22:59:59Z"
            },
            "isActive": true,
            "effect": {
                "type": "automatic_discount",
                "additionalData": {
                    "type": "relative",
                    "value": 1000
                }
            },
            "conditions": [
              {
                    "level": "item",
                    "key": "panels_automatic-discount_product_condition_dfe0000013556a105158bb0b0ef661fd7541f9fe",
                    "condition": "(item.variant.id == 4799 || item.variant.id == 4800)"
              }
            ],
            "customData": {}
        }
    ]
}

We can now use the returned information like the name of the promotion, e.g. to display a campaign banner and enrich it with additional data from a CMS if needed.

You could also show a product slider, that includes all items included in this specific promotion with a quick add to basket button.

Apply the promotion in the Storefront API

You can send the promotionId within the request body of the POST /baskets/:id/items endpoint of the Storefront API. This would give us a request body like this:

{
  "key": "basketKey",
  ..
  "items": [
      {
          "key": "335f5352088d7d9bf74191e006d8e24c",
          "promotion": {
            "id": "65438f563a404c7e45779f17",
            "name": "MOV Sale",
            "isValid": false,
            "failedConditions": [
              {
                "key": "panels_automatic-discount_product_condition_dfe0000013556a105158bb0b0ef661fd7541f9fe",
                "level": "item"
              }
          }
}

In this case, the item condition is not valid, probably because someone removed the item from the list of eligible items in the promotion definition.

Validating promotions

In case a customer opens the basket view, you want to communicate the discounted prices, however, only, if the promotion overall is valid. For these cases you use the GET /baskets/:id/items endpoint. The response will tell you, whether the promotions within the basket are valid.

Summary

Key takeaways from this tutorial. You should now be able to:

  • create Flash sales in the SCAYLE Panel using the automatic_discount effect
  • narrow down Flash sale to a specific audience
  • communicate promotions using Storefront API
  • validate promotions using Storefront API