Skip to content

Instantly share code, notes, and snippets.

@emad-elsaid
Created April 2, 2014 13:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emad-elsaid/9934039 to your computer and use it in GitHub Desktop.
Save emad-elsaid/9934039 to your computer and use it in GitHub Desktop.
post to your linkedin account using ruby this was to as simple as it looks, first the linkedin gem installation is simple we know that just "gem install linkedin" the example of linkedin gem usage was longer, first you have to generate an authentication request url pass it to user to open then user will get a pin he copy and paste it to your app…
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
require 'linkedin' # gem install linkedin
require 'json'
# create an appliation then
# get your api keys at https://www.linkedin.com/secure/developer
config = {
your_consumer_key: 'xxxxxxxxxxxxxxxx',
your_consumer_secret: 'xxxxxxxxxxxxxxxx',
oauth_user_token: 'xxxxxxxxxxxxxxxx',
oauth_user_secret: 'xxxxxxxxxxxxxxxx'
}
client = LinkedIn::Client.new(
config[:your_consumer_key],
config[:your_consumer_secret]
)
client.authorize_from_access(
config[:oauth_user_token],
config[:oauth_user_secret]
)
client.add_share(
comment: 'Good Morning',
content: {'submitted-url' => 'http://www.github.com/blazeeboy' }
)
@johansmitsnl
Copy link

Can you also post a share on a company page you own?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment