fsmtwilio

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

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

Go to latest
Published: Oct 5, 2017 License: MIT Imports: 21 Imported by: 0

README

Go Carrot

FSM Twilio

A Twilio SMS/MMS target for go-carrot/fsm.

Environment Variables

When using this target, you must set three environment variables:

TWILIO_ACCOUNT_SID=""
TWILIO_AUTH_TOKEN=""
TWILIO_NUMBER="" # +15558675309

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ACCOUNT_SID   = os.Getenv("TWILIO_ACCOUNT_SID")
	AUTH_TOKEN    = os.Getenv("TWILIO_AUTH_TOKEN")
	TWILIO_NUMBER = os.Getenv("TWILIO_NUMBER")

	ErrDeliveryFailed = errors.New("Message failed to send")
	ErrUndelivered    = errors.New("Message was not delivered")
)

Functions

func IncomingMessage

func IncomingMessage(store fsm.Store, stateMachine fsm.StateMachine, startState string) func(http.ResponseWriter, *http.Request)

func Start

func Start(stateMachine fsm.StateMachine, startState string)

Types

type CacheStore

type CacheStore struct {
	Traversers map[string]fsm.Traverser
}

func (*CacheStore) CreateTraverser

func (s *CacheStore) CreateTraverser(uuid string) (fsm.Traverser, error)

func (*CacheStore) FetchTraverser

func (s *CacheStore) FetchTraverser(uuid string) (fsm.Traverser, error)

type CachedTraverser

type CachedTraverser struct {
	Data map[string]interface{}
	// contains filtered or unexported fields
}

func (*CachedTraverser) CurrentState

func (c *CachedTraverser) CurrentState() string

func (*CachedTraverser) Delete

func (c *CachedTraverser) Delete(key string) error

func (*CachedTraverser) Fetch

func (c *CachedTraverser) Fetch(key string) (interface{}, error)

func (*CachedTraverser) SetCurrentState

func (c *CachedTraverser) SetCurrentState(newState string)

func (*CachedTraverser) SetUUID

func (c *CachedTraverser) SetUUID(newUUID string)

func (*CachedTraverser) UUID

func (c *CachedTraverser) UUID() string

func (*CachedTraverser) Upsert

func (c *CachedTraverser) Upsert(key string, value interface{}) error

type Message

type Message struct {
	Sid                 string          `xml:"Sid"`
	DateCreated         string          `xml:"DateCreated"`
	DateUpdated         string          `xml:"DateUpdated"`
	DateSent            string          `xml:"DateSent"`
	AccountSid          string          `xml:"AccountSid"`
	To                  string          `xml:"To"`
	From                string          `xml:"From"`
	MessagingServiceSid string          `xml:"MessagingServiceSid"`
	Body                string          `xml:"Body"`
	Status              string          `xml:"Status"`
	NumSegments         string          `xml:"NumSegments"`
	NumMedia            string          `xml:"NumMedia"`
	Direction           string          `xml:"Direction"`
	APIVersion          string          `xml:"ApiVersion"`
	Price               string          `xml:"Price"`
	PriceUnit           string          `xml:"PriceUnit"`
	ErrorCode           string          `xml:"ErrorCode"`
	ErrorMessage        string          `xml:"ErrorMessage"`
	URI                 string          `xml:"Uri"`
	SubresourceUris     SubresourceUris `xml:"SubresourceUris"`
}

type MessageReceivedCallback

type MessageReceivedCallback struct {
	ApiVersion string
	AccountSid string

	NumSegments int
	NumMedia    string

	MessageSid          string
	MessagingServiceSid string

	SmsMessageSid string
	SmsSid        string
	SmsStatus     string

	ToCountry string
	ToState   string
	ToCity    string
	ToZip     string

	FromCountry string
	FromState   string
	FromCity    string
	FromZip     string

	To   string
	From string
	Body string
}

type MessageSentCallback

type MessageSentCallback struct {
	Message Message `xml:"Message"`
}

type SubresourceUris

type SubresourceUris struct {
	Media string `xml:"Media"`
}

type TwilioEmitter

type TwilioEmitter struct {
	UUID string
}

func (*TwilioEmitter) Emit

func (t *TwilioEmitter) Emit(i interface{}) error

Jump to

Keyboard shortcuts

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