图谱 API 版

对话 /{thread-id}

Facebook Messages 对话线程。

公共主页应使用对话端点

读取

获取消息对话。

权限

示例

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

Fields

名称 说明 类型

id

消息线程的唯一编号。

string

comments

此对话中的消息。

Message[]

to

订阅此对话的个人主页。

Profile[]

unread

The amount of messages that are unread by the session profile.

integer

unseen

The amount of messages that are unseen by the session profile.

integer

updated_time

对话上次更新时间。

datetime

can_reply

公共主页可在对话中进行回复。

boolean

linked_group

对话已链接的 Workplace 小组编号(仅 Workplace)

string

连线

名称 说明

messages

对话中的个人消息列表。

筛选消息

可对 messages 连接进行筛选,以避免 Messenger 应用拉取对话警告中的文本。通过仅可选择参与者的 source 筛选条件完成此操作。

如果此筛选条件不适用,也将检索管理员文本(Messenger 会将灰色文本显示在对话中)。

示例

此调用将检索仅参与者发出的最后 3 条消息。

curl -i -X GET \
 "https://graph.facebook.com/v4.0/t_10155839492600149?fields=id,messages.source(PARTICIPANTS).limit(3)&access_token=<Access Token>"

发布

您无法在此端点上执行此操作。

Deleting

您无法在此端点上执行此操作。

更新

您无法在此端点上执行此操作。