Facebook 应用程序如何向用户的所有好友发送消息?

发布于 2024-10-22 03:20:02 字数 1146 浏览 1 评论 0原文

我们正在尝试构建一个应用程序,该应用程序可以根据登录用户的请求并在应用程序中进行适当的祝福,向任何或所有用户的 FB 好友发送一条消息,声明他们已收到一份礼物。

我们已经能够以墙贴的形式向少数朋友发送此消息(通知和消息在 API 中不可用)。但是,如果好友数量超过 15 人,大多数用户都会返回 OAuthException:(#200) 用户尚未授权应用程序执行此操作

可以单独或以小组形式向这些相同的用户发送消息。但是,我们希望拥有数百甚至数千朋友的用户可以使用此功能。

API 文档尚未发布,特别是因为它们卡在新旧 Graph 接口之间。我们目前正在使用以下代码(概要)在当前 Facebook 会话中使用我们用户的凭据发出 API 请求:

$wall_info = $customer->getCustomWallData();

$attachment = array(
    'message' => $wall_info['msg'],
    'name' => $wall_info['link_title'],
    'caption' => $wall_info['link_caption'],
    'link' => $CUZ->index,
    'description' => '',
    'picture' => $CUZ->http . '/uploads/promo_logo/' . $wall_info['filename'],
    'actions' => array(
        array('name' => 'Get Search', 'link' => 'http://www.google.com')
    )
);

foreach($friendStack as $friend_data) {
    $friend_fb_id = $friend_data['fb_id'];
    $result = $facebook->api("/$friend_fb_id/feed/",'post',$attachment);
}

这里有人知道吗:

  1. 为什么会发生这种情况
  2. 是否有任何方法绕过它向所有用户发布
  3. 如果是这样,这会是什么?

谢谢。

We're trying to construct an application that can - at the request of logged-in users with the appropriate blessings within the app - send out a message to any or all of the user's FB friends declaring that they have been sent a gift.

We have been able to get this to work for sending just a small few friends this message, as a wall post (notifications and messages are unavailable in the API). However, with any number of friends larger than ~15, the majority of the users return an OAuthException: (#200) The user hasn't authorized the application to perform this action.

These same users can be sent the message individually or in a small group. However, we expect to have this feature used by users with hundreds or even thousands of friends.

The API docs have not been forthcoming, especially since they are stuck halfway between the old and new Graph interfaces. We are currently using the following code (in precis) to make the API requests, in PHP, in the presence of a current Facebook session with the credentials of our user:

$wall_info = $customer->getCustomWallData();

$attachment = array(
    'message' => $wall_info['msg'],
    'name' => $wall_info['link_title'],
    'caption' => $wall_info['link_caption'],
    'link' => $CUZ->index,
    'description' => '',
    'picture' => $CUZ->http . '/uploads/promo_logo/' . $wall_info['filename'],
    'actions' => array(
        array('name' => 'Get Search', 'link' => 'http://www.google.com')
    )
);

foreach($friendStack as $friend_data) {
    $friend_fb_id = $friend_data['fb_id'];
    $result = $facebook->api("/$friend_fb_id/feed/",'post',$attachment);
}

Does anyone here know:

  1. Why this is happening
  2. Whether there is any way to get around it to post to all the users
  3. If so, what this would be?

Thank you.

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

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

发布评论

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

评论(2

薄荷梦 2024-10-29 03:20:02

Facebook 阻止“垃圾邮件”消息。您不能批量发送超过 15 或 20 个朋友的消息。

Facebook blocks "spam" messaging. You cannot do bulk messages greater than 15 or 20 friends.

新一帅帅 2024-10-29 03:20:02

嗯,我不认为 Facebook 会将发送给超过 15 个成员的消息视为垃圾消息并阻止它。

有些应用程序只需单击一下即可通过用户的聊天、每个朋友和用户加入的每个群组的墙贴来宣传自己!

Well, I don't think that Facebook considers a message sent to more than 15 members as a spam message and blocks it.

There are certain applications which on single click promote themselves through a user's chat, wall post on every friend and each group joined by the user!

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