Facebook’s documentation always sucks. There are many examples of working with facebooks dialog feed, but none of them include passing urls that have params. They are all simple examples like share ‘http://example.com’, well if you want to share ‘http://example.com?foo=bar&buzz=baz’ you are kind of out of luck. It took me far longer than I care to admite to figure out the right way to get facebook to share a link that included params. I was using ruby and rails, creating a link with _url and params, and then trying to encode it and send it to facebook. Below is what ended up working. Note that it seems to be a bit of an odd encoding, but it allows one to send urls with params and encoded ‘?’ and ‘&’ properly through facebook and have the share url include the params your expecting. facebook_shared\_url = action\_url({:foo => 'bar', :buzz => 'baz'})facebook\_url = "https://www.facebook.com/dialog/feed?app_id=#{FACEBOOK_CLIENT_ID}&redirect_uri=#{URI.encode(facebook_shared\_url).gsub('&','%26')}&description=#{text}&name=#{via}&link=#{URI.encode(facebook_shared\_url).gsub('&','%26')}"



blog comments powered by Disqus
Dan Mayer Profile Pic
Welcome to Dan Mayer's development blog. I primary write about Ruby development, distributed teams, and dev/PM process. The archives go back to my first CS classes during college when I was first learning programming. I contribute to a few OSS projects and often work on my own projects, You can find my code on github.

Twitter @danmayer

Github @danmayer