发送“应用程序请求”使用 Graph API 发送给多个收件人
我正在使用 Facebook 的新无摩擦请求,它允许您使用 FB.ui 中的“to”属性将用户生成的请求发送给多个预先选择的朋友( ) 方法:
Fb.ui({
method: 'apprequests',
message: '...',
to: 'uid1,uid2,uid3,...'
}, cb);
我想知道如何在单个 API 调用中类似地向多个收件人发送应用程序生成的请求。 Facebook 文档显示了以下通过 Graph API 向单个收件人发送应用程序生成的请求的示例:
<?php
$app_id = YOUR_APP_ID;
$app_secret = YOUR_APP_SECRET;
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $app_id .
"&client_secret=" . $app_secret .
"&grant_type=client_credentials";
$app_access_token = file_get_contents($token_url);
$user_id = THE_CURRENT_USER_ID;
$apprequest_url ="https://graph.facebook.com/" .
$user_id .
"/apprequests?message='INSERT_UT8_STRING_MSG'" .
"&data='INSERT_STRING_DATA'&" .
$app_access_token . "&method=post";
$result = file_get_contents($apprequest_url);
echo("App Request sent?", $result);
?>
但是,有没有办法通过 Graph API 向多个收件人发送应用程序生成的请求?
我知道我想要实现的目标可以通过批处理来完成,但我想知道是否有更实用的方法将应用程序生成的请求发送给多个收件人,相当于 FB.ui({'method' , 'apprequests',...}) 有效吗?
I'm using Facebook's new Frictionless Requests, which allow you to send user-generated request to multiple pre-selected friends using the 'to' property in the FB.ui() method:
Fb.ui({
method: 'apprequests',
message: '...',
to: 'uid1,uid2,uid3,...'
}, cb);
I'm wondering how I can similarly send an app-generated request to multiple recipients in a single API call. The Facebook Doc shows the following example for sending an app-generated request to a single recipient via Graph API:
<?php
$app_id = YOUR_APP_ID;
$app_secret = YOUR_APP_SECRET;
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $app_id .
"&client_secret=" . $app_secret .
"&grant_type=client_credentials";
$app_access_token = file_get_contents($token_url);
$user_id = THE_CURRENT_USER_ID;
$apprequest_url ="https://graph.facebook.com/" .
$user_id .
"/apprequests?message='INSERT_UT8_STRING_MSG'" .
"&data='INSERT_STRING_DATA'&" .
$app_access_token . "&method=post";
$result = file_get_contents($apprequest_url);
echo("App Request sent?", $result);
?>
However, Is there a way to send an app-generated request to multiple recipients via graph api?
I understand that what I'm trying to achieve can be done through batching, but I would like to know if there's a more practical way for sending an app-generated request to multiple recipients, equivalent to how FB.ui({'method', 'apprequests',...}) works?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 ids 查询参数,
例如。 ids=用户ID1,用户ID2
You can use the ids query parameter
eg. ids=userid1,userid2