发送“应用程序请求" Graph API发送给多个收件人 [英] Sending "App Requests" to multiple recipients using Graph API

查看:64
本文介绍了发送“应用程序请求" Graph API发送给多个收件人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook的新 Frictionless Requests ,它允许您使用FB中的"to"属性将用户生成的请求发送给多个预先选择的朋友.ui()方法:

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

我想知道如何在一个API调用中类似地向多个收件人发送应用程序生成的请求. Facebook文档显示了以下示例,用于通过Graph API将应用程序生成的请求发送给单个收件人:

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);
?>

但是,是否可以通过图形API将应用程序生成的请求发送给多个收件人?

However, Is there a way to send an app-generated request to multiple recipients via graph api?

我知道我要实现的目标可以通过批处理来完成,但是我想知道是否存在一种更实用的方法来将应用程序生成的请求发送给多个收件人,这与FB.ui({ 'method','apprequests',...})有效吗?

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?

推荐答案

您可以使用ids查询参数

You can use the ids query parameter

例如ids = userid1,userid2

eg. ids=userid1,userid2

$apprequest_url ="https://graph.facebook.com/" .
        "/apprequests?ids=USERID_1,USERID_2,USERID_3" .
        "&message='INSERT_UT8_STRING_MSG'" . 
        "&data='INSERT_STRING_DATA'&"  .   
        $app_access_token . "&method=post";

这篇关于发送“应用程序请求" Graph API发送给多个收件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆