in anghammarad/src/main/scala/com/gu/anghammarad/AnghammaradService.scala [11:24]
def run(notification: Notification, config: Configuration): Try[List[(Message, Contact)]] = {
// resolve targets
for {
contacts <- Contacts.resolveTargetContacts(notification.target, config.mappings)
// get contacts for desired channels (if possible)
channelContacts <- Contacts.resolveContactsForChannels(contacts, notification.channel)
// find contacts for each message
contacts <- Contacts.contactsForMessage(notification.channel, channelContacts)
// address messages
toSend = Messages.createMessages(notification, contacts)
// send resolved notifications
result <- SendMessages.sendAll(config, toSend)
} yield toSend
}