From 618fb08c4517a70cefefed891fa6ab5e61e52a38 Mon Sep 17 00:00:00 2001 From: To-om Date: Tue, 23 Mar 2021 10:40:32 +0100 Subject: [PATCH] #1865 Add organisation (ID and name) in webhook message --- .../thehive/services/notification/notifiers/Webhook.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/thehive/app/org/thp/thehive/services/notification/notifiers/Webhook.scala b/thehive/app/org/thp/thehive/services/notification/notifiers/Webhook.scala index b18dd6cb3c..718d33a36d 100644 --- a/thehive/app/org/thp/thehive/services/notification/notifiers/Webhook.scala +++ b/thehive/app/org/thp/thehive/services/notification/notifiers/Webhook.scala @@ -258,7 +258,11 @@ class Webhook( else { val ws = new ProxyWS(config.wsConfig, mat) val async = for { - message <- Future.fromTry(buildMessage(config.version, audit)) + message <- Future.fromTry( + buildMessage(config.version, audit).map( + _ + ("organisationId" -> JsString(organisation._id.toString)) + ("organisation" -> JsString(organisation.name)) + ) + ) _ = logger.debug(s"Request webhook with message $message") resp <- config.auth(ws.url(config.url)).post(message) } yield if (resp.status >= 400) logger.warn(s"Webhook call on ${config.url} returns ${resp.status} ${resp.statusText}") else ()