in dev/src/main/scala/com/gu/anghammarad/Main.scala [17:36]
def sendNotificationUsingService(notification: Notification, stage: String): Unit = {
val logger: Logger = LoggerFactory.getLogger(this.getClass)
val sentMessages = for {
config <- Config.loadConfig(stage)
configuration <- Serialization.parseConfig(config)
sent <- AnghammaradService.run(notification, configuration)
} yield sent
sentMessages match {
case Failure(err) =>
logger.error("Failed to send notification", err)
case Success(sent) =>
sent.map {
case (_, EmailAddress(email)) => s"Email: $email"
case (_, HangoutsRoom(webhook)) => s"Hangouts webhook: $webhook"
}
logger.info(s"sent notification ${sent.mkString(",")}")
}
}