ruby-on-railsfacebookkoala

Using Koala, how can I attach an image when I publish to a user's stream?


I've started to play with the Koala gem for a RoR app. I've already got permission from the user to publish to their stream

After this line

graph = Koala::Facebook::GraphAPI.new(@facebook_cookies["access_token"])

to post to the stream, I can do a

graph.put_object("me", "feed", "I am writing to my wall")

The above works, but how do I include an image like http://example.com/foo.jpg as part of the update? I tried reading up the Stream Attachments but without a lot of luck. Does anyone have some sample code?


Solution

  • You can use something like:

    options = {
      :message => "I am writing to my wall",
      :picture => "http://example.com/foo.jpg"
    }
    graph.put_object(facebook_uid, "feed", options)