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

การสนทนา /{thread-id}

การสนทนาทางข้อความบน Facebook ตำแหน่งข้อมูลนี้สามารถเข้าถึงได้เฉพาะผู้ใช้ที่เป็นผู้พัฒนาแอพที่ส่งคำขอเท่านั้น

เพจควรใช้ตำแหน่งข้อมูลการสนทนา

การอ่าน

รับการสนทนาทางข้อความ

สิทธิ์การอนุญาต

ตัวอย่าง

Graph API Explorer
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

ID ที่ไม่ซ้ำกันสำหรับการสนทนาทางข้อความนี้

string

comments

ข้อความในการสนทนานี้

Message[]

to

โปรไฟล์ที่สมัครรับข้อมูลการสนทนาดังกล่าว

Profile[]

unread

จำนวนข้อความที่โปรไฟล์เซสชั่นยังไม่ได้อ่าน

integer

unseen

จำนวนข้อความที่โปรไฟล์เซสชั่นยังไม่ได้ดู

integer

updated_time

เมื่ออัพเดตการสนทนาล่าสุด

datetime

can_reply

เพจสามารถตอบกลับในการสนทนานี้ได้หรือไม่

boolean

linked_group

ID ของกลุ่ม Workplace ที่การสนทนานั้นเชื่อมโยงด้วย (เฉพาะ Workplace เท่านั้น)

string

จุดเชื่อมโยง

ชื่อ คำอธิบาย

messages

รายการของแต่ละข้อความในการสนทนา ดูข้อความ

การกรองข้อความ

แอพ Messenger สามารถกรองการเชื่อมต่อ messages เพื่อหลีกเลี่ยงการดึงข้อความที่เป็นส่วนหนึ่งในคำเตือนของการสนทนาได้ โดยสามารถทำผ่านตัวกรอง 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>"

การเผยแพร่

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

การลบ

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

การอัพเดต

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