Post to Page as another Page - Facebook API - php

I'm looking to have my app post to a non-owned Page AS one of the user's owned pages (owned-page Posted to non-owned-page's feed).
If you log in to Facebook as your page, you are allowed to do this on the desktop platform. However, my trials (and search) have returned that it's "not possible" to execute via Facebook Graph API.
Specifically when I execute the following POST:
/{target-page-id}/feed?message=test&access_token={owned-page-access-token}
I receive the following response from FB:
(#200) Posts where the actor is a page cannot also include a target_id\n other than EVENT or GROUP
Posting to Event or Group works, but doesn't allow me to post to a target page.
Any workarounds? Having a hard time grasping that you can do it on the desktop portal but not via the API
Thanks in advance!

You might try defining who is posting to the page by adding the query string: &from=[name of page]
Ex:
/{target-page-id}/feed?message=test&from=[PageName]&access_token={owned-page-access-token}

Related

Is it possible to display Facebook users timeline on website?

OBJECTIVE: I need to display latest 5 entries from users timeline on website, using PHP.
Please not that i speak about timeline of user profile - not fan page, not group.
SO FAR I DID THIS:
Registered as Facebook developer
Registered app
Obtained token
Opened url: https://graph.facebook.com/USER_ID/feed?access_token=MY_TOKEN
Voila. Feed of that user is displayed now, but..
PROBLEM: So now i have users feed, but it looks like its partially working.
It happens often that it don't displays some updates, sometimes it displays just date of the post and not the content.
However when i try to grab feed from some facebook fan page, then everything work normal.
MY QUESTION: Are we allowed to grab user timeline? If yes, what im doing wrong?
You won't ever see all the information that is visible inside the Facebook app via the api. This comes from how Facebook filters out the data. See this Facebook Developers blog post for more information: https://developers.facebook.com/blog/post/478/
Yes you are allowed to to grab user timeline posts, even with a limit, if your app asks for read_stream permission. Issue an HTTP GET request to the below URL:
https://graph.facebook.com/user_id/posts?access_token=token&limit=5

Facebook: How to update the status from the page profile?

I have a problem with cross-posting to Facebook. I can post some info to my personal wall (used parsing or Facebook API), but I need to post to the page of a group (ex: facebook.com/pages/$Pagename/$PageId ). (I am manager on this group and can post manually, but need the same functionality automatically from my site.)
And I have errors each time I try to do the posting automatically to my own group:(
1) When I use parsing I get message 'The post could not be shared.'
(from m.facebook.com/sharer.php?error=1&_rdr )
2) When I use parsing and send post-data through m.facebook.com/a/home.php?refid=$NumberID
I can post the message from the group page. But if the message contains a link, it is posted on behalf of my profile, but I want to make a post from the group page with link on my site.
3) When I make posting through Facebook API -- I get the error (#200) - "The user hasn't authorized the application to perform this action"
I make server authentication. And I want make this without permissions query of the current user (therefore tried parsing).
again:
I can update own(!) status through this three methods (with link too). I need update profile of my page (message with link).
Is it possible?
Thanks in advance.

How to make the facebook comments on my website and on page's wall post binded?

everybody.
I am developing the facebook tab application. The functionality is pretty simple and is close to the blog.
Page Admin writes articles in the app, and the link to each article is posted on the page's wall via Graph API.
The wall post from step 1 contains a link to the application tab of the page with post_id passed via app_data parameter.
The article itself contains the facebook like and comments plugins on it. To attach this plugins I use the url of the external website on which pages are prepared for Facebook scraping (Open Graph tags and stuff).
And finally the question!
Is it possible to somehow manage the situation whenever user posts the comment inside an application tab, his comment automatically appears near the wall post performed in step 1?
I really hope that the question is clear. Any help, please?
You can publish comments to a Post via the Graph API:
https://developers.facebook.com/docs/reference/api/post/#comments
You will need to ensure that you have:
Requested publish_stream permission from the user
Indicate to the user very clearly that you are going to publish a comment when they do this (to do otherwise would not only break Platform Policy, but would be a crappy experience for users)
Subscribe to the Javascript comment.create event which is fired when someone posts a comment in a comments plugin: https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

Application able to post on user's Wall

I have a Fan Page and I need to post something on users Wall after clicking Like Button. Moreover I need to display different content for users who "Like" the page and for users who don't "Like" the page. Is there an application like "Static iFrame Tab" which already solves this? If not, then how to post something on users Wall? I downloaded the facebook.php file, but I haven't managed to find the required function there.
The user's 'like' status can relatively easily be returned by decoding the signed request sent by Facebook to the page.
I've built a simple fan/like gate that is available over on GitHub - it might help you get up and running.
With regards to posting to the user's wall. I would suggest using the Javascript SDK and reading the FB.ui documentation over on Facebook.

Can a page tab post to a user's wall?

I have a Facebook application used as a tab in a fan page, that displays different information depending on whether tha user is a fan of that page or not.
Now I've been asked to have it post a message to a user's wall if they perform certain action (follow a link or whatever), and so far I haven't found a way to do that. All the documentation I have found refers to stand alone apps, and I've even seen it suggested (in the FB forums) that you can't get the auth token from an app.
So, i still think it can be done, but how?
If a user has authorized your app, you can post to her wall using the PHP SDK. See the PHP SDK api documentation for examples.
All apps have to be iframe apps now, so loading the JS sdk should be fine.
You have to get permissions first ->
http://developers.facebook.com/docs/authentication/#applogin
Then you can post using php with what Dhiren said, or, post with the fb.api function with JS ->
http://developers.facebook.com/docs/reference/javascript/FB.api/
Let me know if you need an example script.
Cheers

Categories