图谱 API 版

图谱 API 参考资料 /{conversation-id}/messages

用户和 Facebook 公共主页或 Instagram 专业帐户之间对话中的消息。

读取

图谱 API 探索工具
GET /v19.0/{conversation-id}/messages HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{conversation-id}/messages',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{conversation-id}/messages",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{conversation-id}/messages",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{conversation-id}/messages"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

权限

  • 由可以在公共主页上执行 MESSAGING 任务的用户请求的公共主页访问口令
  • 对于 Instagram 消息功能,还需要具备 instagram_manage_messages 权限

字段

返回一个包含更多字段的消息对象数组:

名称 描述 类型

Vector

向量

发送消息

您无法向此端点发送消息。请改为使用 Send API

删除

您无法删除此端点。