0

I am trying to implement multiple Facebook share buttons in one page to share different pieces of content.

I was looking at this page: https://developers.facebook.com/docs/reference/dialogs/feed/

And tried to implement the Direct URL exactly as listed in the example:

https://www.facebook.com/dialog/feed?
app_id=123050457758183&
link=https://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=http://www.example.com/response

However, if you click on the link above and click share, you get an error message. How can I prevent the error message from happening and actually post the story to the feed when clicked shared?

Am I supposed to activate something else on my page? I want to make sure I can share different pieces of contents.

Any insight would be GREATLY appreciated :D.

Ori
  • 259
  • 2
  • 8
  • 27

1 Answers1

1

To make the example work with your values you will need to set up a facebook application with the https://developers.facebook.com/apps page. It's important to set the domain and the site url of the application at the basic settings page since facebook validates the redirect_uri paremter of the feed dialog against those.

Armed with the application's id, you can change the example's app_id and redirect_uri parameters and it should work.

Edit:

Since you are trying to use these on a facebook tab, take a look into facebooks javascript sdk. The FB.ui method makes these sharing interface more pleasant to use.

Community
  • 1
  • 1
complex857
  • 20,425
  • 6
  • 51
  • 54
  • Hi @complex857 Thank you so much for your quick and helpful response. I set up an app and inserted the proper ID. However, what is the redirect_uri supposed to be? IS that the "Page Tab URL" that I inserted in the basic app setting on Facebook? When I try to do that I get the share dialogue perfectly, but when I click share I see a 404 not found error and Facebook appends the following url to my tab's url: index.html?post_id=APP_ID#_=_ – Ori Aug 03 '12 at 19:40
  • The `redirect_uri` should be something under one of the app domains, if you don't want to do anything with the result. you can use the url you placed the link on. The Page Tab URL is for tab canvases (and should be an absolute url ending with /). [More on canvases](https://developers.facebook.com/docs/guides/canvas/). If you simply have a website with these links you don't need canvas pages. – complex857 Aug 03 '12 at 19:45
  • Hey again! Not sure I understand completely. I know how to set up Facebook tabs - so my website, let's say www.example.com/index.html is going to be where I host the tab. Under the page tab settings I put http://www.example.com/index.html for the page tab url and for the secure tab url (with https). However, completely separate from Facebook - I'm just trying to activate my share dialogue properly with the DIRECT URL. Are you saying that I need to insert something in App Domains to make it work? What would that be exactly? www.example.com ? THANKS and sorry for my confusion! – Ori Aug 03 '12 at 19:49
  • With the direct url, you will have to make the `redirect_uri` to www.example.com/redrop.html where you can redirect the user again back under `http://facebook.com/...`. But since you are on a tab look into the [JS SDK's FB.ui](http://developers.facebook.com/docs/reference/javascript/FB.ui/) method. – complex857 Aug 03 '12 at 19:52
  • THANK YOU. I want to have multiple shares though on the page.. so can I use the JS SDK's FB.ui method to share multiple pieces of content? – Ori Aug 03 '12 at 19:54
  • Yes, you can fire these (preferably on user clicks) in any number you want, with whatever data you have. – complex857 Aug 03 '12 at 19:56
  • THANK YOU SO MUCH for your helpful insight! Really appreciate your patience. Was able to figure this out. Have a great weekend and thanks again. – Ori Aug 03 '12 at 21:15