 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package sms defines interfaces for sending SMS text messages.
Although exported, this package is non intended for general consumption. It is a shared dependency between multiple exposure notifications projects. We cannot guarantee that there won't be breaking changes in the future.
Index ¶
Constants ¶
const TwilioMessagingServiceSidPrefix = "MG"
    TwilioMessagingServiceSidPrefix is the prefix for a 34 character messaging service identifier
Variables ¶
var ErrNoop error = errors.New("noop always fails")
    ErrNoop is the error NoopFail always returns.
Functions ¶
func IsSMSQueueFull ¶ added in v0.20.0
IsSMSQueueFull returns if the given error is Twilio's message queue full error.
func IsTwilioCode ¶ added in v0.20.0
IsTwilioCode returns if the given error matches a Twilio error code.
Types ¶
type Config ¶
type Config struct {
	ProviderType ProviderType
	// Twilio options
	TwilioAccountSid string
	TwilioAuthToken  string
	TwilioFromNumber string
}
    Config represents configuration for an SMS provider.
type Provider ¶
type Provider interface {
	// SendSMS sends an SMS text message from the given number to the given number
	// with the provided message.
	SendSMS(ctx context.Context, to, message string) error
}
    func NewNoopFail ¶ added in v0.19.0
NewNoopFail creates a new SMS sender that only returns ErrNoop.
type ProviderType ¶
type ProviderType string
ProviderType represents a type of SMS provider.
const ( ProviderTypeNoop ProviderType = "NOOP" ProviderTypeNoopFail ProviderType = "NOOP_FAIL" ProviderTypeTwilio ProviderType = "TWILIO" )
type Twilio ¶
type Twilio struct {
	// contains filtered or unexported fields
}
    Twilio sends messages via the Twilio API.
type TwilioError ¶
TwilioError represents an error returned from the Twilio API.
func (*TwilioError) Error ¶
func (e *TwilioError) Error() string