0

I'm trying to post a message using the Graph API and a C++ program. I have tried three different methods:

  1. GET with a URL like https://graph.facebook.com/USER_ID/feed?access_token=TOKEN&message=Hello
  2. POST and X-WWW_FORM
  3. POST and FORM-data

In the case 1, I receive the complete list of messages as an answer, but the message doesn't add to the feed.

In the case 2 and 3, I receive an error 403 as the response.

USER_ID and TOKEN are correct and my application has the right permissions. I have reached posting an image to an album with the same application, but it's impossible for me right now to publish messages. Why?

Vivek Singh
  • 2,047
  • 11
  • 24
Agusti
  • 13
  • 1
  • 3

1 Answers1

2

The first method won't work because you need to issue an HTTP POST to that endpoint to publish a new feed story, as a commodity facebook provides the "method=post" GET parameter to "fake" a post, this will work

https://graph.facebook.com/USER_ID/feed?access_token=TOKEN&message=Hello&method=post

and as response you'll get the id of the new post

{
   "id": "499801468_1001264776039"
}

Here you can find more details on publishing with the Graph API http://developers.facebook.com/docs/reference/api/#publishing

Arjuna Del Toso
  • 579
  • 3
  • 13
  • I recieve this answer from facebook: { "error": { "type": "OAuthException", "message": "(#200) The user hasn't authorized the application to perform this action" } } With the same acces_token that I use to upload photos and I have the "publish_stream" permissions [link](http://developers.facebook.com/docs/reference/api/post/) – Agusti Aug 29 '11 at 16:08
  • 1
    Verify that you definitely do have the publish stream permission by calling '/me/permissions' in the Graph API. Also check that the user whose wall you're posting on doesn't have privacy settings which prevent the user your access token is for posting on their wall – Igy Aug 29 '11 at 17:15
  • Thanks @Igy, I had a wrong permission tag, and recieve an auth error, but the session begins with the old permissions that my app had – Agusti Aug 30 '11 at 07:42
  • @Agusti I am getting 403 error. can you tell me what is User Id that we need to pass? I am using http://stackoverflow.com/questions/38829622/posting-on-facebook-via-unificationengine to post messages. – Always_a_learner Jan 06 '17 at 07:09
  • @lgy can you please answer this question -> http://stackoverflow.com/questions/41544642/forbidden-error-403-in-unification-engine-api-while-sending-message. I have checked everything you have mentioned in your comment. – Always_a_learner Jan 09 '17 at 11:11