ShellMonkeys/fb-messenger-es6

No user found error

Closed this issue · 9 comments

Getting then when sending message to user with quickReply buttons. Everything else works fine. Failed to understand why it's happening.

15:38:41 - error: { message: '(#100) No matching user found', type: 'OAuthException', code: 100, error_subcode: 2018001, fbtrace_id: 'Fyvc4jsF4Qh' } 15:38:41 - error: Error: (#100) No matching user found at /home/pastor/Developer/Up/coffeeBot/node_modules/fb-messenger-es6/src/client/client.js:51:23 at process._tickDomainCallback (internal/process/next_tick.js:135:7) (node:14949) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: (#100) No matching user found (node:14949) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 15:38:45 - error: { message: '(#100) No matching user found', type: 'OAuthException', code: 100, error_subcode: 2018001, fbtrace_id: 'F0HVfiE4zFs' } 15:38:45 - error: Error: (#100) No matching user found at /home/pastor/Developer/Up/coffeeBot/node_modules/fb-messenger-es6/src/client/client.js:51:23 at process._tickDomainCallback (internal/process/next_tick.js:135:7) (node:14949) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: (#100) No matching user found

@hitchnsmile Can you please provide a code snippet of how you are constructing the message?

@davidrussell731
Of course. Here:
getStarted: (chatID: number) => { facebook.sendMessage(new TextMessage(texts.messages.getStarted.text) .addQuickReply(new TextQuickReply(texts.buttons.getStarted, 'GET_STARTED_PAYLOAD')), chatID) }

@hitchnsmile chatID is the USER_ID right? It seems like you're trying to send the message to an invalid user. The error you get back is directly from Facebook.

What do you mean by everything else works fine?

@radTuti That is correct.
I am not changing user_id and it gets sent either way after few errors.

Everything else: Generic templates, buttons and etc.
I get these errors only with quickReplies.

@hitchnsmile to narrow the root cause, can you try posting the message to FB directly?

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":chatID
  },
  "message":{
    "text":texts.messages.getStarted.text,
    "quick_replies":[
      {
        "content_type":"text",
        "title":texts.buttons.getStarted,
        "payload":"GET_STARTED_PAYLOAD"
      }
    ]
  }
}' "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"

Additionally, can you check if the object constructed using the lib matches what is in message in the above snippet? <- Maybe check this first?

Curl was success.
Response:
{"recipient_id":"1209488182492453","message_id":"mid.$cAADzaMpz351iia_VelcWGqM_YMG3"}

Construction matches. Text and then replies.

Based on your last response; neither Facebook nor the lib seem to have a problem. Could it be possible that at some point when you invoke that you end up sending an invalid userId?

@radTuti
Hardly.
On user message, I'm taking userID from response.recipient_id and passing directly to the function which sends user quickReply options instantly

I am closing this issue as I haven't been able to replicate the issue and conclude that it might have something to do with how the user is accessed.

Using the lib:

const messages = ProcessIncoming(req.body); //userID accessed using messages[PAGE_ID][0].sender

sans library

//userID accessed using req.body.sender.id