Facebook Graph API: Cannot call API for app on behalf of user

120 Views Asked by At

I'm trying to install FB app for a page which belongs to FB business account. I use FB Login for Business. For that I've created a dedicated configuration which uses system user access token and appropriate permissions. Signup flow works up until the page is trying to install webhook-configured app.

Error says "Cannot call API for app 318885771079185 on behalf of user 122095516454148272", "type": "OAuthException", "code": 200

My FB app is still in development mode.

Can someone please advice what might be the reason for this failure?

I reproduced the flow with the same error in Graph API Explorer. Here is debug information from Graph API Explorer:

==== Query
curl -i -X POST 
"https://graph.facebook.com/v18.0/128416520366334/subscribed_apps?access_token=<access token sanitized>"
==== Access Token Info
{
"perms": [
"pages_show_list",
"business_management",
"pages_messaging",
"pages_read_engagement",
"pages_manage_metadata",
"public_profile"
],
"page_id": 128416520366334,
"user_id": "122095516454148272",
"app_id": 318885771079185
}
==== Parameters
Query Parameters


{}
POST Parameters


{}
==== Response
{
"error": {
"message": "Cannot call API for app 318885771079185 on behalf of user 122095516454148272",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "AUw_REyjYe9ieOX4Ce4OVW9"
}
}
==== Debug Information from Graph API Explorer
https://developers.facebook.com/tools/explorer/?method=POST&path=128416520366334%2Fsubscribed_apps&version=v18.0
1

There are 1 best solutions below

0
Kiryl Mayorchyk On

Alright, I figured it out. I put FB app into live mode even without submitting it for review. This made the trick. I also had to provide subscribed_fields param for the request.

POST 
https://graph.facebook.com/v18.0/{page_id}/subscribed_apps?subscribed_fields=messages&access_token={page_access_token}

Hope this helps, cheers.