Graph API 版本

對話串 /{thread-id}

Facebook Messages 對話的對話串。此端點僅供作出要求的應用程式之開發人員用戶使用。

專頁應使用對話端點

讀取

獲取訊息對話串。

權限

範例

Graph 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
}];

欄位

名稱 描述 類型

id

此訊息對話串的不重複編號。

string

comments

此對話串中的訊息。

Message[]

to

訂閱對話串的個人檔案。

Profile[]

unread

連線階段個人檔案的未讀訊息數量。

integer

unseen

連線階段個人檔案未看到的訊息數量。

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>"

發佈

您無法在此端點上執行此操作。

刪除

您無法在此端點上執行此操作。

更新

您無法在此端點上執行此操作。