Please go through the part-1 for introduction.
So, you are ready to go social! Let’s get started!
What are the prerequisites:
You must create apps for Facebook and Twitter, as per your integration requirement, to fetch the activity details from these social channels.
Use a Facebook developer account (https://developers.facebook.com/ ) to create the app.
- Navigate to My Apps menu and create the app by providing a display name and a contact email for the app.
- In the Apps dashboard, select Add Product and then select ‘Facebook Login”.
- Select ‘Web’ as the platform for the app and provide your enterprise Website URL.
- On the Facebook Login product’s settings page, provide a OAuth redirect URL i.e. the URL of your enterprise Website.
Use your Twitter account to create an app on Twitter.
- On the Twitter Apps page (https://apps.twitter.com/), click Create New App and provide the app details, the Website and the Callback URLs (Website and callback URL will be your enterprise Website URL).
- Go to Permissions tab, select Request email addresses from users and update the settings.
- Install the Hybris Marketing recipe b2c_acc_ymkt in SAP Hybris Commerce 6.6.
- Configure the Hybris marketing server details such as OData URL, username and password.
- Extract and place the downloaded social integration extensions inside custom folder or a newly created folder in the \hybris\bin folder of your Hybris installation.
- Add the below extensions to localextensions.xml
- Install the Socialconnectaddon on yacceleratorstorefront.
- Download the jars required for Socialconnectaddon from the maven repository:
- Run the ant command (ant clean all initialize) inside the platform folder.
- As mandated by Data Protection and Privacy laws, the customer needs to provide a link on the storefront, that displays the privacy statements mentioning the usage of customer data retrieved from social platforms like Facebook, also indicating how this information is used and how it can be deleted.
During initialization, the basic configurations for social login and the CMS customizations for social integration components are created.
- Add the below properties to ‘properties’ file.
Properties for Facebook application:
- app.client.id=<Get app ID from the developer portal>
- app.client.secret=<Get app secret from the developer portal>
Properties for Twitter application:
- app.api.key=<Get API key from the apps portal>
- app.api.secret=<Get API secret from the apps portal>
Set up brand page ID:
- facebook.page.id=<ID of the facebook brand page>
- Configure Facebook app ID and app version in js file. This information needs to be set in FB.init() method’s appId field and version field respectively. This is required to carry out Facebook related operations in the front end.
- Start the Hybris server and login to Backoffice as the administrator.
- Navigate to Social Connect Services node and select social login provider info.
Edit the social login provider information for Facebook and Twitter, and update the social login component attribute. Select the existing Social Login Component created during initialization. (Please ensure that you select the component in the online electronics content catalog).
- Navigate to Social Connect Services node, select FacebookYMKTConfiguration and create FacebookYMKTConfiguration item. Specify the scenario ID as present in marketing system, Interaction type as ‘CLICK_THROUGH’, user type as ‘EMAIL’, and ymkt item type as ‘SAP_HYBRIS_PRODUCT’.
Facebook shareable component in the store front:
To view a sample Facebook shareable component in the store front, go to cmscockpit or smartedit and add a sample component (already created during initialization) in homepage’s Section1Slot-Homepage slot.
Get Access Token to fetch likes information from Facebook brand page:
To fetch likes information from Facebook, the Facebook brand page owner’s user access token is required. To get the access token follow the steps below:
- Log in to Facebook as Facebook brand page owner.
- Check the link https://developers.facebook.com/tools/debug/accesstoken to get info about the access token and when it expires.
- Get the extended token and save it in the cronjob model (with code fetchFBInfoCronJob) in Hybris.
- On executing the cronjob information is pulled from the configured brand page ID.
Send likes information as interaction to Hybris marketing:
To send information as interaction to Hybris marketing the cronjob sendFBLikesInfoCronJob needs to be executed. This job validates the posts and the people who like them, and sends the details to Hybris Marketing if they are also registered Hybris commerce customers.
Data protection and privacy requirements:
The basic data protection and privacy requirements applicable to the addon are fulfilled by SAP Hybris Commerce 6.6. Some enhancements have been made to handle the information processed by the addon.
- User Deletion: A customer can initiate a request to close his account, from the storefront. On closure, the customer account goes through a retention period after which all personal data is deleted from Hybris Commerce. The customer must also contact customer care to ensure that any data sent to Hybris Marketing is manually deleted from the marketing system.
- User Reporting: A customer can any time request a report of all the information stored about him in Hybris Commerce. This report is now enhanced to include social login and social likes information stored in the system. Generation of the report involves the steps below:
- Customer contacts the customer support agent to request for the report.
- Customer Support agent logs into Hybris Commerce Backoffice.
- The agent searches and finds the customer using his ID, selects the customer and clicks Create Audit report. The following options are available to create the report:
- Report Type: Snapshot
- Language: English or any other available language
- Report Template: Default
- The agent then clicks on the Personal Data Reports link and searches for the report using the customer ID.
- Agent selects the report, and this report that contains the personal details of the customer can be downloaded from the General tab.
- Log Changes to Personal Data: To know what changes have been made to a customer’s personal data, an Audit report can be generated in the same manner as the customer report is generated. Select the report type as Audit to generate the audit report. This report contains the history of changes made to the customer details, including the time of change and the name of the user who made the change.
Identity and Access Management:
The social integration add-on uses standard OAuth 1 and OAuth 2 authentication mechanisms to process the login. These processes are enabled by the usage of spring-social, an open source spring project. On successful validation by the Software as a Service (SaaS) providers like Facebook or Twitter the user is registered on Hybris storefront.