เวอร์ชันของ API กราฟ

ข้อมูลอ้างอิงเกี่ยวกับ API กราฟ /{conversation-id}/messages

ข้อความในการสนทนาระหว่างผู้ใช้กับเพจ Facebook หรือบัญชีมืออาชีพบน Instagram

การอ่าน

Graph API Explorer
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 บนเพจได้
  • สิทธิ์การอนุญาต pages_messaging
  • สำหรับการส่งข้อความบน Instagram Messaging คุณจะต้องใช้สิทธิ์การอนุญาต instagram_manage_messages ด้วยเช่นกัน

ช่อง

ส่งคืนอาร์เรย์ของอ็อบเจ็กต์ข้อความที่มีช่องเพิ่มเติมดังนี้

ชื่อ คำอธิบาย ประเภท

เวกเตอร์

เวกเตอร์

ส่งข้อความ

คุณไม่สามารถส่งข้อความไปยังตำแหน่งข้อมูลนี้ได้ ให้ใช้ Send API แทน

ลบ

คุณไม่สามารถลบตำแหน่งข้อมูลนี้ได้