diff --git a/server/notification-providers/webhook.js b/server/notification-providers/webhook.js index 77ce229d..ab7d5f06 100644 --- a/server/notification-providers/webhook.js +++ b/server/notification-providers/webhook.js @@ -12,6 +12,8 @@ class Webhook extends NotificationProvider { const okMsg = "Sent Successfully."; try { + const httpMethod = notification.httpMethod.toLowerCase() || "post"; + let data = { heartbeat: heartbeatJSON, monitor: monitorJSON, @@ -21,7 +23,19 @@ class Webhook extends NotificationProvider { headers: {} }; - if (notification.webhookContentType === "form-data") { + if (httpMethod === "get") { + config.params = { + msg: msg + }; + + if (heartbeatJSON) { + config.params.heartbeat = JSON.stringify(heartbeatJSON); + } + + if (monitorJSON) { + config.params.monitor = JSON.stringify(monitorJSON); + } + } else if (notification.webhookContentType === "form-data") { const formData = new FormData(); formData.append("data", JSON.stringify(data)); config.headers = formData.getHeaders(); @@ -42,7 +56,13 @@ class Webhook extends NotificationProvider { } config = this.getAxiosConfigWithProxy(config); - await axios.post(notification.webhookURL, data, config); + + if (httpMethod === "get") { + await axios.get(notification.webhookURL, config); + } else { + await axios.post(notification.webhookURL, data, config); + } + return okMsg; } catch (error) { diff --git a/src/components/notifications/Webhook.vue b/src/components/notifications/Webhook.vue index 7775a3fd..be51cc2c 100644 --- a/src/components/notifications/Webhook.vue +++ b/src/components/notifications/Webhook.vue @@ -12,6 +12,21 @@
+ + +
+ {{ $parent.notification.httpMethod === 'get' ? $t("webhookGetMethodDesc") : $t("webhookPostMethodDesc") }} +
+
+ +