bootbot icon indicating copy to clipboard operation
bootbot copied to clipboard

Parameter error: You cannot send messages to this id

Open ihavenonickname opened this issue 6 years ago • 4 comments

This call:

bot.say(user_id, "hello")

Results in the following error:

(Messenger Error received. For more information about error codes, see: https://goo.gl/d76uvB
{ message: '(#100) Parameter error: You cannot send messages to this id',
  type: 'OAuthException',
  code: 100,
  fbtrace_id: 'EiRBnjXA1uA' })

The user_id parameter is the payload.sender.id from bot.on('message') callback.

What bugs me is that it works on my local machine, however it doesn't on my remote server, even using the very same user_id in both machines.

Any hints?

ihavenonickname avatar Jun 14 '18 20:06 ihavenonickname

Check your app ID and page token. Make sure they're not null and correct for the correct page.

mraaroncruz avatar Jun 14 '18 20:06 mraaroncruz

Hello!

I checked, they're equal on both machines.

Just to be clear, bot.on('message') works on both machines, while bot.say only works on one of them (my local machine).

ihavenonickname avatar Jun 15 '18 12:06 ihavenonickname

It sounds like a facebook page token issue. Are you sure that the page tokens match the app you are expecting to use?

User ID's are page scoped so this sounds like you are trying to send to a user that is connected to a different page. So FB's like "Who is this?"

I can almost guarantee that your facebook page token is incorrect.

mraaroncruz avatar Jun 15 '18 12:06 mraaroncruz

  • Go to the app in developers.facebook
  • Go to Settings => Basic
  • Look at the App ID (and secret), make sure it is what you are using in production
  • Now go to Messenger => Settings in the left menu
  • Select the page you are sending to and from
  • Make sure the token is the same you have in production with the app id above

mraaroncruz avatar Jun 15 '18 12:06 mraaroncruz