Search code examples
facebookfacebook-graph-api

Error when trying to send a message from Faceboook page to Facebook user using API


When I'm trying to use Graph API to send a message from FB page to an user. I get this error:

{
  "error": {
    "message": "Unsupported post request. Object with ID '100066276464105' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
    "type": "GraphMethodException",
    "code": 100,
    "error_subcode": 33,
    "fbtrace_id": "AkMoCKVHuPHXAT7IQubn6rE"
  }
}

I have checked the other document and see this issue related with missing permission on my Facebook app, but I already has "pages_show_list" permission:

enter image description here

"pages_read_engagement" and "pages_read_user_content":

enter image description here

"pages_manage_ads":

enter image description here

This is my Graph API call:

enter image description here

Have someone got the same issue as me?

UPDATED: I have try again and this is the current issue that I have Step 1: I using GET method to get my user id (UID) enter image description here Step 2: Then I get my facebook page Id (PID) enter image description here Step 3: Then I using my user to send the initial message to the facebook page, after that I use the POST call to send response message to the initial message. enter image description here

Where do I go wrong?


Solution

  • The reason for this one is I need to get my PSID user. To do this I need to go to

    curl -i -X GET "https://graph.facebook.com/LATEST-API-VERSION/PAGE-ID/conversations?fields=participants&access_token=PAGE-ACCESS-TOKEN"
    

    Then response will be something like this, then the Id in the response will be the PSID and using this PSID to send the message enter image description here