运行以下代码后,我尝试从我的应用程序向多个应用程序用户发送批处理通知,但响应中出现错误:
"{"error":{"message":"(#100) Must specify a non-empty template `param","type":"OAuthException","code":100}}"`
虽然设置了模板参数...
感谢任何关于我做错了什么的帮助..
这是我使用的代码:
$batched_request = array();
foreach ($users as $idx => $user) {
$request = array(
'method' => 'POST',
'relative_url' => '/' . $user['id'].'/notifications',
'access_token' => $app_access_token,
'template' => $template,
'href' => $href
);
$batched_request[] = json_encode($request);
}
$params = array('batch' => '[' . implode(',',$batched_request) . ']' );
try {
$response = $facebook->api('/','POST',$params);
} catch(FacebookApiException $e) {
error_log($e);
}