function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Integration - salesforce with linkedIn


I am new to salesforce integration,i got a requirement as to integrate salesforce to linkedIn,whenever i create a record to the custom object.In custom object i have a custom link after clicking on that link it should post on my LinkedIn wall.

Please,,,,,,,,, help me guysssssssssss,,,,,,,,,
Hi , 

There are couple of Apps, 

Free LinkedIn Integration for Salesforce

Linkedin products:

Free LinkedIn Integration for Salesforce!/LinkedIn/Salesforce

Slide share by Linked in:

Sample code:

Hi Ashish,

Thank you for the links but if u provide any sample code linkedin integration means it will be more benifitable for me and others also........................
Hi Keerthi, 

For Sample code to start off, 

1) Sign up for a Salesforce and LinkedIn account.
2) Sign into the LinkedIn developer account at:
3) Under your name in the upper-right corner click on ‘API Keys’
4) Click on ‘Add New Application’
5) Fill out the form and click on ‘Add Application’
6) You will get a confirmation page that includes your API Key, Secret Key, OAuth User Token and OAuth User Secret
7) One thing to note right away is that this basic LinkedIn application has limits on it for the number of calls.  If you click on the ‘VIEW API USAGE’ link you will see your daily limits.
8) Now everything is setup so that we can write the integration code for LinkedIn in Apex. 
9) The first step in the OAuth sequence is to call a LinkedIn endpoint passing your API Key and the redirect_uri among other things.  Basically, you are sending the user to LinkedIn where the user will login and then grant access to your LinkedIn application.  LinkedIn will then pass back an Authorization Code on the query string to the URL that was passed in the ‘redirect_uri’ parameter.  Here is some simple Apex code to make this call.

public PageReference newAuthorizationCode(){
    string APIKey = getMyAPIKey();  //Store the API key in a custom setting
        <a href=""></a>
        string state = 'Anything you want returned to you'; //This state value will be passed back on redirect_uri
        string myEndPoint = '';
        string redirectPage = '';
        string scope = 'r_basicprofile r_fullprofile r_emailaddress r_network r_contactinfo rw_nus rw_groups w_messages';
        redirectPage = EncodingUtil.urlEncode(redirectPage, 'UTF-8');
        scope = EncodingUtil.urlEncode(scope, 'UTF-8');
        state = EncodingUtil.urlEncode(state, 'UTF-8');
        myEndPoint = '';
        myEndPoint += 'response_type=code';
        myEndPoint += '&client_id=' + APIKey;
        myEndPoint += '&scope=' + scope;
        myEndPoint += '&state=' + state;
        myEndPoint += '&redirect_uri=' + redirectPage;
        PageReference pr = new PageReference(myEndPoint);
    return pr;
The scope parameter is important as that specifies what access the caller should have when accessing the LinkedIn API.

10) Now you need to add code to the ‘LinkedInReturn’ Visualforce page in order to get the Authorization Code off of the URL.  The Authorization Code will come back in the ‘code’ query string so you will be able to get it like this in Apex:

myoAuthCode = ApexPages.CurrentPage().getParameters().get(‘code’);

11) Now that you have the Authorization Code you get call LinkedIn to get an Access Token.  You must POST to an endPoint that is built like this…

LinkedInEndPoint = '' +
            'grant_type=authorization_code' +
            '&code=' + oAuthCode +
            '&redirect_uri=' + redirectPage +
            '&client_id=' + APIKey +
            '&client_secret=' + ClientSecret;
This will return some JSON that will contain your Access Token.

12) With this Access Token you can now make your calls to LinkedIn to get the data that you want.  For example, passing this type of data to the v1/people/id endpoint will return JSON data that has information about that specific user:

Http h = new Http();
HttpRequest req = new HttpRequest();
string accessToken = getAccessToken();  //This is the Access Token which we retrieved earlier.  Maybe store it in a custom setting.
req.setEndpoint('' + linkedInKey +
                ':(first-name,last-name,headline,location,distance,num-connections,picture-url,positions,public-profile-url)?format=json&oauth2_access_token=' + accessToken);
The linkedInKey can be retrieved by using the search API calls from LinkedIn.

13) At some point this Access Token will expire so you should try to refresh it before that happens.  If you do not do this, then you will have to repeat all of the steps above to get a new Access Token.

I hope this gives you a jump-start in building your own integration with LinkedIn.

Hi Ashish,

thank you for ur reply i tried this what ever u mentioned but i strucked at 10 th point.
Hope this will work for you

Apex page

public class linkedinauth {
    public String x{get;set;}
    public static final string REDIRECT_URL='';
    public static final string LINKEDIN_API_KEY='<your Linkedin API Key>';
public static final string OAUTH_CODE_END_POINT_URL='';
    public static final string SCOPE='r_basicprofile r_fullprofile r_emailaddress r_network r_contactinfo rw_nus rw_groups w_messages';
    public static final string STATE='YOUCANGIVEANYVALUE'; 
   public PageReference connect(){
     PageReference pageRef = new PageReference(x);
     return pageRef; 

VF Page

<apex:page controller="linkedinauth">
<apex:form >
     <apex:commandButton value="Call Linkedin" action="{!connect}"/> 
dinesh kannandinesh kannan
I am also new to salesforce requirement is salesforce to linkedin integration...360 degree Built-in view to LinkedIn for client interaction..can u send me the code pls...
SS KarthickSS Karthick
Hy folks,
      I want to post a job on linkedin from salesforce.
For that I need OAuth signature but I dono how to get OAuth signature?

Please help!

Could you please help me, Integrate salesforce with LinkedIn Using Webservices?