0

I have the problem with Send API. I have tried to use POSTMAN, cURL to post the message to my messenger account. It works correctly with POSTMAN or cURL. However, I have built the Node.js to send the message. The error is " The parameter user_id is required". I have no idea how to fix this. Since in document, there is no user_id field.

 const body = {
  "recipient": {
    "id": SOME_PAGE_SCOPE_ID
  },
  "message": {
    "text": "Test Message"
  }
};
request({
   methods: "POST",
          uri: `https://graph.facebook.com/v${GRAPH_API_VERSION}/me/messages`,
          qs: {
            access_token: ACCESS_TOKEN
          },
          body: body,
          json: true
        }).then(fulfil => console.log(fulfil)).error(err => console.log(err));

LS. GRAPH_VERSION is 2.9 The reference link is https://developers.facebook.com/docs/messenger-platform/send-api-reference

1 Answers1

0

You need "SOME_USER_ID" instead of "SOME_PAGE_SCOPE_ID",

And I think you missed a "message_type" parameter in the JSON.

Israel
  • 1,165
  • 11
  • 11