4

I can't seem to get the picture of the event, and it also gives me a fatal error trying to connect to the event image.
Can I share an (already created) event (not create one, just link to it - with a picture and description) and post it to my wall?

He is what I already have:

$facebook->api('/me/feed', 'post', array(
          'message' => 'event test',
          'link' => 'https://www.facebook.com/events/event id/',
          'picture' => 'https://www.facebook.com/events/event id/',//produces an error
          'name' => 'event test',
          'caption' => '',
          'description' => 'event desc',
    ));
funerr
  • 7,212
  • 14
  • 81
  • 129
  • @phwd, currently the error says that I can't grab the image from facebook's servers. But I want to know how to share an event I have already created to my wall. – funerr May 24 '12 at 21:04

3 Answers3

2

This:

$facebook->api('/me/feed', 'post', array(
   'link' => 'https://www.facebook.com/events/event id/'
));

doesn't work? All of the other info should be available for facebook.


Edit

I have no idea why simply sharing the event does not work. Even when supplying the info, the image can not be loaded (as you wrote) with a message saying the pics served from the fb CDNs can't be shared.

I have two possible workarounds for you though:

1) You can ask for the event info using the api and then publish that, for example with the js sdk:

FB.api("EVENT_ID", function(response) {
    FB.ui({
        method: "feed",
        link: "http://www.facebook.com/events/EVENT_ID/",
        name: response.name,
        description: response.description
    });
});

As for the image, since you are doing it on your servers then you can download the image (https://graph.facebook.com/EVENT_ID/picture?type=large), store it on your server and then add it to the post.

2) According to the Invited connection of the Event object:

You can invite users to an event by issuing an HTTP POST to /EVENT_ID/invited/USER_ID. You can invite multiple users by issuing an HTTP POST to /EVENT_ID/invited?users=USER_ID1,USER_ID2,USER_ID3. Both of these require the create_event permission and return true if the invite is successful.

So with that you can invite the friends to the event directly.
I know it's not the same, but it might be better than nothing, depending on what you need this for.


I recommend that you open a bug report on the Bugs system.

Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
2

Try using /me/links connection instead with link as the Facebook event link and message as the description you want to add

A link shared

on the ticker

And here it is compared with the built-in share

Comparing the two, shows the same presentation

For more info on /links see http://developers.facebook.com/docs/reference/api/user/#links

phwd
  • 19,975
  • 5
  • 50
  • 78
  • I get an error although I've added the publish steam. Fatal error: Uncaught OAuthException: (#240) Requires a valid user is specified (either via the session or via the API parameter for specifying the user. (code : $facebook->api('/my_friend_id/links', 'post', array( 'link' => 'https://www.facebook.com/events/eventid/' )); – funerr May 24 '12 at 21:47
  • @agam360 You *originally* said *your wall*. – phwd May 24 '12 at 22:48
  • @agam360 on further inspection this doesn't seem to be intended behaviour as docs actually reference me/feed and not me/links – phwd May 24 '12 at 22:49
2

FYI /me/links has a known bug with a few of the parameters it supposedly accepts. Afaik, FB still havent fixed it despite being originally reported last year, and then again in Jan this year. Although the bug report is orientated to Page posts it might be related to the issue you are facing:

Bug link

I'm trying to do a similar thing as you and it's been a royal PITA from the outset, and I still haven't managed it after much effort. Good luck!

Snouto
  • 1,039
  • 1
  • 7
  • 21
  • My thoughts turned to using `//feed`, but let me tell you now that it isn't straight forward as it should be either. I haven't gotten it to work properly yet, despite many tries, so have contacted FB for assistance. I'll come back to you if I hear anything worthwhile back from them – Snouto May 28 '12 at 10:41
  • Thanks, i'll vote when I've got something working (plus, how can I get the event's picture and send it through the /feed/). – funerr May 28 '12 at 10:59
  • I'm pretty sure you'll need to use a non-Facebook URL for the 'picture' parameter of the feed call. Out of interest have you experimented with a non-Facebook URL as the picture parameter in your original code? – Snouto May 28 '12 at 11:15