How to post images on Facebook timeline using Graph API 4.0?


Preti

I'm creating an API to publish on my Facebook timeline using Graph API 4.0. To do this, I first create an album and then publish the images in that album.

this is the code

$facebook = new Facebook(array(
    'appId'  => 'APP_ID',
    'secret' => 'APP_SECRET',
    'cookie' => true,
));

$user = $facebook->getUser();
if ($user) {

  //Create an album
  $album_details = array(
        'message'=> 'Album desc',
        'name'=> 'Album name'
  );
  $create_album = $facebook->apiRequest('/me/albums/{user-access-token}', 'post', $album_details);

  dd($create_album);

}

return an error

Raw Provider API response: {\"error\":{\"message\":\" This object does not exist or does not support this action\"

But when I give page token instead of user access token it works fine. I am new here. So, I don't know how to solve this problem.

Sejayoz

Facebook API no longer allows posting to profile feeds.

https://developers.facebook.com/docs/graph-api/reference/v4.0/user/feed#publish

As of April 24, 2018, the publish_actions permission has been removed. See the breaking change changelog for more details. To provide your app users a way to share content with Facebook, we recommend that you use our Sharing product instead.

Related


How to post images on Facebook timeline using Graph API 4.0?

Preti I'm creating an API to publish on my Facebook timeline using Graph API 4.0. To do this, I first create an album and then publish the images in that album. this is the code $facebook = new Facebook(array( 'appId' => 'APP_ID', 'secret' => 'APP_SEC

How to post images on Facebook timeline using Graph API 4.0?

Preti I'm creating an API to publish on my Facebook timeline using Graph API 4.0. To do this, I first create an album and then publish the images in that album. this is the code $facebook = new Facebook(array( 'appId' => 'APP_ID', 'secret' => 'APP_SEC

How to post a video using the Facebook Graph API

stranger b. I'm trying to post video using Facebook Graph API in Nodejs server with Npm package Facebook-node-sdk Regular posts with messages or images are fine for me, but no videos Here is my code: var FB = require('fb'); var request = require('request'); FB

How to post a video using the Facebook Graph API

stranger b. I'm trying to post video using Facebook Graph API in Nodejs server with Npm package Facebook-node-sdk Regular posts with messages or images are fine for me, but no videos Here is my code: var FB = require('fb'); var request = require('request'); FB

How to post a video using the Facebook Graph API

stranger b. I'm trying to post video using Facebook Graph API in Nodejs server with Npm package Facebook-node-sdk Regular posts with messages or images are fine for me, but no videos Here is my code: var FB = require('fb'); var request = require('request'); FB

How to post a video using the Facebook Graph API

stranger b. I'm trying to post video using Facebook Graph API in Nodejs server with Npm package Facebook-node-sdk Regular posts with messages or images are fine for me, but no videos Here is my code: var FB = require('fb'); var request = require('request'); FB

How to delete a post in Facebook by ID using PHP, Graph API

Hamachi Can someone tell me how to delete my own posts in facebook by id using php , i have searched in google for graph API , but i found nothing :( Thanks in advance Lucien https://developers.facebook.com/docs/graph-api/reference/v2.2/post#deleting important

How to delete a post in Facebook by ID using PHP, Graph API

Hamachi Can someone tell me how to delete my own posts in facebook by id using PHP and the graph API I've searched in google but I can't find anything :( Thanks in advance Lucien https://developers.facebook.com/docs/graph-api/reference/v2.2/post#deleting impor

How to delete a post in Facebook by ID using PHP, Graph API

Hamachi Can someone tell me how to use PHP , I've searched in google for graph API to delete my own posts in facebook by id , but I can't find anything :( Thanks in advance Lucien https://developers.facebook.com/docs/graph-api/reference/v2.2/post#deleting impo

How to delete a post in Facebook by ID using PHP, Graph API

Hamachi Can someone tell me how to delete my own posts in facebook by id using PHP and the graph API I've searched in google but I can't find anything :( Thanks in advance Lucien https://developers.facebook.com/docs/graph-api/reference/v2.2/post#deleting impor

How to delete a post in Facebook by ID using PHP, Graph API

Hamachi Can someone tell me how to use PHP , I've searched in google for graph API to delete my own posts in facebook by id , but I can't find anything :( Thanks in advance Lucien https://developers.facebook.com/docs/graph-api/reference/v2.2/post#deleting impo

How does Python execute Facebook Wall Post using graph API?

username I'm trying to post a message to my wall using the Facebook graph API. I have my access_token. I have tried the following URL in my browser. https://graph.facebook.com/me/feed?message="Hii friends"&access_token=xxxxxxxxxx But the message is not publis

Post to Facebook group using FB GRAPH API

koi I'm having trouble posting to a Facebook group using the FB API. So I have authenticated the user with permissions: email, publish_pages, publish_actions, public_profile, manage_pages, read_insights, user_managed_groups I got the access token and then exc

Post to Facebook group using FB GRAPH API

koi I'm having trouble posting to a Facebook group using the FB API. So I have authenticated the user with permissions: email, publish_pages, publish_actions, public_profile, manage_pages, read_insights, user_managed_groups I got the access token and then exc

Post to Facebook group using FB GRAPH API

koi I'm having trouble posting to a Facebook group using the FB API. So I have authenticated the user with permissions: email, publish_pages, publish_actions, public_profile, manage_pages, read_insights, user_managed_groups I got the access token and then exc

Post to Facebook group using FB GRAPH API

koi I'm having trouble posting to a Facebook group using the FB API. So I have authenticated the user with permissions: email, publish_pages, publish_actions, public_profile, manage_pages, read_insights, user_managed_groups I got the access token and then exc

Post to Facebook group using Graph API and Python

username I've been looking for documentation on how to post messages to a group wall on Facebook using Python and the Facebook API to no avail, or the documentation isn't clear on what permissions I need to set. what should I do? Here is my current code. from

Post to Facebook Wall using Graph API

Adeltahir I'm trying to post text with an image to a Facebook wall using the graph API. I am using the following code snippet for this. var body = { message : 'this is a test message', image : 'http://someurltoimage.png' }; FB.api( "/me

Post a photo on a Facebook group using the Graph API

Mahendra Ria I am developing an android application for a facebook group. Using the graph API, I can easily post the text status, but when I upload a photo, it returns an error saying (#100) The picture is not properly formatted If I use the same code to post

Post a photo on a Facebook group using the Graph API

Mahendra Ria I am developing an android application for a facebook group. Using the graph API, I can easily post the text status, but when I upload a photo, it returns an error saying (#100) The picture is not properly formatted If I use the same code to post

Post to Facebook group using FB GRAPH API

koi I'm having trouble posting to a Facebook group using the FB API. So I have authenticated the user with permissions: email, publish_pages, publish_actions, public_profile, manage_pages, read_insights, user_managed_groups I got the access token and then exc

Post to Facebook group using FB GRAPH API

koi I'm having trouble posting to a Facebook group using the FB API. So I have authenticated the user with permissions: email, publish_pages, publish_actions, public_profile, manage_pages, read_insights, user_managed_groups I got the access token and then exc

Post to Facebook Wall using Graph API

Adeltahir I'm trying to post text with an image to a Facebook wall using the graph API. I am using the following code snippet for this. var body = { message : 'this is a test message', image : 'http://someurltoimage.png' }; FB.api( "/me

Post a photo on a Facebook group using the Graph API

Mahendra Ria I am developing an android application for a facebook group. Using the graph API, I can easily post the text status, but when I upload a photo, it returns an error saying (#100) The picture is not properly formatted If I use the same code to post

Facebook Graph API - How to read the privacy of a post

Nguyen Minh Binh I read the example from the Graph API documentation at: https://developers.facebook.com/docs/graph-api/reference/privacy/ and tried to get the privacy of the specified post with no luck. The links I tried are: https://graph.facebook.com/me/?fi