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

API mismatch for Persistent Menu #99

Open toddheslin opened 4 years ago

toddheslin commented 4 years ago

I should note that I'm loving this library and will be jumping in to contribute and send PRs soon. Thanks for publishing it!

I've noticed that in 'Setting Persistent Menu' section of the readme you have:

const result = await profileClient.setPersistentMenu(senderId, [<MENU_ENTRIES>])

and in the source code: https://github.com/crisboarna/fb-messenger-bot-api/blob/9de548c4b1462fe20bcca77fe74d542228cdebb0/src/profile/FacebookProfileAPIClient.ts#L79-L84

The call is to: 'me/messenger_profile'

However, the senderId isn't passed into the messenger_profile endpoint: https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/persistent-menu

But it is passed into the me/custom_user_settings endpoint: https://developers.facebook.com/docs/messenger-platform/send-messages/persistent-menu#user_level_menu

As a slightly different issue, the composer_input_disabled field is not an option on the API as it only takes the array that is passed into call_to_actions.

crisboarna commented 4 years ago

Hey @toddheslin thank you for the kind words :D

Any PR is much appreciated and am looking forward to your commits.

On your points:

  1. Documentation slip, it does not support senderId nor does it make sense to have it. Will have it fixed.
  2. That endpoint is newer and I did not add it into the library yet. Will use this to track its addition ;)
  3. That is a good catch, including it would be beneficial for having full flexibility on the menu.