facebook-graph-apifacebook-access-token

(#100) Tried accessing nonexisting field (messages) on node type (User)


When I try to get the Messages sent to my Facebook Page, which is linked to Messenger chatbot I get the following error:

{
  "error": {
    "message": "(#100) Tried accessing nonexisting field (messages) on node type (User)",
    "type": "OAuthException",
    "code": 100,
    "fbtrace_id": "A5W_BFDXx9GgriZb697u5zv
"
  }
}

Here is also an image of the output:

enter image description here

The Access Token is valid for sure. I have tested below:

enter image description here

Note that the Page is neither Business Verified, not Individual verified. I don't know if this plays a role. However, even though the Page Access Token seems correct, I can't run the GET query.

Update - Use Page Access Token

enter image description here


Solution

  • https://developers.facebook.com/docs/graph-api/reference/page/ doesn’t mention the messages edge any more, but how to use it to send messages, is explained as part of the Messenger API documentation:

    https://developers.facebook.com/docs/messenger-platform/reference/send-api/

    So, /me/messages is the correct endpoint for that, to be used with a page access token. And since sending messages is a “creating” action, it needs to be a POST request.


    Be aware though that you can not just arbitrarily send messages whenever and to whomever you want - usually, the user needs to make contact with your page first, so that your bot can then respond to that. The details of the different types of messaging, and their restrictions, are explained unter https://developers.facebook.com/docs/messenger-platform/send-messages