问题
In our android app, we have provided the functionality to schedule and publish posts on Facebook pages. and also we have provided functionality to delete the scheduled post.
for the above features, we have already taken the required permissions(publish_pages, manage_pages) through App Review.
All the functionality worked perfectly on our Android & iOS platforms. but for the last few weeks, we are getting error in deleting schedule posts on the Android platform. when we have checked what's wrong with this functionality on the Android platform then we got the below error.
ERROR:
{Response: responseCode: 403, graphObject: null, error: {HttpStatus: 403, errorCode: 200, subErrorCode: -1, errorType: OAuthException, errorMessage: (#200) The permission(s) pages_manage_engagement are not available. It could because either they are deprecated or need to be approved by App Review.}}
Based on the above error we have checked the documentation on Facebook platform, It says that "pages_manage_engagement" permission is used for "Create, edit, and delete comments posted by your Page". We didn't provide any functionality related to comments on pages. An important thing is that the above error comes in deleting the scheduled post. We have already taken permission of publish_pages. I have attached an image of it.
Facebook login and share dependency
implementation 'com.facebook.android:facebook-login:5.8.0'
implementation 'com.facebook.android:facebook-share:5.8.0'
so I am requesting you to please check and verify the above issue. let me know about further process and solution.
Thank you.
回答1:
Below peace of code I am using for delete posts.
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + "post_id",
null,
HttpMethod.DELETE,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
Here I am directly passing a post_id for delete scheduled post. it works perfectly before Graph API v7.0.
But after deprecating publish_pages
, manage_pages
permissions, it is not working.
Solution
I have append page_id before post_id like this
"PAGE_ID" + "_" + "POST_ID"
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + "page_id" + "_" + "post_id",
null,
HttpMethod.DELETE,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
It works like a charm.
来源:https://stackoverflow.com/questions/64643614/i-am-getting-an-error-when-deleting-the-scheduled-facebook-page-post-pages-mana