crisboarna / fb-messenger-bot-api

NodeJS Facebook Messenger API for bots to send messages and setup events to Facebook.
https://www.npmjs.com/package/fb-messenger-bot-api
MIT License
34 stars 17 forks source link

BUG: Recipient is required #61

Closed MartinSahlen closed 5 years ago

MartinSahlen commented 5 years ago

{"message":"(#100) The parameter recipient is required","type":"OAuthException","code":100,"fbtrace_id":"XXX"} is received when trying to use sendTextMessage. The reason is this:

File: https://github.com/crisboarna/fb-messenger-bot-api/blob/master/src/client/FacebookMessagingAPIClient.ts

On line 234, options.json = { recipient: { id } }; sets the recipient. However, on line

220 or 226, options.json is overwritten with the payload (message or sender_action). The payload needs to be added to the json object and not overwrite it. I have tested locally and it works by doing something like options.json.message = payload or options.json.sender_action = payload.

MartinSahlen commented 5 years ago

@crisboarna Did you see this?

mohyt commented 5 years ago

@MartinSahlen : I created a PR https://github.com/crisboarna/fb-messenger-bot-api/pull/64 for this, waiting for approval from @crisboarna.

crisboarna commented 5 years ago

Hey, will look at this issue in a couple of hours when I get back, glad to see involvement! :D

crisboarna commented 5 years ago

Thank you @mohyt for the PR ! It was merged 💃 . If you run into any other issues / suggestions, do not hesitate to post a issue/request/pr :)

crisboarna commented 5 years ago

:tada: This issue has been resolved in version 4.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: