Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to invite a users friends to an event? Facebook Graph API

I have an application using the Graph API. I have it creating events for the user, but would like to let the user invite their friends from our site instead of having to go to the events Facebook page. Does anyone know of the request I have to send the friends' IDs too to invite them like with the old API? Or if it even exists? I am finding a lot of the finer details in the API documentation are vague. Thank you!

Also, side question, can you send an event photo with the create POST? I see no mention on how to submit a photo with the event creation. Thanks.

like image 494
gokujou Avatar asked Jul 27 '10 18:07

gokujou


People also ask

How do you bulk invite people to an event on Facebook?

Tap in the top right of Facebook, then tap Groups and select your group. Tap Events, then tap to select the event. Tap Invite, then select the people you want to invite.

How do I invite people to an event on Facebook that I am not friends with?

Enter the email addresses of guests with whom you are not Facebook friends in the "Invite by E-Mail Address" field just below your list of friends. Separate each email address by a comma.

How do I share a Facebook post on a graph API?

Yes, you can share using the graph2 api. The way you do it is to use /feed edge and pass the post's url that you want to share as the link. Standard Fb permissions to the post you are sharing do apply. This was done today, in a local rails app, using FbGraph2 gem, with the above method.

What can I do with Facebook Graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.


2 Answers

I actually was able to get an answer from the Facebook team and they just told me to use the old API through the new PHP interface. They have yet to convert this functionality and don't know if it will be converted.

Edit:

Here is the code I used to invite friends after I got the IDs from the new api ($id_array). This is applied in a wrapper around the PHP Facebook object I used to hold all my Facebook specific code.

    $fb = new FacebookGraph(array(
        'appId' => 'xxxx',
        'secret' => 'xxxx',
        'cookie' => true,
    ));
    $fb->api(array(
        'method' => 'events.invite',
        'eid' => $event_id,
        'uids' => $id_array,
        'personal_message' => $message,
    ));
like image 54
gokujou Avatar answered Oct 05 '22 23:10

gokujou


This is actually possible with the Graph API, specifically the invited connection of the event's object:

POST /EVENT_ID/invited/USER_ID

Invite a user to an event. Returns true if the request is successful.

POST /EVENT_ID/invited?users=USER_ID1,USER_ID2,USER_ID3

Invite multiple users to an event. Returns true if the request is successful.

You'll need the create_event permission. More info is available in this post.

like image 42
ifaour Avatar answered Oct 06 '22 00:10

ifaour