图谱 API 版

图谱 API 参考资料 /{message-id}/shares

作为 V3.3 更改的一部分,我们已停用 read_page_mailboxes 权限。请使用 pages_messaging 权限来访问此端点。我们将于 2020 年 6 月 30 日后停用 read_page_mailboxes 权限

表示消息中所分享的内容。此端点仅适用于公共主页。

读取

图谱 API 探索工具
GET /v19.0/{message-id}/shares 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(
    '/{message-id}/shares',
    '{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(
    "/{message-id}/shares",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{message-id}/shares",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{message-id}/shares"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

权限

此连线需要包含下列权限的公共主页访问口令:

  • pages_messaging

系统将处于开发模式的应用限制为只能向在该应用中具有身份的用户发送消息。

字段

名称 描述 类型

description

有关所分享内容的描述。

string

link

所分享内容的网址。

string

id

所分享内容的编号。

string

name

所分享内容的标题。

string

template

所分享内容的对象。

Object

template.payload.product.elements

仅在商家可以查看相应商品时才可用。对于不属于商家的商品,系统将为 shares.data.name 返回 Attachment Unavailable

属性 类型 描述

id

字符串

Facebook 商品目录上的商品编号

retailer_id

字符串

与商品关联的外部编号。(例如:SKU 或内容编号)

image_url

字符串

商品图像网址

title

字符串

商品标题

price

字符串

商品价格

商品模板示例

转化 API 上的商品模板仅适用于图谱 API v8.0 及以上版本

应用将需要具备获准在转化 API 中接收商品详情的 catalog_management 权限。

"shares": {
    "data": [{
       "template": {
            "payload":{
                "product": {
                    "elements":{ // multiple elements in Hscroll
                        "data": [
                            {
                                "id" : "<Product_id>",
                                "retailer_id": "<EXTERNAL_ID>", 
                                "image_url" : "https://fb.cdn.com/sdsd",
                                "name" : "Some product title",
                                "price" : "$10"
                            },
                            {..}],
                        }
                    }
                }
            }
    }]
}    

发布

您无法使用此连线发布对话。

删除

您无法使用此连线进行删除。

更新

您无法使用此连线更新状态。