I'm using the Koala gem in a Rails 3.2 app.
I'm trying to post an action that includes a user generated photo to a Facebook application. According to FB's docs, the url I need to post to is:
https://graph.facebook.com/uid/namespace:action?object=http://path/to/page&image[0][url]=http://path/to/image.jpg&image[0][user_generated]=true
If I test this manually using Facebook's debugger, it works perfectly. But I'm having trouble achieving this with Koala.
I'm using the following method:
Koala::Facebook::API.new(app_token).put_connections( uid, namepsace:action, url )
If I use:
url = "http://path/to/page"
then the action is posted to Facebook correctly, but without the user generated photo.
If I use:
url = "http://path/to/page&image[0][url]=http://path/to/image.jpgimage[0][user_generated]=true"
I receive an error in the logs
#<Koala::Facebook::APIError: OAuthException: (#3502) Object at URL http://path/to/page&image[0][url]=http://path/to/image.jpg&image[0][user_generated]=true has og:type of 'website'. The property 'object' requires an object of og:type 'namespace:object'. (http response code: 404)>
What is the correct way to construct the required post url using Koala? Or what is a good approach to begin debugging my current code? Or am I totally on the wrong track with this?
I struggled a ton with this too, both because of Facebook's documentation and Koala's which are not super clear in my opinion:
Koala::Facebook::API.new(access_token).put_connections(
uid,
"namespace:action",
"product" => "[URL_TO_PRODUCT]",
"image[0][user_generated]" => true,
"image[0][url]" => "[URL_TO_USER_GENERATED_IMAGE]",
"fb:explicitly_shared" => true,
"message" => "[DESCRIPTION]"
)
The other thing was that the target URL had to have og:type="namespace:product"
Hope this helps