Source:
public EchoResponse.Void handle(Notification notification) { log.info("Building Microsoft Teams event notification"); String link; String message = notificationTemplateEngine.build(notification, NotificationTemplateEngine.Type.SUBJECT); String summary = notificationTemplateEngine.build(notification, NotificationTemplateEngine.Type.BODY); MicrosoftTeamsMessage teamsMessage = new MicrosoftTeamsMessage(summary, null); MicrosoftTeamsSection section = teamsMessage.createSection(null, "Event Notification"); section.setMessage(message); section.setSummary(summary); if (notification.getAdditionalContext().get("stageId") != null) { if (notification.getAdditionalContext().get("restrictExecutionDuringTimeWindow") != null) { link = spinnakerUrl + "/#/applications/" + notification.getSource().getApplication() + "/executions/details/" + notification.getSource().getExecutionId() + "?refId=" + notification.getAdditionalContext().get("stageId") + "&step=1"; } else { link = spinnakerUrl + "/#/applications/" + notification.getSource().getApplication() + "/executions/details/" + notification.getSource().getExecutionId() + "?refId=" + notification.getAdditionalContext().get("stageId"); } } else { link = spinnakerUrl + "/#/applications/" + notification.getSource().getApplication() + "/executions/details/" + notification.getSource().getExecutionId(); } if (notification.isInteractive()) { log.info("Notification is interactive"); section.setPotentialAction(null, notification.getInteractiveActions()); } else { section.setPotentialAction(link, null); } teamsMessage.addSection(section); for (String webhookUrl : notification.getTo()) { log.info("Sending Microsoft Teams event notification"); log.debug("Teams Webhook Url: " + webhookUrl); String baseUrl = "<LINK_0>"; String completeLink = webhookUrl; String partialWebhookURL = completeLink.substring(baseUrl.length()); teamsService.sendMessage(partialWebhookURL, teamsMessage); } return new EchoResponse.Void(); }

Target:
public EchoResponse.Void handle(Notification notification) { log.info("Building Microsoft Teams event notification"); String link = spinnakerUrl + "/#/applications/" + notification.getSource().getApplication() + "/executions/details/" + notification.getSource().getExecutionId(); String message = notificationTemplateEngine.build(notification, NotificationTemplateEngine.Type.SUBJECT); String summary = notificationTemplateEngine.build(notification, NotificationTemplateEngine.Type.BODY); MicrosoftTeamsMessage teamsMessage = new MicrosoftTeamsMessage(summary, null); MicrosoftTeamsSection section = teamsMessage.createSection(null, "Event Notification"); section.setMessage(message); section.setSummary(summary); if (notification.getAdditionalContext().get("stageId") != null) { link += "?refId=" + notification.getAdditionalContext().get("stageId"); if (notification.getAdditionalContext().get("restrictExecutionDuringTimeWindow") != null) { link += "&step=1"; } } if (notification.isInteractive()) { log.info("Notification is interactive"); section.setPotentialAction(null, notification.getInteractiveActions()); } else { section.setPotentialAction(link, null); } teamsMessage.addSection(section); for (String webhookUrl : notification.getTo()) { log.info("Sending Microsoft Teams event notification"); log.debug("Teams Webhook Url: " + webhookUrl); String baseUrl = "<LINK_0>"; String completeLink = webhookUrl; String partialWebhookURL = completeLink.substring(baseUrl.length()); teamsService.sendMessage(partialWebhookURL, teamsMessage); } return new EchoResponse.Void(); }