boddhisattva
boddhisattva

Reputation: 7390

A way to talk to messaging api of linkedin through rails

Scenario:

I'm a registered user of a site(a rails app).

I have my contacts in linked in whom I would like to invite to see this app(it would be followed up with their registration into this app).

For this , I would be sending them a message with a subject and body.

Rays of Hope:

I need to make use of the messaging api of linkedin and make it talk with my rails app. I can't use the connections api of linked in to retrieve the email addresses as basically any of the linkedin api's don't expose my(the registered user of linked in) contacts email.

To talk with the connections api in my rails app, I was making use of the linkedin gem. It doesn't look like this gem as of now has support for the messaging api of linkedin.

Finally:

Any ideas where can I get started on this..?. I'm kinda clueless as I have never played around with api's directly, ..yet..:).

I'm on Ubuntu 10.04 OS.

Thank you

Upvotes: 3

Views: 935

Answers (2)

GreenEggs
GreenEggs

Reputation: 527

I had the same problem with the gem lacking messaging functionality. By using the existing code as a reference, I threw this code in an initializer file (config/initializer) and it worked. Give it a try.

LinkedIn::Client.class_eval do
# options should be a hash like this:
# options = {:recipients => {:values => [:person => {:_path => "/people/~" }, :person =>   {:_path => "/people/USER_ID"} ]}, :subject => "Something",:body => "To read" }
  def send_message(options)
    path = "/people/~/mailbox"
    post(path, options.to_json, "Content-Type" => "application/json")
  end
end

Upvotes: 2

boddhisattva
boddhisattva

Reputation: 7390

This might not exactly answer the question, but could be of some help..

Have you looked here:

https://github.com/pengwynn/linkedin/blob/master/lib/linked_in/api/update_methods.rb

If you'll log an issue on the project repo and include some code, the whole community can try to help:

https://github.com/pengwynn/linkedin/issues

This was provided by Wynn Netherland on contacting him. Credit goes to him..:)

Upvotes: 1

Related Questions