views:

427

answers:

2

I'm building a music events website and want to have a 'share this event' button which publishes the event details on facebook.

this tool looks like exactly what i want: http://developers.facebook.com/tools.php?connect_wizard&wizard=stream_publish

however, if i copy the code snippet to new file on my site, it doesn't work.

I'm assuming there's a few lines of extra php/js i need somewhere?

so far i have

<body>      
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script src="http://static.ak.connect.facebook.com/connect.php/en_GB" type="text/javascript"></script>
<script type="text/javascript">FB.init("89bb37189bede9e30eb07a66b9a1c52a");</script>
<script type="text/javascript">
    function callPublish(msg, attachment, action_link) {
      FB.ensureInit(function () {
        FB.Connect.streamPublish('', attachment, action_link);
      });
    }
</script>

+4  A: 

The large hash value in the call to FB.init() has to be your API key. Set one up and you should be good to go.

Peter Bailey
so i need to make a facebook application to publish to fb?
Haroldo
You don't have to make an app, but do you go through that system to generate an API key.
Peter Bailey
awesome thanks peter - worked a treat!
Haroldo
ps. don't suppose you know a good method publish method like this for twitter do you?!!
Haroldo
I don't, no. I'm sure there are plenty of people here on SO that have experience with the Twitter API, though.
Peter Bailey
A: 

I think the share widget is the simplest route to take: http://www.facebook.com/facebook-widgets/share.php. You can also use meta tags to help specify what's in the content of the share.

Karl B