Documentation ¶
Index ¶
Constants ¶
const ( // SenderIDSMSAttribute a custom name that's displayed as the message sender on the receiving device. SenderIDSMSAttribute = "AWS.SNS.SMS.SenderID" // MaxPriceSMSAttribute a maximum price in USD that you are willing to pay to send the message. MaxPriceSMSAttribute = "AWS.SNS.SMS.MaxPrice" // MessageTypeSMSAttribute a SMS type, can be either Promotional or Transactional. MessageTypeSMSAttribute = "AWS.SNS.SMS.MessageType" // Promotional message type used for promotional purposes that are noncritical, won't be delivered // to DND (Do Not Disturb) numbers. Promotional MessageType = "Promotional" // Transactional message type used for transactional purposes which includes critical messages as multi-factor // authentication. This message type might be more expensive than Promotional message type. Will be delivered to // to DND numbers. Transactional MessageType = "Transactional" )
Variables ¶
This section is empty.
Functions ¶
func GetMessageAttributes ¶
func GetMessageAttributes(c *Config) map[string]*sns.MessageAttributeValue
GetMessageAttributes returns message attributes map based on the given config
Types ¶
type Config ¶
type Config struct { AWSAccessKey string `yaml:"aws_access_key"` AWSSecretAccessKey string `yaml:"aws_secret_access_key"` AWSRegion string `yaml:"aws_region"` SenderID *string `yaml:"sender_id,omitempty"` MaxPrice *float32 `yaml:"max_price,omitempty"` MessageType *string `yaml:"message_type,omitempty"` }
Config sender configuration
type MessageType ¶
type MessageType string
MessageType SNS SMS type
func (MessageType) IsValid ¶
func (mt MessageType) IsValid() bool
IsValid returns true if the message type is either transactional or promotional used to validate that a valid message type is being provided.
func (MessageType) String ¶
func (mt MessageType) String() string
String returns message type string value
type Sender ¶
type Sender struct { MessageAttributes map[string]*sns.MessageAttributeValue // contains filtered or unexported fields }
Sender used to send text messages using AWS SNS
func NewWithSNS ¶
NewWithSNS initialise sender with custom SNS
func (*Sender) WithMaxPrice ¶
WithMaxPrice sets the max price in USD that you are willing to pay to send a single text message
func (*Sender) WithMessageType ¶
func (s *Sender) WithMessageType(t MessageType) *Sender
WithMessageType sets the message type. The message type will be set only when message type is either transactional or promotional.
func (*Sender) WithSenderID ¶
WithSenderID will include a sender ID in the sent text message. Sender ID won't be set when the provided ID contains only whitespaces, to avoid making a request with a bad SMS attribute.