Facebook AppRequests not showing?
I'm 开发者_开发百科using the Facebook php-sdk and the batch request API to send AppRequests with the following code:
$facebook = new Facebook(array(
'appId' => $FB_APP_ID,
'secret' => $FB_APP_SECRET,
'cookie' => true
));
// get app token before it's overwritten
$FB_APP_TOKEN = $facebook->getAccessToken();
$res = $facebook->api('<USER ID>/apprequests', 'POST', array(
'message' => 'Test message..'
), $FB_APP_TOKEN);
This appears to work and returns the ID of the request, which I can then see has been stored when looking back with the graph explorer. My problem is that nothing appears on my test user's facebook account, no notification and no number appears next to the app name in the sidebar as described here.
Does anyone have any idea why this might be?
getAccessToken() sometimes don't return user access token. It only returns facebook application key. Use the following code to get the access token.
$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);
Turns out I was looking at the App's page instead of the App itself, app requests are working fine!
精彩评论