I am trying to create an html object dynamically with the necessary header information depending on the query string in the link I provide to Facebook. I am hoping that Facebook open graph will call this html link as I provided. However it seems that query string info are not getting passed to my server. Do anyone know how to make this work or what is the more appropriate way to do this. BTW, I am writing my code in Node.js.

To get more info about Facebook open graph api, look here, https://developers.facebook.com/docs/beta/opengraph/actions/.

For example, the link I am trying to pass to Facebook is, "http://xxx-url.com/getFacebookObject?objectId=&description=first dynamic post", so I sent a request with the link as, "https://graph.facebook.com/me/app-name:action-name?object=http://xxx-url.com/getFacebookObject?objectId=&description=first dynamic post". However, when I check the log on the server, I don't see anything in the query string.

2

There are 2 best solutions below

1
On BEST ANSWER

Instead of using the query string, you can embed the data in the URL:

http://some-domain.com/getFacebookObject/id/description

Then, depending on what node.js packages you're using, extract the data from the request:

// expess.js style
app.get("/getFacebookObject/:id/:description", function(req, res) {
  var id = req.params.id,
    desc = req.params.description;
  // your code...
});

(See http://expressjs.com/guide.html.)

0
On

Sorry, Facebook will strip off all query string information from the URL when they launch your site in the iframe. If it was a page tab app, then you could add it to the app_data query string parameters which in turn gets passed to your iframe's page tab app via the app_data part of the signed_request parameter.