Skip to content
This repository has been archived by the owner on Jan 19, 2020. It is now read-only.

remove user_agent check in messenger webhook #36

Open
adamjuhasz opened this issue Oct 16, 2016 · 6 comments
Open

remove user_agent check in messenger webhook #36

adamjuhasz opened this issue Oct 16, 2016 · 6 comments

Comments

@adamjuhasz
Copy link
Contributor

I can't find any official documentation that the user agent will be facebookplatform.

Is checking the x-hub-signature enough, since that is the only official way of checking validity?

@jcampbell05
Copy link
Collaborator

@adamjuhasz I saw it once in one of the HTTP Requests from Facebook but x-hub-signature probably is enougth as I've seen cases where the facebookplatform isn't in the agent.

@adamjuhasz
Copy link
Contributor Author

I was looking at the current way of handling webhooks, do I undestand it correctly that all webhooks will be at /webhook and an event is sent with the event name 'webhook' to all listeners? Since x-hub-signuture is commonly used by webhook APIs (ex github), I would be scared of using just that to differentiate FB from other web hooks.

Is it better to se up multiple webhook paths, one for each service and add custom events?

this.router.post('/webhook/facebook', (..) => this.trigger('webhook-facebook', req, res))
this.router.post('/webhook/twillio',  (...) => this.trigger('webhook-twillio', req, res))

This could be parameterized with:

this.router.post('/webhook/:platform',  (req, res, next) => {
    this.trigger(`webhook-${rew.params['platform']}`, req, res, next)
});

adamjuhasz added a commit that referenced this issue Oct 16, 2016
@jcampbell05
Copy link
Collaborator

jcampbell05 commented Oct 16, 2016

@adamjuhasz Yeah I totally agree, I would like for us to move towards something like that especially as we will have other endpoints for other features like pushing content to the Bot.

Happy for you to start this as a PR.

@jcampbell05
Copy link
Collaborator

We should be able to implement this now @vutran's ES6 classes are now implemented.

@vutran
Copy link
Member

vutran commented Oct 19, 2016

@jcampbell05 Actually, the ES6 classes are not merged (#41). There's still some broken tests I need to fix which should be done soon (got a lot of things going on right now).

@jcampbell05
Copy link
Collaborator

@vutran let me know if I can help :) I think we should merge into master and split it up :) there are a lot of things that need to come together before 0.2.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants