グラフAPIバージョン

グラフAPIリファレンス/{message-id}/shares

v3.3の変更の一環として、read_page_mailboxesアクセス許可は廃止されました。このエンドポイントにアクセスするには、pages_messagingアクセス許可を使用してください。read_page_mailboxesアクセス許可は、2020年6月30日を過ぎると使用できなくなります

メッセージ内の共有アイテム。これはページ専用のエンドポイントです。

読み取り

グラフ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

共有アイテムのURL。

string

id

共有アイテムのID。

string

name

共有アイテムのタイトル。

string

template

共有アイテムのオブジェクト。

Object

template.payload.product.elements

これは、ビジネスが商品を表示できる場合にのみ利用できます。ビジネスが所有していない商品については、shares.data.nameAttachment Unavailableとして返されます。

プロパティ 説明

id

文字列

Facebook商品カタログの商品ID

retailer_id

文字列

商品に関連付けられている外部ID。(例: SKU/コンテンツID)

image_url

文字列

商品画像のURL

title

文字列

商品のタイトル

price

文字列

商品の価格

商品テンプレートの例

会話APIの商品テンプレートは、グラフAPI v8.0以上でのみ利用できます

アプリがWebhooksで商品の詳細情報を受け取るためには、catalog_management会話APIのアクセス許可が承認されている必要があります。

"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"
                            },
                            {..}],
                        }
                    }
                }
            }
    }]
}    

公開

このエッジを使って公開することはできません。

削除

このエッジを使って削除することはできません。

更新

このエッジを使ってコメントを更新することはできません。