How to use Koala, how can I attach an image when posting to a user stream?

I started playing with the Koala gem for the RoR app. I already got permission from the user to publish in my stream

After this line

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

to send a message to the stream, I can do

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

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

+4
source share
1 answer

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) 
+5
source

Source: https://habr.com/ru/post/1379737/


All Articles