Loading
瞭解即時優惠管理
以程式設計的方式設計促銷

以程式設計的方式設計促銷

使用「促銷建立 API」建立、設定和管理促銷。系統整合者可以流暢地將 API 與外部系統整合,使用者 (例如商店經理) 可在其中建立促銷。

必要版本

提供版本:Lightning Experience
提供版本:具備即時優惠管理的 EnterpriseUnlimitedDeveloper Edition

若要建立促銷,請指定主要詳細資料、促銷規則和獎勵。當您指定規則和獎勵的詳細資料時,請將您指定的詳細資料與您要在促銷中使用的促銷範本類型進行對應。您也可以指定促銷的資格條件與限制。

重要
重要 您無法使用「促銷建立 API」建立使用「參與追蹤」促銷範本的促銷。

您也可以使用 API 來更新和刪除促銷,並且以取得促銷詳細資料。若要瞭解如何設計促銷,請參閱 快速促銷精靈步驟

範例
範例 Cloud Kicks 的行銷小組正在計畫「Cloud Kicks 忠誠度」忠誠度計畫的夏令行銷活動。為了提升銷售量並獎勵忠實的客戶,他們想要建立稱為 Summer Sale 的促銷。此促銷將在 6 月期間執行,並針對 $50 以上的購買提供 10% 折扣。此促銷專門針對其應用程式上的 Summer Sneakers 產品種類,並針對其「忠誠的客戶」區段。為了確保促銷有效,他們想要將其用量限制為整體 1000 倍,每位客戶 5 倍。

以下是在執行 API 時,促銷建立 API 的要求如下所示:

{
  "promotionDetails": {
    "name": "Summer Sale",
    "displayName": "Summer Sale Promotion",
    "priorityNumber": 1,
    "description": "Summer Sale promotion offering a 10% discount on purchases over $50",
    "promotionCode": "SUMMER2025",
    "startDateTime": "2025-06-01T00:00:00.000Z",
    "endDateTime": "2025-06-30T23:45:00.000Z",
    "loyaltyProgram": {
      "name": "CloudKicksLoyalty"
    },
    "promotionEligibility": {
      "productCatalog": {
        "id": "0ZSxx000000001dGAA"
      },
      "eligibleProductCategories": [
        {
          "id": "Summer Sneakers"
        }
       ],
      "eligibleChannels": [
        {
          "channelType": "Online",
          "channel": {
            "name": "App"
          }
        }
      ],
      "eligibleSegments": [
        {
          "name": "Loyal Customers"
        }
      ],
      "areAllLoyaltyMembersEligible": false     
    },
    "promotionLimits": {
      "usePerCustomerLimit": 5,
      "totalUseLimit": 1000
    }
  },
  "rules": [
    {
      "templateName": "BuyXToGetRewards",
      "ruleName": "SummerSaleRule",
      "priority": 1,
      "eventConfiguration": [
        {
          "allOf": [
            {
              "anyOf": {
                "purchaseType": "ProductCategory",
                "applicablePurchaseList": [
                  {
                    "name": "Summer Sneakers"
                  }
                ],
                "purchaseCriteria": {
                  "type": "Amount",
                  "value": 50
                }
              }
            }
          ]
        }
      ],
      "rewardConfiguration": [
        {
          "type": "ProvideDiscount",
          "rewardDetails": {
            "discountValue": "10",
            "discountType": "PercentageOff"
          },
          "targetAudience": {
            "audienceType": "AllLoyaltyMembers"
          }
        }
      ]
    }
  ]
}
 
正在載入
Salesforce Help | Article