4
votes

I would like to post a photo to the Timeline of a Facebook Page via Graph API. My setup is node-based and written in coffeescript. My current implementation is this (error handling ommited):

sendImageToFacebookTimeline = (user, message, imageURL, callback)->
  url     = "https://graph.facebook.com/#{pageID}/photos"
  params  =
    access_token: user.accessToken
    url: imageURL
    message: message

  request.post({url: url, qs: params}, (err, res, body)->
    body = JSON.parse(body)
    callback(body.id)
  )

This succesfully posts the photo to my Page. But instead of appearing on the timeline it appears in the "Photos of PAGE".

How can I post to the Timeline?

EDIT: I found out that by posting to /page_id/feed with option "picture" you can send a photo to Timeline. This shows up the same way as og:image and the view is similar to a link.

EDIT 2: If you upload to a album, it will show up on Timeline. I have created an album and trying to post to it. But the API doesn't seem to accept URL for source when posting to /album_id/photos.

1
So the solution is to post into a album instead? It's showing "Posted 3 Image" etc , I want every single one to displayCodeGuru
When I last tested this (22.8.2013) the photos were shown on the timeline even if posted to an album. Please elaborate your situation if this doesn't satisfy your appetite for knowledge.Sampsa

1 Answers

2
votes

To post to own Timeline you need to acquire Page access token from /me/accounts and not by getting a user token or exchanging token for a long term token.

With that and album ID you can post to an album, which shows up on the Timeline.