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

Great library - Can we add a method or configuration based auto validation of webhook messages #43

Closed rasikas closed 5 years ago

rasikas commented 6 years ago

First of thank you for a well written complete library (especially using TS) I wish you could continuously maintain it. Is there a way you to include the message origin validation that FB has mentioned at the bottom of this page?

https://developers.facebook.com/docs/messenger-platform/webhook Validating Webhook Events

Thanks

crisboarna commented 6 years ago

Hey, could you please expand on this a bit ? Where would you like this to be located ? As a utility method that checks incoming payload ? Or in the FacebookMessageParser class when it is extract each individual message to only return valid ones ?

rasikas commented 6 years ago

I think it should be a utility method that is accessible anywhere by passing the payload and any other required parameters. for ex: in my case, I use your library to prepare reply messages to messenger, I don't use (yet) your library to capture any incoming messages (webhook), so it is better to have the flexibility to use the validation method as a separate utility class, so we could use it whenever we need it. Hope that makes sense. Thank you

mohyt commented 5 years ago

@crisboarna : I am planning to create a PR for this as it's will be good to have a validation before parsing the messages.

crisboarna commented 5 years ago

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

The release is available on:

Your semantic-release bot :package::rocket:

crisboarna commented 5 years ago

Hey @rasikas , with the help of @mohyt your feature request has been merged and version 4.1.0 has message integrity validation added.

rasikas commented 5 years ago

@crisboarna , @mohyt thanks a lot !!!! this is valuable