go-notify is a small Go interface that allows types to implement notifications.
client := slack.New(slackToken)
svc := notify.NewSlackService(client)
client := ses.New(session.New(&aws.Config{Region: aws.String("us-west-2")}))
svc := notify.NewSESService(sesClient)
slackInputParams := ¬ify.SlackNotifyInput{
Channel: "mychannel",
PostMessageParams: slack.PostMessageParameters{
Username: "mybot",
Markdown: true,
},
Message: result.String(),
}
if err := svc.Notify(slackInputParams); err != nil {
log.Fatalf("could not call notify on slack service: %v", err)
}
sesInputParams := ¬ify.SESNotifyInput{
From: "[email protected]",
Subject: "subject",
To: []string{"[email protected]"},
Message: msg.String(),
}
if err := sesSVC.Notify(sesInputParams); err != nil {
log.Fatalf("count not call notify on ses service: %v", err)
}