Documentation
¶
Overview ¶
Package sms defines a provider-agnostic Sender interface for transactional SMS and the value types that flow through it.
The interface is intentionally narrow. It covers the fields every major provider (Twilio, Vonage, MessageBird, AWS SNS, Plivo) supports: a sender, a recipient, and a text body. Provider-specific features (alphanumeric sender IDs, MMS media, delivery callbacks, messaging services) live in your app's own adapter code — not in this interface.
Typical wiring:
var sender sms.Sender
if os.Getenv("SMS_MOCK") == "true" {
sender = smsmock.New(os.Getenv("HAMR_DEV_URL"))
} else {
sender = myapp.NewTwilioSender(twilioSID, twilioToken)
}
Both the mock and any real adapter satisfy sms.Sender, so the rest of the app depends only on this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
From string // sender: E.164 number ("+15551230000") or short code
To string // recipient: E.164 number
Body string // message text
Ref string // correlation reference (Vonage client-ref, MessageBird reference); adapters for providers without one may ignore it
}
Message is the input to Sender.Send.
Click to show internal directories.
Click to hide internal directories.