当我尝试通过api发送消息时,我对打开的图形api有一些问题。
这是我的代码:
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/' . $conversation_id . '/messages',
array(
'message' => $this->source['message'],
),
$token_page
);
$this->loadModel("PageAccount");
$currentPage = $this->PageAccount->findById($this->source['page_id']);
$token = $this->source['token'];
$data = file_get_contents("https://graph.facebook.com/v2.9/" . $this->source['conversation_id'] . "?access_token=$token&fields=messages.limit(200){message,created_time,to,from}");
$data = json_decode($data, 1);
$view = new View($this, false);
$element = $view->element("admin/conversations/all-conversation", array("conversation" => $data));
return $this->getSuccessResult(array("conversation" => $element));
} catch (Facebook\Exceptions\FacebookResponseException $e) {
return $this->getErrorResult("Une erreur est survenue");
}
Facebook发给我的错误: (#230)权限禁止向用户发送消息
感谢您的帮助:)