Post on a company facebook page wall on behalf of a user - facebook

I have a wp7 app that connect with facebook and lets assume i have the users access token
I am wondering if it is possible to write on the wall of some company facebook page as the user. (i have no ownership of the facebook page and not affiliated with it in any way)
If it is, do you know which permission do i need to obtain ? would love to get any kind of code snippet or a direction i should follow.
Thanks.

it's not possible to write on the wall on behave of the user. You always get a token in the context of a Facebook application - so it will be the app posting on the wall, not the user. And the maximum permission app can ask a user for is publish_stream which allows you (your app actually) to:
Enables your app to post content, comments, and likes to a user's
stream and to the streams of the user's friends.
so in order to post to the company wall, you need to:
Request publish_stream permission from the user
Issue a post request to https://graph.facebook.com/<>/feed url with your message
It's really easy to test. Go to https://developers.facebook.com/tools/explorer, click on "Get access token", select "publish_stream" permission in "Extended" tab, set action to POST, enter "LGUSA/feed" into URL field, click on "Add a field", enter "message: test" and click POST. You will get ID of your post back. See screenshot attached

Sorry this is going to be a bit vauge, but here goes:
First the user is going to have to be authenticated to facebook. There is a good example here. This will give you an authentication tolken to allow you to interact with the API.
The user is going to need facebook permissions to write to the wall. Facebook permissions are described here. I don't know about the specifics of your problem, but with more details I may be able to help more.
then you shoud be able to post to the appropiate wall using the facebook graph api (you'll probably need to be signed up to facebook with a developer account to get to this page).

Related

How Do I Share to Facebook With Custom Text

I have a task to add links to a web page to enable the user to post a short message to Facebook. There may be multiple messages on the page, each with its own link. The intent is to launch a Facebook share dialog pre-populated with the text of the message which the user can then modify, accept and/or reject.
I'm pretty new to programming anything for Facebook. I'm fairly confused and am not sure what to ask first, so I'll go with a very basic question: what's the simplest way to do this? I gather from Facebook's documentation that I probably have to use the Javascript SDK and/or the Open Graph technology. Is this correct, or is there another option I'm missing? Is there a really clear example of this kind of solution anywhere?
Thanks!
You have to create a facebook app first so you have your app_id and app_secret.
After that you need to request permissions to the user to publish_actions. If the user accepts, you'll receive a token (you need to store it in db). If you need to publish actions in a user page instead of his own page, you also need the manage_pages permission.
You need to read the facebook graph api documentation to understand how all this works.
The access token you receive expires after certain time. So, when you receive it, you can ask for a long lived token. The page tokens doesn't expire.
Facebook evaluates your app before approving it to be in production. They ask a couple of questions about how you'll use the user's token and data. You might have to put pictures of the flow too.
As far as I know, Facebook won't allow you to send pre populated messages to the user's wall. They user has to write it.
Hope it helped a bit!

Does facebook API allow a website to send notification to non-member?

I may be messing up with some ethics of asking here, and I apologize for that but I have a project in mind and to target new users I have an approach. Please read below, and allow my amateurity some leeway.
Suppose user1 gets on my site and enters the facebook profile URL of user2. Now user2, who has never visited my site, doesnt know of it, doesnt have an accoutn on it or anything, gets a notificatoin on his facebook that user1 has entered his profile url or has involved user2 in osme activity.
Does the faceabook API allows this? I've a friend who has used facebook GRAPH but he's unsure about this. Can any of you please direct me?
Secondly, if that requires me to create** a facebook app of the website(the app will grab the notification first and then forward it to target's facebook notifications), do facebook apps/developer cert. cost something?

Posting message to user's wall from C# server app

We are having a problem with the review of our app which needs FB user's authorization to publish a post to his wall (publish_actions permission rejected by FB reviewer). The post is a promo offer developed by some retail store which is generated on server and needs to be put on user's wall.
We are seeing this in many cases by apps that are approved by FB but the reviewer has stated this: 'Make sure the user message area is not pre-filled in any way by the app otherwise the submission will be rejected. This includes hashtags, URLs, and any other text not written by the user.’
What we see in many cases is that the message is pre-filled with text from a publisher so that when its posted to the wall you see an image with some text including a link to the FB page of the publisher. Does anyone know why we are not allowed to do the same?
Prefilling is not allowed. It does not matter if you see it in another App, it´s still not allowed. If you believe an App does it, report it to Facebook.
Also, the user profile is not a place to advertise, each and every single post to the user wall must be written and authorized by the user. You can only add a link with Open Graph tags to it. See the docs for information about all the possible parameters: https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed#publish

How to post to a user's wall at a later date

I'm trying to figure out how, after a user has opted into my Facebook Application, to retain their credentials so as to post to their wall at a later time. I see apps doing this all the time, but I'm unclear where/how they store the user's login (I'm guessing they're not actually holding on to U/P but rather just have some key to post to the user's wall), and then do the post at some later time.
I'm unable to find the documentation for how to do this at the facebook developer site and am hoping someone can point me in the right direction.
TIA
Ask for publish_stream permissions then post to that user's wall using your "app" access token if the user access token has expired.
Facebook documentation here: http://developers.facebook.com/docs/reference/api/permissions/
publish_stream
Enables your app to post content, comments, and likes to a user's
stream and to the streams of the user's friends. With this permission,
you can publish content to a user's feed at any time. However, please
note that Facebook recommends a user-initiated sharing model.

Facebook PHP SDK - Post to user's wall as app and not user. How?

I have a few questions about Facebook PHP SDK I haven't found the answers to yet, hope someone here can help.
I have made a page where users connect to Facebook to be able to share things via my site on their wall. I don't want to use the offline_permission. But I need to be able to delay post, cause sometimes we need to confirm choices they use. I read that YOU CAN post at any time with stream_publish, but you need to post as THE APP and not THE USER. Right now I think I post as the user. How do I post as the app?
Thanks!
Read the Facebook Authentication documentation, specifically the section titled "App Login" where it tells you how to authenticate as the application. Basically you navigate to this url: https://graph.facebook.com/oauth/access_token? client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials and that will give you a session token to act as your page.