How to get Request IDs from Facebook Batch Request using PHP

416 Views Asked by At

To avoid overloading the API requests I am using Facebook Batch API to send app-to-user requests:

$access_token = MYAPPSACCESSTOKEN;

foreach($myusers as $user) {
    $body = array(
        'access_token' => $access_token,
        'template' => 'THIS IS MY TEMPLATE',
        'href' => '?time=' . date('d-m-Y'),
        'ref' => 'MY_REF'
    );
}

$results = $facebook->api('/?batch=' . \urlencode(\json_encode($fBqueries)), 'POST', array(
    'access_token' => $facebook->getAccessToken()
));

So this is working as expected, but I also need to record the RequestID for each app-to-user request. $results is returning header data for each request, but is there any way that I can get the Facebook Request ID as well?

1

There are 1 best solutions below

2
On

Just realised that I have been using the new notifications API and not the apprequests endpoint which indeed does return a request ID (as it is a request object).

I guess that at the moment the notifications API doesn't return any notification / request IDs which would have been very helpful for our app but never mind.