sms

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidResponseData = errors.New("invalid SIBResponseData")
	ErrInvalidMessageID    = errors.New("message-id field is not a string")
	ErrInvalidData         = errors.New("unable to convert data to map[string]interface{}")
)

Functions

func InitSMS

func InitSMS(c *config.SMS)

func IsInitialized

func IsInitialized() bool

func SendErrors

func SendErrors(errs []error, service string)

func SendResolvedNotification

func SendResolvedNotification(service string)

func SendSIB

func SendSIB(smsArr []*SendInBlueSMS)

func SendTwilioSMS

func SendTwilioSMS(sms []*TwilioSMS)

Types

type SIBResponseData

type SIBResponseData struct {
	Status          string            `json:"status"`
	Message         string            `json:"message"`
	NumberSent      int               `json:"number_sent"`
	SMSCount        int               `json:"sms_count"`
	ErrorCode       int               `json:"error_code"`
	CreditsUsed     float64           `json:"credits_used"`
	To              string            `json:"to"`
	Reply           string            `json:"reply"`
	Description     string            `json:"description"`
	BounceType      string            `json:"bounce_type"`
	Reference       map[string]string `json:"reference"`
	RemainingCredit float64           `json:"remaining_credit"`
}

type SendInBlueResponse

type SendInBlueResponse struct {
	Code    string      `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

SendInblue JSON response from the server.

func (*SendInBlueResponse) GetMessageId

func (s *SendInBlueResponse) GetMessageId() (string, error)

GetMessageId retrieves the sendinblue message-id.

func (*SendInBlueResponse) GetSIBResponseData

func (s *SendInBlueResponse) GetSIBResponseData() (*SIBResponseData, error)

GetSIBResponseData retrieves the sendinblue API response.

type SendInBlueSMS

type SendInBlueSMS struct {

	// required fields
	From    string `json:"sender"`
	To      string `json:"recipient"`
	Content string `json:"content"`

	// optional fields
	Tag  string `json:"tag"`
	Type string `json:"type"`
	URL  string `json:"URL"`
}

V3 API https://developers.sendinblue.com/docs

func GenerateSIBErrorSMS

func GenerateSIBErrorSMS(errs []error, service string) []*SendInBlueSMS

func GenerateSIBResolvedSMS

func GenerateSIBResolvedSMS(service string) []*SendInBlueSMS

type TwilioSMS

type TwilioSMS struct {
	To   string
	Body string
}

func GenerateTwilioErrorSMS

func GenerateTwilioErrorSMS(errs []error, service string) []*TwilioSMS

func GenerateTwilioResolvedSMS

func GenerateTwilioResolvedSMS(service string) []*TwilioSMS

Jump to

Keyboard shortcuts

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