如何邀请用户好友参加活动? Facebook 图形 API

发布于 2024-09-11 07:17:11 字数 205 浏览 3 评论 0原文

我有一个使用 Graph API 的应用程序。我让它为用户创建活动,但想让用户从我们的网站邀请他们的朋友,而不必访问活动 Facebook 页面。有谁知道我也必须发送朋友的 ID 才能像旧 API 一样邀请他们吗?或者它是否存在?我发现 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

辞旧 2024-09-18 07:17:11

事实上,我从 Facebook 团队得到了答案,他们只是告诉我通过新的 PHP 接口使用旧的 API。他们尚未转换此功能,也不知道是否会转换。

编辑:

这是我从新 api ($id_array) 获取 ID 后用来邀请朋友的代码。这应用于 PHP Facebook 对象的包装器中,我用来保存所有 Facebook 特定代码。

    $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,
    ));

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,
    ));
留一抹残留的笑 2024-09-18 07:17:11

这实际上可以通过 Graph API 实现,特别是事件对象的invited连接:

POST /EVENT_ID/invited/USER_ID

邀请用户参加事件。如果请求成功,则返回 true

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

邀请多个用户参加活动。如果请求成功,则返回 true

您需要 create_event 权限。更多信息请参阅这篇文章

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.

稚然 2024-09-18 07:17:11

邀请用户参加活动的可能性已在 v2.4 中删除图API

事件节点不再支持端点上的 GET 操作
/v2.4/{event_id}/invited、/v2.4/{event_id}/likes,或
/v2.4/{event_id}/sharedposts。

无法再邀请用户参加活动,您必须使用 facebook.com。

The possibility to invite users to an Event was removed in v2.4 of the Graph API:

The Event node no longer supports GET operations on the endpoints
/v2.4/{event_id}/invited, /v2.4/{event_id}/likes, or
/v2.4/{event_id}/sharedposts.

There is no way to invite users to an Event anymore, you have to use facebook.com instead.

画离情绘悲伤 2024-09-18 07:17:11

请参阅邀请选定用户参加 Facebook 活动(通过 Graph API)

Facebook 现在有一个用于邀请朋友参加活动的图表 API。

http://developers.facebook.com/docs/reference/api/event/< /a>

Invited

创建

您可以通过向 /EVENT_ID/invited/USER_ID 发出 HTTP POST 来邀请用户参加活动。您可以通过向 /EVENT_ID/invited?users=USER_ID1,USER_ID2,USER_ID3 发出 HTTP POST 来邀请多个用户。这两个都需要 create_event 权限,如果邀请成功则返回 true。

您的附带问题的答案在这里: 将图像附加到 Facebook 事件(php sdk、rest 或 graph api)

see Inviting selected users to Facebook-Event (via Graph API)

Facebook now has a graph api for inviting friends to events.

http://developers.facebook.com/docs/reference/api/event/

invited

Create

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.

And the answer to your side question is here: Attach image to Facebook event (php sdk, rest or graph api)

绿光 2024-09-18 07:17:11

您还可以使用 javascript sdk:

var inviteCallback = function(result) {
    console.log(result);
};
var event_intives = {
    method: 'events.invite',
    eid: event_id,
    uids: friends_list_array,
    personal_message: 'custom request message'
};
FB.api(event_intives, inviteCallback);

如果一切正常,它应该记录“true”

you can also use javascript sdk:

var inviteCallback = function(result) {
    console.log(result);
};
var event_intives = {
    method: 'events.invite',
    eid: event_id,
    uids: friends_list_array,
    personal_message: 'custom request message'
};
FB.api(event_intives, inviteCallback);

if all ok, it should log 'true'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文