- Send emails via AWS SNS
package main
import (
"context"
sms "github.com/gofor-little/aws-sms"
)
func main() {
// Initialize the SMS package.
if err := sms.Initialize("AWS_PROFILE", "AWS_REGION"); err != nil {
panic(err)
}
// Build the SMS data.
data := sms.Data{
SenderID: "ExampleApp",
PhoneNumber: "+61412345678",
Message: "Example Message",
}
// Send the SMS message.
if _, err := sms.Send(context.Background(), data); err != nil {
panic(err)
}
}
Ensure the following environment variables are set, usually with a .env file.
AWS_PROFILE
(an AWS CLI profile name)AWS_REGION
(a valid AWS region)TEST_SMS_RECIPIENTS
(a comma separated list of valid phone numbers including country code)