sms

package module
v0.0.0-...-e11c16a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2016 License: MIT Imports: 5 Imported by: 0

README

go-sms

Package sms provides a small wrapper around AWS SNS to make SMS usage less obscure, conflating APIs FTW.

Example

sms.Send("Hello World", "+19999999999")

Running Tests

First export the PHONE environment variable to test against your number, and set your AWS credentials via the AWS_* environment variables.

Badges

GoDoc


tjholowaychuk.com  ·  GitHub @tj  ·  Twitter @tjholowaychuk

Documentation

Overview

Package sms provides a small wrapper around AWS SNS SMS support.

Example

Example showing the most basic usage and defaults.

sms.Send("Hello World", env.MustGet("PHONE"))
Output:

Example (Overrides)

Example showing how to override the defaults unless you want to go all-out and use the SMS struct directly.

sms.DefaultMaxPrice = 0.5
sms.DefaultType = sms.Transactional
sms.Send("Hello World", env.MustGet("PHONE"))
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	DefaultMaxPrice = 0.01
	DefaultType     = Promotional
)

Defaults.

Functions

func Send

func Send(message, number string) error

Send `message` to `number` using defaults.

Types

type SMS

type SMS struct {
	Service  snsiface.SNSAPI // Service implementation
	SenderID string          // SenderID (optional)
	Type     Type            // Type of SMS delivery mode
	MaxPrice float64         // MaxPrice (defaults to $0.01)
}

SMS configures an SNS SMS client.

func (*SMS) Send

func (s *SMS) Send(message, number string) error

Send `message` to `number`.

type Type

type Type string

Type of SMS delivery mode.

const (
	// Promotional are non-critical messages, such as marketing messages.
	// Amazon SNS optimizes the message delivery to incur the lowest cost.
	Promotional Type = "Promotional"

	// Transactional messages are critical messages that support
	// customer transactions, such as one-time passcodes for multi-factor authentication.
	// Amazon SNS optimizes the message delivery to achieve the highest reliability.
	Transactional = "Transactional"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL