Graph API 版本

對話 /{conversation-id}

用戶與 Facebook 專頁或 Instagram 專業帳戶之間的 Messenger 對話。

讀取

Graph 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

datetime

最近一則訊息加入對話的時間

若要取得對話內特定訊息的資料,請向訊息端點傳送要求。

發佈

您無法使用此關係連線發佈內容。

使用 Messenger 平台傳送範本快速回覆等內容。

刪除

您無法使用此關係連線刪除內容。

更新

您無法使用此關係連線作出更新。

關係連線

名稱 說明 用於發佈

/messages

對話中全部訊息的清單

回覆(僅限專頁)