إصدار ‏‎Graph API‎‏

مرجع واجهة Graph API /{conversation-id}/messages

الرسائل التي تتم في المحادثة بين شخص ما وصفحة فيسبوك أو حساب Instagram احترافي.

القراءة

مستكشف Graph API
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، يلزم توفير الإذن instagram_manage_messages

الحقول

يتم إرجاع مصفوفة تتضمن كائنات الرسائل مع حقول إضافية:

الاسم الوصف النوع

خط متجه

خط متجه

إرسال رسالة

يتعذر عليك إرسال رسالة إلى نقطة النهاية هذه. استخدم Send API بدلاً من ذلك.

الحذف

يتعذر عليك حذف نقطة النهاية هذه.