Hi guys,

This is quick tutorial about linkedin api 1 – invitation by people email to join your linkedin network.

We will use linkedinapi rails plugin ( Created by Dimas Priyanto and Me base on oauth rails plugin )

  • initialize your linkedin api key and secret key
>> linkedin_api_key = ” YOUR LINKEDIN API KEY”

>> secret_key = “YOUR LINKEDIN API SECRET”

  • setting your callback
  • create oauth object
>> oauth = LinkedIn::Oauth.new(linkedin_api_key, linkedin_secret)
  • request authorize url

Open the link in your browser  as redirection url for user to do authorization process,
if user authorize it we will get params[:oauth_verifier] in our “callback_url”,
use it to authorize from request

for example:

  • authorize using oauth verifier and token
>> oauth.authorize_from_request(oauth.request_token.token, oauth.request_token.secret, oauth_verifier)
  • create linkedin api object
>> linkedin = LinkedIn::Base.new(oauth)
  • show your linkedin profile
>> linkedin.profile
“<?xml version=\”1.0\” encoding=\”UTF-8\” standalone=\”yes\”?>\n<person>\n  <first-name>Feby</first-name>\n  <last-name>Artandi</last-name>\n  <headline>Ruby on rails programmer</headline>\n  <site-standard-profile-request>\n    <url>http://www.linkedin.com/profile?viewProfile=&amp;key=30011332&amp;authToken=nM0a&amp;authType=name&amp;trk=api*a101208*</url&gt;\n  </site-standard-profile-request>\n</person>\n”
=> “<?xml version=\”1.0\” encoding=\”UTF-8\” standalone=\”yes\”?>\n<person>\n  <first-name>Feby</first-name>\n  <last-name>Artandi</last-name>\n  <headline>Ruby on rails programmer</headline>\n  <site-standard-profile-request>\n    <url>http://www.linkedin.com/profile?viewProfile=&amp;key=30011332&amp;authToken=nM0a&amp;authType=name&amp;trk=api*a101208*</url&gt;\n  </site-standard-profile-request>\n</person>\n”
  • invite people by email, first name and last name
linkedin.invite_by_email(“feby@kiranatama.com”, “Feby”, “Artandi”)

That’s it, enjoy ! 🙂


Comments on: "How to use linkedin api – invite people by email in ruby on rails" (10)

  1. Great… Excellent… what is always using xml to post data invitation ? have you tried to use data collection and change type of header.

    Totally i love this script because use call_back

  2. Thanks Feby for explanation by email, you are excellent rails developer. My problem is solved by your way. Post more rocking hacking rails.

  3. dimaspriyanto said:

    Hi Feb,
    Accidentally i found this post, nice post!!
    I also put the plugin repository in github:


    i think github is more popular than unfuddle, how about pushing your changes to there? and we can continue for further development of the plugin together.. 😉

    Dimas Priyanto

  4. K.Muralidharan said:

    I read you articles. it is useful for me. It redirect to my application but parameter absent. i print the value params[:oauth_verifier], it show empty.
    Linkedin callback Error : parameter_absent.

    I need to fetch user token, secret. then use that i try post message in linkedin.

    Please help me.


    • febyartandi said:

      Hello Murali,

      I dont know about error: Linkedin callback Error : parameter_absent.
      Maybe this is because updates on linkedin API.
      The steps on this article work for linkedin API version 1, but I dont know if it work in current API now.
      I will check current API when I available and let you know if I found solution for this problem


      • K.Muralidharan said:

        Hi Febyartandi,
        Thanks for you valuable replay.I will check with that & Let you know.


  5. I really like what you guys tend to be up too. Such clever work and reporting! Keep up the excellent works guys I’ve included you guys to our blogroll.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Tag Cloud

%d bloggers like this: