younifyd
Menu

Update Shopper Context

Update Shopper Context

PATCH/organizations/{organizationId}/shopper-context/{usid}

Use it in a workflow

  1. Add a step and choose the Salesforce Commerce Cloud connector.
  2. Pick the Update Shopper Context action (under Shopper Context).
  3. Fill in the fields below, then reference the result from later steps as {{updateShopperContext.response.data}}.

Request

Path parameters

usidstringrequired

The Shopper's unique identifier. It is a required parameter and is part of the response from the Guest or Registered User Shopper Login (SLAS) API call.

organizationIdstringrequired

An identifier for the organization the request is being made by

Query parameters

siteIdstringrequired

The site context.

evaluateContextWithClientIpboolean

Determines whether to evaluate the context using the provided `clientIp`. This property is available with B2C Commerce version 24.7. - If `evaluateContextWithClientIp` is set to `true`: - The `clientIP` is saved and used in subsequent requests. - If `evaluateContextWithClientIp` is set to `false`: - The `clientIP` is not saved and will not be used in subsequent requests.

Request body

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

effectiveDateTimestring (date-time)

Qualifier to set the effective date time for the context to apply. For example, "Shop the Future" use cases. If not provided, the current dateTime will be assumed.

sourceCodestring

Qualifier to set the source code for the context to apply. Set the source code to evaluate source code group that triggers the promotion (campaign assignment) and Price books (assigned to Source code group).

customerGroupIdsarray<string>

Qualifier to set the Customer Group Ids for the context to apply. Set the Customer Group Ids to evaluate customer groups that trigger the promotions (campaign assignment) assigned to the customer groups.

customQualifiersobject

Map of custom qualifiers for the shopper context. Set this object to trigger pricing and promotion experiences using a dynamic session-based customer group. Object size is limited to 20 key-value pairs (properties).

assignmentQualifiersobject

Map of assignment qualifiers for the shopper context. Set this object when using the assignment framework to activate experiences based on assignment qualifiers. Currently, only pricing and promotion experiences are supported. Object size is limited to 20 key-value pairs (properties).

clientIpstring

The IP Address of the client. If the client IP is not a valid IPv4 address, a Bad Request (400) error is thrown. This property is available with B2C Commerce version 24.7. When `clientIp` is set, the geolocation based on the `clientIp` is returned in the `X-Geolocation` header in the response. Note: Use/retrieve this header in a case insensitive manner. However, if the `geoLocation` attribute is also set in the context, it takes precedence over the `clientIp`, and the `X-Geolocation` header returns the geolocation based on the `geoLocation` attribute. The query parameter `evaluateContextWithClientIp` determines whether to evaluate the context using the provided `clientIp`. - If `evaluateContextWithClientIp` is set to `true`: - The `clientIp` is saved and used in subsequent requests. Note: If `geoLocation` is also saved in the context, it takes precedence over the `clientIp`. - If `evaluateContextWithClientIp` is set to `false`: - The `clientIp` is not saved and is not used in subsequent requests.

geoLocationobject

The geographic location of the client. When you set a geolocation, it is saved as context for subsequent requests. This overrides any geolocation context previously saved using `clientIp`. This property is available with B2C Commerce version 24.7.

citystring

The city name associated with this location.

countrystring

The country name associated with this location.

countryCodestring

The ISO country code associated with this location.

latitudenumber (double)

The latitude coordinate, which is a number between -90.0 and +90.0, associated with this location.

longitudenumber (double)

The longitude coordinate, which is a number between -180.0 and +180.0, associated with this location.

metroCodestring

The metro code associated with this location.

postalCodestring

The postal code associated with this location.

regionstring

The region (subdivision) name for this location. Corresponds with "state" in the USA.

regionCodestring

The region (province or state) code for this location.

couponCodesarray<string>

Array of coupon codes to be saved in the shopper context. Set the coupon codes to evaluate promotions that can be triggered by these codes.

json
{
  "effectiveDateTime": "2020-12-20T00:00:00Z",
  "sourceCode": "wii1-98",
  "customerGroupIds": [
    "BigSpenders"
  ],
  "customQualifiers": {
    "deviceType": "mobile",
    "ipAddress": "189.0.0.0",
    "operatingSystem": "Android"
  },
  "assignmentQualifiers": {
    "store": "boston"
  },
  "clientIp": "12.12.12.1",
  "geoLocation": {
    "city": "Boston",
    "country": "United States of America",
    "countryCode": "US",
    "latitude": 10.11,
    "longitude": 198.34,
    "metroCode": "string",
    "postalCode": "01730",
    "region": "NA",
    "regionCode": "12345"
  },
  "couponCodes": [
    "SAVE20"
  ]
}

Response

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

effectiveDateTimestring (date-time)

Qualifier to set the effective date time for the context to apply. For example, "Shop the Future" use cases. If not provided, the current dateTime will be assumed.

sourceCodestring

Qualifier to set the source code for the context to apply. Set the source code to evaluate source code group that triggers the promotion (campaign assignment) and Price books (assigned to Source code group).

customerGroupIdsarray<string>

Qualifier to set the Customer Group Ids for the context to apply. Set the Customer Group Ids to evaluate customer groups that trigger the promotions (campaign assignment) assigned to the customer groups.

customQualifiersobject

Map of custom qualifiers for the shopper context. Set this object to trigger pricing and promotion experiences using a dynamic session-based customer group. Object size is limited to 20 key-value pairs (properties).

assignmentQualifiersobject

Map of assignment qualifiers for the shopper context. Set this object when using the assignment framework to activate experiences based on assignment qualifiers. Currently, only pricing and promotion experiences are supported. Object size is limited to 20 key-value pairs (properties).

clientIpstring

The IP Address of the client. If the client IP is not a valid IPv4 address, a Bad Request (400) error is thrown. This property is available with B2C Commerce version 24.7. When `clientIp` is set, the geolocation based on the `clientIp` is returned in the `X-Geolocation` header in the response. Note: Use/retrieve this header in a case insensitive manner. However, if the `geoLocation` attribute is also set in the context, it takes precedence over the `clientIp`, and the `X-Geolocation` header returns the geolocation based on the `geoLocation` attribute. The query parameter `evaluateContextWithClientIp` determines whether to evaluate the context using the provided `clientIp`. - If `evaluateContextWithClientIp` is set to `true`: - The `clientIp` is saved and used in subsequent requests. Note: If `geoLocation` is also saved in the context, it takes precedence over the `clientIp`. - If `evaluateContextWithClientIp` is set to `false`: - The `clientIp` is not saved and is not used in subsequent requests.

geoLocationobject

The geographic location of the client. When you set a geolocation, it is saved as context for subsequent requests. This overrides any geolocation context previously saved using `clientIp`. This property is available with B2C Commerce version 24.7.

citystring

The city name associated with this location.

countrystring

The country name associated with this location.

countryCodestring

The ISO country code associated with this location.

latitudenumber (double)

The latitude coordinate, which is a number between -90.0 and +90.0, associated with this location.

longitudenumber (double)

The longitude coordinate, which is a number between -180.0 and +180.0, associated with this location.

metroCodestring

The metro code associated with this location.

postalCodestring

The postal code associated with this location.

regionstring

The region (subdivision) name for this location. Corresponds with "state" in the USA.

regionCodestring

The region (province or state) code for this location.

couponCodesarray<string>

Array of coupon codes to be saved in the shopper context. Set the coupon codes to evaluate promotions that can be triggered by these codes.

json
{
  "effectiveDateTime": "2020-12-20T00:00:00Z",
  "sourceCode": "wii1-98",
  "customerGroupIds": [
    "BigSpenders"
  ],
  "customQualifiers": {
    "deviceType": "mobile",
    "ipAddress": "189.0.0.0",
    "operatingSystem": "Android"
  },
  "assignmentQualifiers": {
    "store": "boston"
  },
  "clientIp": "12.12.12.1",
  "geoLocation": {
    "city": "Boston",
    "country": "United States of America",
    "countryCode": "US",
    "latitude": 10.11,
    "longitude": 198.34,
    "metroCode": "string",
    "postalCode": "01730",
    "region": "NA",
    "regionCode": "12345"
  },
  "couponCodes": [
    "SAVE20"
  ]
}

Need more? See the Salesforce Commerce Cloud guide for connection setup and behaviour shared by every action.

Update Shopper Context — Salesforce Commerce Cloud — Documentation