Overview
The Loyalty Context Adapter service provides a REST interface to store data related to loyalty members. This service enables adding a loyalty identity for a loyalty member along with loyalty-relevant activities in SAP Hybris Profile.
An activity score is calculated for the loyalty member based on loyalty-relevant activities such as order, redeem, rating, review in the recent past.
The Loyalty Context Adapter stores data in context/loyalty/loyaltymember and context/loyalty/loyaltyactivity schemas based on the following event types:
- eventType='MEMBER_EVENT': Creates or updates a loyalty member
- eventType='ACTIVITY_EVENT': Creates loyalty member activities
- eventType='TIER_EVENT': Creates or updates loyalty tier details
Details about these event types including example JSON structures are provided in the subsequent sections of this document.
The Loyalty Context Adapter service supports the application/json content type.
API Reference
/{tenant}/events
/{tenant}/events
Processes given event
Scopes
Scopes are strings that allow you to specify the type of access you need to resources and operations in the Loyalty Context Adapter service.
- Authorization
- Scopes
The table shows all the scopes that the Loyalty Context Adapter service accepts:
Scope | Description |
---|---|
sap.loyadapter_manage | Use this scope to post data in the Loyalty Context Adapter. |
Metamodel
This interactive graphic displays the schemas that invoke this enricher and the schemas the enricher can affect in the graph, as defined in a current snapshot of the metamodel.
Registration
This example shows the structure of the JSON that the Loyalty Context Adapter accepts to register a new member.
{
"action_name":"MemberEvent",
"eventType":"MEMBER_EVENT",
"loyaltyMemberId":"3f2b688af5afd5beca63c45e13cd53a1",
"emailId":"bruce.wayne@hybristest.com",
"customerId":"C9753154",
"balanceLoyaltyPoints":"10",
"qualifyingLoyaltyPoints":"5",
"tierId":"9c89e302b8e74e9db901645be7cfb90e",
"tierName":"Gold",
"tierOrder":"1",
"tierStatus":"ACTIVE",
"activityType":"REGISTRATION",
"transactionPoints":"5",
"activityTimeStamp":"2016-07-08 14:59:30.252",
"tenant":"saployhfx",
"referredBy":"4e046a0411433e10ad9ac14091379045"
}
Activity
This example shows the structure of the JSON that the Loyalty Context Adapter accepts for a new ORDER
activity type.
{
"action_name":"ActivityEvent",
"eventType":"ACTIVITY_EVENT",
"loyaltyMemberId":"3f2b688af5afd5beca63c45e13cd53a1",
"emailId":"bruce.wayne@hybristest.com",
"customerId":"C9753154",
"balanceLoyaltyPoints":"10",
"qualifyingLoyaltyPoints":"5",
"tierId":"9c89e302b8e74e9db901645be7cfb90e",
"activityType":"ORDER",
"transactionPoints":"5",
"activityTimeStamp":"2016-07-08 14:59:30.252",
"tenant":"saployhfx"
}
Tier Details Update
This example shows the structure of the JSON that the the Loyalty Context Adapter accepts to update loyalty program Tier details.
{
"action_name":"MemberEvent",
"eventType":"TIER_EVENT",
"tierId":"9c89e302b8e74e9db901645be7cfb90e",
"tierName":"Gold",
"tierOrder":"1",
"tierStatus":"ACTIVE",
"activityType":"TIER_DETAILS_UPDATE",
"activityTimeStamp":"2016-07-08 14:59:30.252",
"tenant":"saployhfx"
}
Glossary
Term | Description |
---|---|
Activity Score | Activity scores are calculated for each loyalty member based on a formula that depends on the number of loyalty points accrued in the last six months. The formula for the activity score is `1.0*(Points from Month "N") + 0.8*(Points from Month "N-1") + 0.6*(Points from Month "N-2") + 0.4*(Points from Month "N-3") + 0.2*(Points from Month "N-4") + 0.1*(Points from Month "N-5")`, where `N` is the current month. |
Context Adapter | A microservice that receives data and, optionally, adapts it for entry into the graph. For example, a context adapter can adapt address data by adding a ZIP code and normalizing the street labels (for example, changing "St" to "Street"). The context adapter then passes the data through the Context service, which caches it so that enrichers can subsequently persist the data in the graph. |
Loyalty Identity | A loyalty identity is comprised of member loyalty points, member tier, loyalty points history, activity score and activity scores history, which are stored in SAP Hybris Profile. |
Tier | Merchants define loyalty tiers, which are levels that consumers can achieve in a loyalty program. Example tiers are Gold, Silver, and Bronze. |
If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.
Use our private help channel. Receive updates over email and contact our specialists directly.
If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.