Wednesday, February 29, 2012

Using LinkedIn to automatically update SAP CRM

In last week’s blog, we mentioned the different kinds of Social Media solutions that SAP provides and one that we at Acorel developed together with D-Media: LinkedIn integration with SAP CRM. As promised this week’s blog goes a bit more into the details of this LinkedIn solution.

Since LinkedIn has valuable information about your contact persons or customers, it might be useful to capture this information and store it on your CRM business partners. Just think of all the extra segmentation possibilities! Since you have to get granted access to this information, you must offer your customer an advantage to why he should grant you this. 
Now there is the catch! If you have a portal or webshop where your customers have to login, you can provide them the same access, only they use their LinkedIn credentials to log in. And let’s be honest, everybody remembers their LinkedIn credentials.

So, what do you need for this?
First of all, you need the following components:
  • LinkedIn developer access 
  • A SAP Java stack such as a Webshop or Portal 
  • SAP CRM 
  • Common sense
Tasks in the Java system
The main goal is to map LinkedIn- user’s memberID to the userID of the person that is logged in. Therefore the customer must first provide his/her ‘normal’ credentials and then click on the button ‘Connect your LinkedIn’.

This first triggers the ‘normal’ authentication flow that is used by the web shop. Then the system catches the user (his password cannot be caught) and fires the LinkedIn authentication.

The following diagram shows the necessary steps:




Step 1 and 2: SAP will first request an access token from LinkedIn by setting up an OAuth connection. There are a number of libraries to do this, in this case the signpost library was used.

Step 3 and 4: The customer then gets a question to grant your application access to use his LinkedIn information (this is the actual gold!!) 

If he grants this access, SAP gets an Access token from Linkedin. This Access token allows SAP to retrieve detailed information about the LinkedIn-user. The token will stay valid until the user revokes the permission.

Step 5 and 6: The following snippets show how the Access token is used to retrieve and store LinkedIn data: 
After the requested data has been parsed, it can be saved into SAP using a trusty old JCO Function Call

Lessons Learned Java
That sums up the work needed in the Java stack. There are a number of catches though:

  • Library availability for your platform: An Oauth connection can be tricky to set up, so you really need to use an external library. We however found that most Java based libraries need Java 1.5 and up, while the SAP Web shop still uses trusty old Java 1.4.2. We employed some tricks and wizardry to get it working.
  • System Time Settings: Make sure that the time settings on your Java stack are current and aren't off by more than 5 minutes. Any more than that and LinkedIn will refuse any requests for security reasons, but without a clear error message!
Tasks in the CRM system
As most of the information coming from LinkedIn will not fit in standard SAP CRM fields (think of current employer, last employer etc), we decided to save the retrieved information in custom tables that have been appended to the Business Partner, using the Easy Enhancement Workbench (EEWB) or Application Enhancement Tool (AET).
The table contains the actual LinkedIn user information, but also his authentication key and identifier:
To enable the customer to continue, he will log in to the web shop using an initial password that replaces his original SAP password. Therefore he can not use his SAP password again, and is forced to login using LinkedIn, or request a new password.

This whole flow wouldn’t make any sense, if the information isn’t shown anywhere. Therefore we made the fields available as an assignment block on the Business Partner overview in the CRM Web UI.

The first block in the screenshot is always available and can be automatically updated as long as the customer has still granted you permission. The second one is an online view of the public profile of the customer. 

Conclusion
So, you question: “What is the use of it, if you have captured this information once, while in the current fast-moving world everybody changes jobs once every 3 years?”. LinkedIn provides the possibility to do an update of up to 100.000 profiles every day! So, if you have less than this amount of BP’s, you could update all of your Business Partner’s daily!

Oh and by the way, we can do this trick with the Facebook login as well!

No comments:

Post a Comment