0

I need to post a message to the FB business page (of the restaurant, for example) on behalf of my FB app.

The use case is following: 1. User goes to the store 2. User gets the notification on his phone and opens it 3. User is redirected to the FB page of the store where he can log in and post a message or just post it on behalf of the app

The question is: which steps should be followed in order to allow my app to post on the FB page of the store? (I can't find a good description of this case in FB Graph API docs).

Can anyone suggest the best link to read through in order to get this answer?

hrmcd
  • 51
  • 1
  • 3

2 Answers2

1

I also tried something similar. It works if you use page_id and page access token, but in that case the post is published on behalf of page itself and not user. When used user access token, it did not work. I read somewhere that Facebook has deprecated such posts where session user is different than the id where the publish is taking place. Could not find any solution till now.

0

This one: https://developers.facebook.com/docs/authentication/applications/

Although, if you're posting to a page, you may need to authenticate as the user, rather than as the app. In this case, see here: https://developers.facebook.com/docs/authentication/client-side/

Also, if you authenticate as a user, you'll need the publish_stream and user_likes permissions. It almost goes without saying that the user will need to have 'liked' the page.

Cal McLean
  • 1,408
  • 8
  • 15
  • Thanks for the link. So, the first step is to get access token for my app (which went well), and then I can make a post using it, it's clear. Next, I'm trying to do a post using the following API: POST https://graph.facebook.com/BUSINESS_PAGE_ID_GOES_HERE/feed with the POST data: access_token=MY_ACCESS_TOKEN&message=Wall Post Check And I'm getting the following error back: {"error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200}} What exactly I'm doing wrong here? – hrmcd Sep 11 '12 at 16:26
  • Did you acquire the permissions? If you have already authenticated you app before adding them, you often need to de-authorize and re-authorize. – Cal McLean Sep 11 '12 at 16:52
  • Could you please explain how to acquire these permissions? Should I send additional call for that? – hrmcd Sep 11 '12 at 17:12
  • Firstly, go to https://developers.facebook.com/apps and click 'Edit App'. Click 'Permissions' from the left-hand side. The permissions entry boxes are below. Add the above permissions to the 'Extended Permissions' box. Then, if you're using the JS API, see here: https://developers.facebook.com/docs/reference/javascript/FB.api/ – Cal McLean Sep 11 '12 at 17:16