I'm using the fb_graph gem in a Rails 3.1 app. I'd like for users to be able to post links to their Facebook wall from my site. Here's my code that posts the link:
me = FbGraph::User.me fb_token
me.feed!(
:message => message,
:link => link_url,
:name => link_name,
:description => link_description
)
At first glance, this works great. The link is posted to the user's wall and the user's message and the link description appear perfectly.
The problem is that only links back to my site work. If a user clicks a link on their facebook wall that happens to go to another site, then they see a facebook error that says:
An error occurred with my-app-name. Please try again later.
During authentication, I'm requesting publish_actions and publish_stream. Is there another permission that I'm missing? Or could the problem be that my FB app is not setup propertly or I'm not posting the link in the correct way? Any assistance is greatly appreciated!
Thanks!
Check that you have the migration „Stream post URL security disabled in your app settings – if it’s enabled, links in posts can only point to the apps canvas page or website.
Ok, I found a workaround to this issue. Instead of using the feed! method, the link! method works perfectly:
me.link!(
:message => message,
:link => link_url,
:name => link_name,
:description => link_description
)
This isn't an entirely satisfying answer to the question because it's more of a workaround, but I figured I'd throw this out there if anyone else runs into the same issue.
If anyone has an answer to the actual problem to my original question, I'll gladly switch the correct answer!
Related
I am working on an app that creates albums in Facebook and then adds photos to the album. That side of things is working fine.
When the photos are added to the album facebook puts on the users timeline* something like " has added new photos to the album ."
What I would like to do is suppress this message, or at least customize it a little.
Does anyone know if this possible with the Facebook API? I have not been able to find anything in their doco, and suspect it is a automated thing that facebook doesn't give control over, but would like to get confirmation.
Cheers!
*not 100% sure if this is strictly the "timeline" or just their wall.
Use the no_story = 1 parameter.
$newphotodata = array(
'access_token' => $fanPageAccessToken,
'message' => $message,
'no_story' => 1,
'aid' => $albumId,
'image' => '#' . $picturePath);
$uploadedphoto = $facebook->api('/' . $albumId . '/photos/', 'post', $newphotodata);
I am working on this topic myself at the moment. This is my latest on it: http://facebookanswers.co.uk/?p=322
Incidently, have you worked out a way to generate a proper timeline post when you create a new album. If you do it manually, you get a nice post showing four of the images. But if you use the API you cannot get that. You can nearly get it by posting to /links/ but its still not quite right, as friends will just see a single icon.
Well, looking at the facebook api I can find no mention of how to suppress these automated status updates. From this I have concluded that it is not possible to modify or suppress these status updates.
Thinking about it some more I can understand why facebook would not these messages suppressed or changed as it could be abused by apps to make posts without a user noticing.
Just close the window after uploading and open again IE.
When the user installs my facebook app for the first time, a facebook logo is displayed, permissions are requested, and then the user is popped out of the iframe.
I applied the directions recently (Oct 14th) added to the OmniAuth Overview wiki page on the devise site regarding lost sessions. And this has fixed all my redirect issues except when the permissions dialog shows up.
Anyone else seeing this? Any idea how to fix? Help!
Figured it out on my own.
The OmniAuth Overview wiki page suggests the fix below in application_controller.rb to fix lost sessions:
def authenticate_user!
if !current_user
# This should work, but session is lost.
# session[:return_to] = request.fullpath
redirect_to user_omniauth_authorize_path(:google_apps, :origin => request.fullpath)
end
end
But instead of using request.fullpath in the snippet above, the key is to use request.env["HTTP_REFERER"] instead.
last week, I integrated successfully twitter with my "small" rails app. If I create a new record in my rails app it will be posted on twitter.
But how Do I do this with facebook? Twitter was really easy (thanks to the Twitter gem)
Can you recommend a gem? A link to an example app would also be nice.
Thanks in advance
cheers tabaluga
p.s. Oh, I forgot to mention, I do not have a personal facebook account. The Facebook Wall is a Company site.
I am using fb_graph and I really like it, very easy to use.
To post to a Wall you simply do:
me = FbGraph::User.me(access_token)
me.feed!(
:message => '',
:link => '',
:name => '',
:description => ''
)
I've asked this question on the facebook and ping.fm developer forums, but they don't seem to be very busy at the moment. So lets see what you lot can do...
I have included meta tags for title, description and image_src on my site so facebook can pick this information up and display it on users's posts on facebook. I am using ping.fm to make the post to facebook. The meta data appears to work fine on a 'pages' page on facebook, but on individual user's walls it doesn't show any of the meta data in the post.
Any ideas why this is?
I'm not really a facebook developer, but would like this to work so if there is something that I need to do let me know.
The link that is being posted to facebook is a ping.fm tinyurl, but as I said it works on 'pages'.
Not sure how you're sharing/posting this on Facebook, but maybe the URL Linter will help? Maybe you can share the URL for the page in question.
I found that it was actually a ping.fm setting in the users account which was preventing this.
I'm sharing a link on a user's feed - everything seems to be valid, but there's no Share link (Share button)... What is it that I'm doing wrong?
try {
$su = $facebook->api(
"/{$uid}/feed",
"post",
array(
"access_token"=> $access_token,
"message"=> "Message",
"link" => "http://url",
"picture"=> "http://url"
);
} catch (FacebookApiException $e) {
print_r($e);
}
Thanks in advance,
Doori Bar
very strange. I have the same problem. I have developed a Facebook App and I used a function to post on the user wall. But on the user Wall there is no "Share" link. It's only possible to like or comment it.
If I use this other technique, a dialog showing to post (on wall) OR to "send as a message instead" is displayed. (I was looking for this feature as well).
And the good thing is that the resulting post to the wall can be liked, commented AND Shared.
This is the javascript code that can help you to obtain this functionality:
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a rel="nofollow" href="http://www.facebook.com/share.php?u=<;;url>" onclick="return fbs_click()" target="_blank">Share on Facebook</a>
Taken from http://askville.amazon.com/add-Share-Facebook-button-webpage/AnswerViewer.do?requestId=1539369
Hope this helps. It helped me at least ;)
You can create your own "Share" link using Actions described in the graph API here:
http://developers.facebook.com/docs/reference/api/post/
for example as json: {"name":"Share", "link":"http:\/\/www.facebook.com\/share.php?u=http%3A%2F%2Fvisibli.com"}
Note: the url param u must be url encoded.
I'm fairly confident this is a bug. To encourage Facebook to fix this issue, please "vote" for this bug by adding your app as a "repro" at the following link:
http://developers.facebook.com/bugs/154484061346461?browse=search_4f903d2ea60569f93022163
UPDATE:
Facebook marked the previous bug report as "Fixed" but it is NOT fixed. Please vote for the new bug:
http://developers.facebook.com/bugs/252491528185120