restfbmessenger icon indicating copy to clipboard operation
restfbmessenger copied to clipboard

Consider publishing an appcontext event instead of making people implement an interface for callbacks

Open marceloverdijk opened this issue 9 years ago • 1 comments
trafficstars

As discussed with @joshlong on Twitter it might interesting to publishing appcontext events instead of making people implement an interface for callbacks.

(FacebookMessageEvent.class) void onMessage (FacebookMessageEvent evt) {..}

Maybe a restfbmessenger-spring module can be introduced with a CallbackHandler adapter that publishes the appcontext events. Users can then choose to implement their own CallbackHandler or use the adapter and use the Spring events.

marceloverdijk avatar Oct 06 '16 20:10 marceloverdijk

One drawback of using the appcontext events is that is probably more complicated to differentiate evens from multiple chatbots.

E.g. in a single webapp I could add multiple webhook endpoints for various chatbots. In the current design each webhook endpoint (multiple WebhookServlets with their own mapping) has its own CallbackHandler, so the CallbackHandler is implemented specifically for a chatbot. When using the appcontext events will not be able the origin chatbot. @joshlong do you maybe have an idea?

marceloverdijk avatar Oct 07 '16 07:10 marceloverdijk