Версия API Graph

Page Subscribed Apps

Webhook subscriptions for apps that service a Facebook Page.

It is possible to subscribe to more fields at the page level than the app level. However, only fields with subscriptions at both the page and app levels will get Webhooks. To make sure you are subscribed to the same fields at the app level, use the app subscriptions endpoint.

Чтение

Get the Webhooks an app is subscribed to for a Facebook Page.

Permissions

  • A Page access token requested by a person who can perform the

    CREATE_CONTENT,

    MANAGE, or

    MODERATE

    on the Page being queried

  • The pages_manage_metadata permission
  • The pages_show_list permission

New Page Experience

This endpoint is supported for New Page Experience.

Пример

Graph API Explorer
GET /v19.0/{page-id}/subscribed_apps 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(
    '/{page-id}/subscribed_apps',
    '{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(
    "/{page-id}/subscribed_apps",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/subscribed_apps",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/subscribed_apps"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
Чтобы узнать, как использовать API Graph, ознакомьтесь с нашим руководством по API Graph.

Параметры

Эта конечная точка не содержит параметров.

Поля

При чтении с данной границы контекста будет возвращен результат в формате JSON:

{ "data": [], "paging": {} }

data

Список узлов «Application».

К каждому возвращаемому узлу будут добавлены следующие поля:

ПолеОписание
subscribed_fields
list<enum>

Webhook fields to which the app has subscribed on the page

paging

Для получения дополнительных сведений о пагинации смотрите Руководство по API Graph.

Error Codes

ОшибкаОписание
200Permissions error
190Invalid OAuth 2.0 Access Token
100Invalid parameter
80001There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting.
210User not visible
102Session key invalid or no longer valid

Создание

Subscribe your app to a Webhook for a Facebook Page.

Permissions

  • A Page access token requested by a person who can perform

    CREATE_CONTENT,

    MANAGE, or

    MODERATE

    task on the Page

  • The pages_manage_metadata permission
  • The pages_show_list permission

Note: You cannot use the subscribed_fields parameter to configure or subscribe to Webhooks for Instagram. You must use your app dashboard to subscribe to Instagram Webhooks.


Вы можете сделать запрос POST к границе subscribed_apps из этих местоположений:
При размещении публикации на этой границе создается a Page.

Пример

Graph API Explorer
POST /v19.0/{page-id}/subscribed_apps HTTP/1.1
Host: graph.facebook.com

subscribed_fields=leadgen
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/{page-id}/subscribed_apps',
    array (
      'subscribed_fields' => 'leadgen',
    ),
    '{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(
    "/{page-id}/subscribed_apps",
    "POST",
    {
        "subscribed_fields": "leadgen"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("subscribed_fields", "leadgen");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/subscribed_apps",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"subscribed_fields": @"leadgen",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/subscribed_apps"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
curl -X POST \
  -F 'subscribed_fields="leadgen"' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/{page-id}/subscribed_apps
Чтобы узнать, как использовать API Graph, ознакомьтесь с нашим руководством по API Graph.

Параметры

ПараметрОписание
subscribed_fields
array<enum {feed, mention, name, picture, category, description, conversations, feature_access_list, inbox_labels, standby, message_mention, messages, message_reactions, messaging_account_linking, messaging_checkout_updates, messaging_customer_information, message_echoes, message_edits, message_deliveries, message_context, messaging_game_plays, messaging_optins, messaging_optouts, messaging_payments, messaging_postbacks, messaging_pre_checkouts, message_reads, messaging_referrals, messaging_handovers, messaging_policy_enforcement, messaging_appointments, messaging_direct_sends, messaging_fblogin_account_linking, user_action, messaging_feedback, send_cart, otp_verification, group_feed, calls, response_feedback, messaging_in_thread_lead_form_submit, founded, company_overview, mission, products, general_info, leadgen, leadgen_fat, location, hours, parking, public_transit, page_about_story, mcom_invoice_change, invoice_access_invoice_change, invoice_access_invoice_draft_change, invoice_access_onboarding_status_active, invoice_access_bank_slip_events, local_delivery, phone, email, website, ratings, attire, payment_options, culinary_team, general_manager, price_range, awards, hometown, current_location, bio, affiliation, birthday, personal_info, personal_interests, members, checkins, page_upcoming_change, page_change_proposal, merchant_review, product_review, videos, live_videos, video_text_question_responses, registration, payment_request_update, publisher_subscriptions, invalid_topic_placeholder}>

Page Webhooks fields that you want to subscribe

Обязательно

Тип возврата

Эта конечная точка поддерживает чтение после записи и будет считывать узел, в который вы сделали публикацию.
Struct {
success: bool,
}

Error Codes

ОшибкаОписание
200Permissions error
100Invalid parameter
190Invalid OAuth 2.0 Access Token
80001There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting.
104Incorrect signature
210User not visible
102Session key invalid or no longer valid

Обновление

Нельзя выполнить эту операцию в этой конечной точке.

Удаление

Unsubscribe your app to a Webhook for a Facebook Page.

Permissions

An app can remove its own webhook subscription from a Page with an App Access Token.

Вы можете отменить связывание an Application и a Page, отправив запрос DELETE на адрес /{page_id}/subscribed_apps.

Параметры

Эта конечная точка не содержит параметров.

Тип возврата

Struct {
success: bool,
messaging_success: bool,
}

Error Codes

ОшибкаОписание
100Invalid parameter
200Permissions error
104Incorrect signature
210User not visible
190Invalid OAuth 2.0 Access Token