Reputation: 151
I am creating an app that will pull leads from facebook pages that I manage and update them into Google Sheets subsequently.
I have setup the webhook, generated long lived page access token with following permissions
When I try to subscribe the page to my app using POST request {page_id}/subscribed_apps
I get the below error
{
"error": {
"message": "(#100) The parameter subscribed_fields is required.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Fv7RbO8tYqo"
}
}
Researching revealed that facebook has added a new parameter called subscribed_fields in v3.2 api, but I am not sure how values must be passed to that parameter or is there something I am missing?
Upvotes: 14
Views: 15179
Reputation: 31
For the fb.login you cant use 'manage_pages' as scope please try to use following:
{scope: ['pages_show_list','leads_retrieval']}
Upvotes: 1
Reputation: 1290
Adding subscribed_fields=publisher_subscriptions in request worked for me.
Here is the code:
request({
method: 'POST',
uri: `https://graph.facebook.com/v2.6/me/subscribed_apps?subscribed_fields=publisher_subscriptions&access_token=${FB_PAGE_ACCESS_TOKEN}`
},
(error, response, body) => {
if (error) {
console.error('Error while subscription: ', error);
} else {
console.log('Subscription result: ', response.body);
}
});
Upvotes: 7
Reputation: 81
In the new Graph API v3.2, you must pass a parameter subscribed_fields
, along with the post
request me/subscribed_apps
(with the page access token as the access token). You need to pass an array of available subscribable fields that are:
[
feed, mention, name, picture, category, description, conversations,
branded_camera, feature_access_list, standby,
messages, messaging_account_linking, messaging_checkout_updates,
message_echoes, message_deliveries, messaging_game_plays, messaging_optins,
messaging_optouts, messaging_payments, messaging_postbacks,
messaging_pre_checkouts, message_reads, messaging_referrals,
messaging_handovers, messaging_policy_enforcement,
messaging_page_feedback, messaging_appointments, founded,
company_overview, mission, products, general_info, leadgen,
leadgen_fat, location, hours, parking, public_transit,
page_about_story, phone, email, website, ratings, attire,
payment_options, culinary_team, general_manager, price_range,
awards, hometown, current_location, bio, affiliation, birthday,
personal_info, personal_interests, publisher_subscriptions, members,
checkins, page_upcoming_change, page_change_proposal,
merchant_review, product_review, videos, live_videos, registration,
]
Like e.g.: subscribed_fields: ['messages', 'message_deliveries']
Upvotes: 8
Reputation: 433
As of facebook api v3.2, I also ran into problems.
Here's what fixed @AdityaChowdhary's original issue: -add "subscribed_fields: 'leadgen'" as a post parameter, like this:
FB.api(
'/' + page_id + '/subscribed_apps',
'post',
{ access_token: page_access_token, subscribed_fields: 'leadgen' },
function (response) {
console.log('Successfully subscribed page', response);
});
Then, you may run into another error: "To subscribe to the leadgen field, one of these permissions is needed: leads_retrieval".
To prevent the permissions error: add the "leads_retrieval" permission to the fb.login scope, like this:
FB.login(function (response) {
...
}, {scope: ['manage_pages', 'leads_retrieval']});
Upvotes: 8
Reputation: 222
Maybe, this can help for you guys:
https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps/#Creating
like this in form of POST request: https://graph.facebook.com/v3.2/me/subscribed_apps?subscribed_fields=
So you need create this. :)
I have some issue with permissions, what is weird because I double checked my page permissions here: https://developers.facebook.com/tools/debug/accesstoken and seemingly I have the permissons that is missed in the message of the fb error response.
I got this response:
{
"error": {
"message": "(#200) To subscribe to the feed field, one of these permissions is needed: manage_pages. To subscribe to the mention field, one of these permissions is needed: manage_pages. To subscribe to the name field, one of these permissions is needed: manage_pages. To subscribe to the picture field, one of these permissions is needed: manage_pages. To subscribe to the category field, one of these permissions is needed: manage_pages. To subscribe to the description field, one of these permissions is needed: manage_pages. To subscribe to the conversations field, one of these permissions is needed: manage_pages. To subscribe to the branded_camera field, one of these permissions is needed: manage_pages. To subscribe to the feature_access_list field, one of these permissions is needed: manage_pages. To subscribe to the standby field, one of these permissions is needed: manage_pages. To subscribe to the messages field, one of these permissions is needed: manage_pages. To subscribe to the messaging_account_linking field, one of these permissions is needed: manage_pages. To subscribe to the messaging_checkout_updates field, one of these permissions is needed: manage_pages. To subscribe to the message_echoes field, one of these permissions is needed: manage_pages. To subscribe to the message_deliveries field, one of these permissions is needed: manage_pages. To subscribe to the messaging_game_plays field, one of these permissions is needed: manage_pages. To subscribe to the messaging_optins field, one of these permissions is needed: manage_pages. To subscribe to the messaging_optouts field, one of these permissions is needed: manage_pages. To subscribe to the messaging_payments field, one of these permissions is needed: manage_pages. To subscribe to the messaging_postbacks field, one of these permissions is needed: manage_pages. To subscribe to the messaging_pre_checkouts field, one of these permissions is needed: manage_pages. To subscribe to the message_reads field, one of these permissions is needed: manage_pages. To subscribe to the messaging_referrals field, one of these permissions is needed: manage_pages. To subscribe to the messaging_handovers field, one of these permissions is needed: manage_pages. To subscribe to the messaging_policy_enforcement field, one of these permissions is needed: manage_pages. To subscribe to the messaging_page_feedback field, one of these permissions is needed: manage_pages. To subscribe to the messaging_appointments field, one of these permissions is needed: manage_pages. To subscribe to the founded field, one of these permissions is needed: manage_pages. To subscribe to the company_overview field, one of these permissions is needed: manage_pages. To subscribe to the mission field, one of these permissions is needed: manage_pages. To subscribe to the products field, one of these permissions is needed: manage_pages. To subscribe to the general_info field, one of these permissions is needed: manage_pages. To subscribe to the leadgen field, one of these permissions is needed: leads_retrieval. To subscribe to the leadgen_fat field, one of these permissions is needed: leads_retrieval. To subscribe to the location field, one of these permissions is needed: manage_pages. To subscribe to the hours field, one of these permissions is needed: manage_pages. To subscribe to the parking field, one of these permissions is needed: manage_pages. To subscribe to the public_transit field, one of these permissions is needed: manage_pages. To subscribe to the page_about_story field, one of these permissions is needed: manage_pages. To subscribe to the phone field, one of these permissions is needed: manage_pages. To subscribe to the email field, one of these permissions is needed: manage_pages. To subscribe to the website field, one of these permissions is needed: manage_pages. To subscribe to the ratings field, one of these permissions is needed: manage_pages. To subscribe to the attire field, one of these permissions is needed: manage_pages. To subscribe to the payment_options field, one of these permissions is needed: manage_pages. To subscribe to the culinary_team field, one of these permissions is needed: manage_pages. To subscribe to the general_manager field, one of these permissions is needed: manage_pages. To subscribe to the price_range field, one of these permissions is needed: manage_pages. To subscribe to the awards field, one of these permissions is needed: manage_pages. To subscribe to the hometown field, one of these permissions is needed: manage_pages. To subscribe to the current_location field, one of these permissions is needed: manage_pages. To subscribe to the bio field, one of these permissions is needed: manage_pages. To subscribe to the affiliation field, one of these permissions is needed: manage_pages. To subscribe to the birthday field, one of these permissions is needed: manage_pages. To subscribe to the personal_info field, one of these permissions is needed: manage_pages. To subscribe to the personal_interests field, one of these permissions is needed: manage_pages. To subscribe to the publisher_subscriptions field, one of these permissions is needed: manage_pages. To subscribe to the members field, one of these permissions is needed: manage_pages. To subscribe to the checkins field, one of these permissions is needed: manage_pages. To subscribe to the page_upcoming_change field, one of these permissions is needed: manage_pages. To subscribe to the page_change_proposal field, one of these permissions is needed: manage_pages. To subscribe to the merchant_review field, one of these permissions is needed: manage_pages. To subscribe to the product_review field, one of these permissions is needed: manage_pages. To subscribe to the videos field, one of these permissions is needed: manage_pages. To subscribe to the live_videos field, one of these permissions is needed: manage_pages. To subscribe to the registration field, one of these permissions is needed: manage_pages",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "HTI8+tPvJZt"
}
}
But I hope you can avoid this error. :)
Upvotes: 0
Reputation: 2289
Im havint the same problem when i try to add a webhook for a facebook_lead ads campaign... it used to work perfectly on previous versions, im passing the scope: "manage_pages"
function myFacebookLogin() {
FB.login(function(response){
console.log('Successfully logged in', response);
FB.api('/me/accounts',
{limit: 200},
function(response) {
console.log('Successfully retrieved pages', response);
var pages = response.data;
var ul = document.getElementById('list');
for (var i = 0, len = pages.length; i < len; i++) {
var page = pages[i];
var li = document.createElement('li');
var a = document.createElement('a');
a.href = "#";
a.onclick = subscribeApp.bind(this, page.id, page.access_token);
a.innerHTML = page.name;
li.appendChild(a);
ul.appendChild(li);
}
});
}, {scope: 'manage_pages'});
}
Upvotes: 1