From 82380f0c05ca4e9b98dbc74856179b9fee1d03cb Mon Sep 17 00:00:00 2001 From: Kshitij Katiyar Date: Wed, 18 Oct 2023 16:18:13 +0530 Subject: [PATCH 1/2] [MI-3636]:Added support for webhook of plugin version v2.x.x --- server/http.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/http.go b/server/http.go index daaacbbe3..a68dabaf9 100644 --- a/server/http.go +++ b/server/http.go @@ -134,6 +134,9 @@ func (p *Plugin) initializeRouter() { // Firehose webhook setup for channel subscriptions instanceRouter.HandleFunc(makeAPIRoute(routeAPISubscribeWebhook), p.handleResponseWithCallbackInstance(p.httpSubscribeWebhook)).Methods(http.MethodPost) + // To support Plugin v2.x webhook URL + apiRouter.HandleFunc(routeAPISubscribeWebhook, p.handleResponseWithCallbackInstance(p.httpSubscribeWebhook)).Methods(http.MethodPost) + // Channel Subscriptions apiRouter.HandleFunc(routeAPISubscriptionsChannelWithID, p.checkAuth(p.handleResponse(p.httpChannelGetSubscriptions))).Methods(http.MethodGet) apiRouter.HandleFunc(routeAPISubscriptionsChannel, p.checkAuth(p.handleResponse(p.httpChannelCreateSubscription))).Methods(http.MethodPost) From 20a12fadc68fd146f876bd9ef639f31d68528d8c Mon Sep 17 00:00:00 2001 From: Kshitij Katiyar Date: Thu, 19 Oct 2023 16:39:18 +0530 Subject: [PATCH 2/2] [MI-3636]:Added support for legacy webhooks --- server/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/http.go b/server/http.go index a68dabaf9..5c436e685 100644 --- a/server/http.go +++ b/server/http.go @@ -134,8 +134,9 @@ func (p *Plugin) initializeRouter() { // Firehose webhook setup for channel subscriptions instanceRouter.HandleFunc(makeAPIRoute(routeAPISubscribeWebhook), p.handleResponseWithCallbackInstance(p.httpSubscribeWebhook)).Methods(http.MethodPost) - // To support Plugin v2.x webhook URL + // To support Plugin v2.x webhook URLs apiRouter.HandleFunc(routeAPISubscribeWebhook, p.handleResponseWithCallbackInstance(p.httpSubscribeWebhook)).Methods(http.MethodPost) + instanceRouter.HandleFunc(routeIncomingWebhook, p.handleResponseWithCallbackInstance(p.httpWebhook)).Methods(http.MethodPost) // Channel Subscriptions apiRouter.HandleFunc(routeAPISubscriptionsChannelWithID, p.checkAuth(p.handleResponse(p.httpChannelGetSubscriptions))).Methods(http.MethodGet)