Get Customer Profile
Customer profiles are collections of customer attributes, many of which are based on information the customer provides when they register for a program. Each profile can contain standard attributes such as age or address or custom attributes, which are often client-provided and added to the profile via SessionM APIs. When retrieving a customer profile, you can choose to pull standard or custom attributes; but, generally, it's most efficient to pull both with the endpoint that returns a combined profile (shown in this task).
This task gets a combined customer profile that contains both standard and custom attributes, both of which are displayed to the customer.
Sequence Diagram
See the overall flow for this task below.
API Endpoints & Constraints
GET priv/v1/apps/:api_key/users/:user_id?user[user_profile]=true
GET priv/v1/apps/:api_key/external/users/:external_id?user[user_profile]=true
- When retrieving a combined customer profile, you can ensure that the data returned includes incentive data. Set
expand_incentives
parameter to "true" (expand_incentives=true
). - If a customer has multiple external IDs, along with custom attributes in their profile, you can add the following parameter to ensure that all data is shown in one response:
show_identifiers=true
. This parameter works in conjunction with theuser_profile
parameter, which is displayed above, as a critical part of the endpoint because it retrieves custom attributes. - It is recommended that since future requests for profile data are likely, you may want to cache the SessionM user ID (
user_id
). Note that this recommendation applies only to an implementation that uses the SessionMuser_id
as the primary identifier.
Alternative Path
Instead of getting a customer profile, you can look up a customer by searching for an exact match that returns an array of customer attributes, including available points. This approach is mainly used for direct POS integrations that don't include middleware.
Best Practices
When requesting custom profile data, be aware that the size of the data that constitutes the custom profile will impact, or worsen, the latency and throughput of the API call.