twilio

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Client Client
	Number string
	// contains filtered or unexported fields
}

Channel contains a Twilio client and number

func New

func New(config Config) *Channel

New returns an initialized telegram client

func (*Channel) ReceiveMessage

func (c *Channel) ReceiveMessage(body []byte) (*messages.Receive, error)

ReceiveMessage for Twilio

func (*Channel) ReceiveMessages

func (c *Channel) ReceiveMessages(receiveChan chan messages.Receive)

ReceiveMessages uses event queues to receive messages. Starts a long running process

func (*Channel) SendMessage

func (c *Channel) SendMessage(response *messages.Response) error

SendMessage for Twilio

func (*Channel) String added in v0.6.2

func (c *Channel) String() string

func (*Channel) ValidateCallback added in v0.6.0

func (c *Channel) ValidateCallback(r *http.Request) bool

ValidateCallback validates a callback to the channel

type Client

type Client interface {
	SendMessage(from string, to string, body string, mediaURLs []*url.URL) (*twilio.Message, error)
}

Client is the twilio client interface

type Config

type Config struct {
	AccountSid string        `mapstructure:"account_sid"`
	AuthToken  string        `mapstructure:"auth_token"`
	Number     string        `mapstructure:"number"`
	Delay      time.Duration `mapstructure:"delay"`
}

Config models Twilio configuration

type MessageIn

type MessageIn struct {
	From             string `form:"From"`
	Body             string `form:"Body"`
	To               string `form:"To"`
	MediaURL         string `form:"MediaUrl"`
	MediaContentType string `form:"MediaContentType"`
	MessageSid       string `form:"MessageSid"`
	SmsStatus        string `form:"SmsStatus"`
	AccountSid       string `form:"AccountSid"`
	Sid              string `form:"Sid"`
	SmsSid           string `form:"SmsSid"`
	SmsMessageSid    string `form:"SmsMessageSid"`
	NumMedia         int    `form:"NumMedia"`
	NumSegments      int    `form:"NumSegments"`
	APIVersion       string `form:"ApiVersion"`
	ProfileName      string `form:"ProfileName"`
	WaID             string `form:"WaId"`
}

MessageIn models an incoming Twilio message

Directories

Path Synopsis
Package mocktwilio is a generated GoMock package.
Package mocktwilio is a generated GoMock package.

Jump to

Keyboard shortcuts

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