Howto use FB Graph to post a message on a feed (wall)

Howto use FB Graph to post a message on a feed (wall)

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Why Your POST /feed Request Returns Silence (And How to Fix It)

You have successfully authenticated your user and retrieved a list of friends using OAuth. You know how to read a feed by hitting /users/feed, and you see documentation suggesting that posting should be as simple as sending a POST request with a form-encoded message parameter. However, when you attempt this in production—whether via raw cURL or the Facebook PHP SDK—you get no errors, no posts, and certainly no confirmation. The silence is deafening because the HTTP status code often returns 200 OK even when the operation failed silently due to permission scopes.

The core issue isn't your access token validity; it is the specific permissions granted to that token. Facebook (Meta) operates on a strict principle: user data and actions are private unless explicitly shared with the application via an approved scope. While reading a friend's feed might only require user_friends or even no special permission depending on the context, writing to a feed—specifically /feed or /me/feed—is a sensitive action.

When you see documentation showing a raw cURL command like this:

curl -F 'access_token=[...]' -F 'message=Hello' https://graph.facebook.com/[userid]/feed

you are looking at a historical example that likely predates the current permission model or assumes an implicit context that no longer exists. If you run this today without the publish_actions (or its modern replacement) scope, the API accepts the request but discards it immediately. The response body might be empty, or it might return a generic success status that masks the failure.

The Scope Requirement

To post to a user's wall, your application must hold the publish_to_groups or pages_show_like scope if posting to groups/pages, but for personal profiles, you need the permission to publish actions on their behalf. In the legacy Facebook SDK era and during the transition periods, this was often referred to as publish_actions.

However, the most critical detail is that you cannot simply pass any valid access token. You must ensure that the user has explicitly granted your app the permission to post on their timeline. Even if you have user_posts_read, that only allows reading. To write, you need publish_to_groups for groups or specific permissions for personal profiles which often require an extended privacy dialog during login.

If you are using the Facebook PHP SDK (v4+), the implementation changes slightly compared to the legacy v2.3 SDKs shown in older tutorials. The modern Graph API requires you to pass the scope as part of the token generation, not just as a parameter in the API call.

Correct Implementation with Modern Standards

If you are using a recent version of the Facebook SDK for PHP, the api() method handles permissions internally if the token is correct, but it will fail if the scope is missing. Here is how you structure the request correctly:

require_once 'vendor/autoload.php'; // Assuming Composer installation

$fb = new \Facebook\Facebook([
    'app_id' => 123,
    'app_secret' => 'secret',
    'default_graph_version' => 'v18.0', // Or the latest stable version
]);

// Ensure $this->access_token has the publish_to_groups or equivalent scope attached
$token = $this->getAccessTokenFromUser(); 

try {
    $fb->api(
        '/me/feed', 
        'POST',
        [
            'message' => 'Playing around with FB Graph...',
            'link' => null, // Optional: Add a link if desired
        ],
        ['access_token' => $token]
    );
} catch (Facebook\Exceptions\FacebookResponseException $e) {
    echo 'Graph API error:', $e->getMessage(), PHP_EOL;
}

The key takeaway is that the POST /feed endpoint does not work with a token that only has read permissions. If your current token works for /me?fields=id,email, it likely lacks the write scope. You must re-authenticate the user, ensuring they click "Allow" when prompted to grant publishing permissions.

Handling Errors Gracefully

Because the legacy API often returned 200 OK on silent failures, relying solely on HTTP status codes is a trap. Modern error handling requires you to catch Facebook\Exceptions\FacebookApiException. If the scope is missing, the exception message will explicitly state that the access token does not have the necessary permissions.

Do not assume that a lack of errors means success. Always inspect the response body and handle exceptions. Furthermore, remember that posting to arbitrary user IDs (like your friend's wall) requires specific permissions (user_posts) regardless of whether you use /me/feed or /[friendid]/feed. The API enforces strict ownership rules: you can only post to your own timeline by default unless the user has explicitly authorized your app to publish on their behalf.

If you are looking for a more robust way to manage these permissions and graph requests within a larger framework, Laravel offers strong abstractions that can simplify token storage and scope management. For instance, packages like laravel-facebook integrate well with the broader ecosystem, allowing you to handle OAuth flows without reinventing the wheel for session management.

Ultimately, the fix lies in securing the correct permissions during the login flow and ensuring your access token reflects those grants before making any write calls.

Our network