Class ShopperConsentMgr

Provides static helper methods for managing shopper marketing consent subscriptions.

This API enables retrieving and updating marketing consent preferences. Consent subscriptions define communication categories (e.g., “Newsletter”, “Product Updates”) and the channels (EMAIL, SMS, WHATSAPP) through which marketing communications can be sent.

Prerequisites:

  • The Marketing Consent feature must be enabled and configured
  • For consent status retrieval, the current request must have a customer context

Example usage:

See Also:

PropertyDescription
subscriptions: Collection (read-only)Retrieves marketing consent subscriptions for the current site.

This class does not have a constructor, so you cannot create it directly.

MethodDescription
static getSubscriptions()Retrieves marketing consent subscriptions for the current site.
static getSubscriptions(List, Boolean)Retrieves marketing consent subscriptions for the current site with optional filtering and status.
static updateSubscription(String, String, String, String)Updates consent status for a subscription.

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

subscriptions: Collection (read-only)

Retrieves marketing consent subscriptions for the current site.

This method returns all available consent subscriptions without consent status information.


static getSubscriptions(): Collection

Retrieves marketing consent subscriptions for the current site.

This method returns all available consent subscriptions without consent status information.

Returns:

Throws:

  • ShopperConsentException - if the consent feature is not enabled or retrieval fails.

static getSubscriptions(tags: List, includeConsentStatus: Boolean): Collection

Retrieves marketing consent subscriptions for the current site with optional filtering and status.

Use this method to retrieve subscriptions filtered by tags and optionally include the current consent status for authenticated customers.

Parameters:

  • tags - Optional list of tags to filter subscriptions. Pass null for all subscriptions.
  • includeConsentStatus - If true, includes the current consent status for each subscription. Requires a customer context.

Returns:

Throws:

  • ShopperConsentException - if the consent feature is not enabled, retrieval fails, or consent status retrieval fails.

static updateSubscription(contactPointValue: String, subscriptionId: String, channel: String, status: String): void

Updates consent status for a subscription.

This method updates the consent status in Salesforce Core for the specified contact point and subscription channel combination.

Parameters:

  • contactPointValue - The contact point value (email address or phone number).
  • subscriptionId - The subscription ID.
  • channel - The channel type ("EMAIL", "SMS", or "WHATSAPP").
  • status - The consent status ("OPT_IN" or "OPT_OUT").

Throws:

  • ShopperConsentException - if the consent feature is not enabled or update fails.