图谱 API 版

对话 /{conversation-id}

用户和 Facebook 公共主页或 Instagram 专业帐户间的 Messenger 对话。

读取

图谱 API 探索工具
GET /v19.0/{conversation-id} 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}',
    '{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}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{conversation-id}",
    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}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

权限

对于 Instagram 消息,您还需要:

限制

  • 查询此端点获取 Instagram 消息时,系统将返回此对话的所有消息。但是,您只能查询对话中最近 20 条消息的数据。如果某条消息不在最近 20 条之列,系统将会返回一个错误,指明该消息已被删除。

字段

名称 描述

id

字符串

对话编号

messages

字符串

对话中的消息

participants

对象

id


email

仅限公共主页消息

name

仅限公共主页消息

username

仅限 Instagram 消息

对话中的互动者


某位用户的 Instagram 范围编号或公共主页范围编号,或者 Instagram 专业帐户的 Instagram 编号或公共主页编号。

用户或公共主页的邮箱


用户或公共主页的名称


用户或 Instagram 专业帐户的 Instagram 帐号

updated_time

日期时间

对话中最后一条消息的出现时间

如需获取有关对话中某条具体消息的信息,请向消息端点发送请求。

发布

您无法使用此连线发布。

可以使用 Messenger 开放平台发送模板快速回复等内容。

删除

您无法使用此连线进行删除。

更新

您无法使用此连线进行更新。

连线

名称 描述 用于发布

/messages

对话中全部消息的列表

回复(仅限公共主页)