twiligo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccountSID    string
	Grants        []Grant
	Identity      *string
	SigningKeySID string
	Secret        string
	TTL           int
}

AccessToken holds the necessary important information for encoding a JWT to use with various Twilio services.

func NewAccessToken

func NewAccessToken(accountSID, signingKeySID, secret string, options NewAccessTokenOptions) AccessToken

NewAccessToken creates a new AccessToken with the given options.

func (*AccessToken) AddGrant

func (token *AccessToken) AddGrant(grant Grant)

AddGrant appends a given grant to the current AccessToken.

func (*AccessToken) String

func (token *AccessToken) String() string

func (*AccessToken) ToJWT

func (token *AccessToken) ToJWT() (string, error)

ToJWT converts the given AccessToken attributes into a properly encoded and signed JWT.

type AddPhoneNumberToProxyServiceOptions

type AddPhoneNumberToProxyServiceOptions struct {
	SID         string `url:"Sid,omitempty"`
	PhoneNumber string `url:",omitempty"`
	IsReserved  *bool  `url:",omitempty"`
}

AddPhoneNumberToProxyServiceOptions are all of the options that can be provided to a AddPhoneNumberToProxyService call.

type AvailablePhoneNumber

type AvailablePhoneNumber struct {
	AddressRequirements string `json:"address_requirements"`
	Beta                bool   `json:"beta"`
	Capabilities        struct {
		MMS   bool `json:"mms"`
		SMS   bool `json:"sms"`
		Voice bool `json:"voice"`
	} `json:"capabilities"`
	FriendlyName string `json:"friendly_name"`
	IsoCountry   string `json:"iso_country"`
	LATA         string `json:"lata"`
	Latitude     string `json:"latitude"`
	Locality     string `json:"locality"`
	Longitude    string `json:"longitude"`
	PhoneNumber  string `json:"phone_number"`
	PostalCode   string `json:"postal_code"`
	RateCenter   string `json:"rate_center"`
	Region       string `json:"region"`
}

AvailablePhoneNumber represents a Twilio phone number that is currently available to be purchased.

type AvailablePhoneNumbersResponse

type AvailablePhoneNumbersResponse struct {
	AvailablePhoneNumbers []*AvailablePhoneNumber `json:"available_phone_numbers"`
}

AvailablePhoneNumbersResponse is the representation of the JSON response from Twilio when looking up available phone numbers.

type ChatGrant

type ChatGrant struct {
	EndpointID        *string
	DeploymentRoleSID *string
	PushCredentialSID *string
	ServiceSID        *string
}

ChatGrant represents a specific type of Grant that is necessary to use Twilio's Programmable Chat.

func NewChatGrant

func NewChatGrant(options NewChatGrantOptions) ChatGrant

NewChatGrant creates a new ChatGrant with the given options.

func (ChatGrant) GetKey

func (grant ChatGrant) GetKey() string

GetKey returns the string identifier for the current grant.

func (ChatGrant) GetPayload

func (grant ChatGrant) GetPayload() map[string]string

GetPayload generates the full custom payload for the current grant.

type ChatService

type ChatService struct {
	AccountSID                   string    `json:"account_sid"`
	DateCreated                  time.Time `json:"date_created"`
	DateUpdated                  time.Time `json:"date_updated"`
	DefaultChannelCreatorRoleSID string    `json:"default_channel_creator_role_sid"`
	DefaultChannelRoleSID        string    `json:"default_channel_role_sid"`
	DefaultServiceRoleSID        string    `json:"default_service_role_sid"`
	FriendlyName                 string    `json:"friendly_name"`
	Limits                       struct {
		ChannelMembers int `json:"channel_members"`
		UserChannels   int `json:"user_channels"`
	} `json:"limits"`
	Links struct {
		Channels string `json:"channels"`
		Users    string `json:"users"`
		Roles    string `json:"roles"`
		Bindings string `json:"bindings"`
	} `json:"links"`
	Notifications struct {
		RemovedFromChannel struct {
			Enabled bool `json:"enabled"`
		} `json:"removed_from_channel"`
		LogEnabled     bool `json:"log_enabled"`
		AddedToChannel struct {
			Enabled bool `json:"enabled"`
		} `json:"added_to_channel"`
		NewMessage struct {
			Enabled bool `json:"enabled"`
		} `json:"new_message"`
		InvitedToChannel struct {
			Enabled bool `json:"enabled"`
		} `json:"invited_to_channel"`
	} `json:"notifications"`
	Media struct {
		SizeLimitMB        int    `json:"size_limit_mb"`
		CompabilityMessage string `json:"compatibility_message"`
	} `json:"media"`
	PostWebhookURL         *string   `json:"post_webhook_url"`
	PreWebhookURL          *string   `json:"pre_webhook_url"`
	PreWebhookRetryCount   int       `json:"pre_webhook_retry_count"`
	PostWebhookRetryCount  int       `json:"post_webhook_retry_count"`
	ReachabilityEnabled    bool      `json:"reachability_enabled"`
	ReadStatusEnabled      bool      `json:"read_status_enabled"`
	SID                    string    `json:"sid"`
	TypingIndicatorTimeout int       `json:"typing_indicator_timout"`
	URL                    string    `json:"url"`
	WebhookFilters         *[]string `json:"webhook_filters"`
	WebhookMethod          *string   `json:"webhook_method"`
}

ChatService represents a Twilio Chat service that owns one or more channels, users, messages, etc.

type ChatUser

type ChatUser struct {
	SID                 string    `json:"sid"`
	AccountSID          string    `json:"account_sid"`
	ServiceSID          string    `json:"service_sid"`
	RoleSID             string    `json:"role_sid"`
	Identity            string    `json:"identity"`
	Attributes          string    `json:"attributes"`
	IsOnline            *bool     `json:"is_online"`
	IsNotifiable        *bool     `json:"is_notifiable"`
	FriendlyName        *string   `json:"friendly_name"`
	JoinedChannelsCount int       `json:"joined_channels_count"`
	DateCreated         time.Time `json:"date_created"`
	DateUpdated         time.Time `json:"date_updated"`
	Links               struct {
		UserChannels string `json:"user_channels"`
		UserBindings string `json:"user_bindings"`
	} `json:"links"`
	URL string `json:"url"`
}

ChatUser represents a Twilio Chat user identified by their unique Identity property within Twilio.

type Conversation added in v0.2.0

type Conversation struct {
	SID                 string    `json:"sid"`
	AccountSID          string    `json:"account_sid"`
	ChatServiceSID      string    `json:"chat_service_sid"`
	MessagingServiceSID string    `json:"messaging_service_sid"`
	FriendlyName        *string   `json:"friendly_name"`
	Attributes          string    `json:"attributes"`
	DateCreated         time.Time `json:"date_created"`
	DateUpdated         time.Time `json:"date_updated"`
	State               string    `json:"state"`
	Timers              struct {
		DateInactive string `json:"date_inactive"`
		DateClosed   string `json:"date_closed"`
	} `json:"timers"`
	Links struct {
		Participants string `json:"participants"`
		Messages     string `json:"messages"`
		Webhooks     string `json:"webhooks"`
	} `json:"links"`
	URL string `json:"url"`
}

Conversation represents a Twilio conversation between two or more connected participants.

type ConversationOptions added in v0.2.0

type ConversationOptions struct {
	FriendlyName        string    `url:",omitempty"`
	DateCreated         time.Time `url:",omitempty"`
	DateUpdated         time.Time `url:",omitempty"`
	MessagingServiceSID string    `url:"MessagingServiceSid,omitempty"`
	Attributes          string    `url:",omitempty"`
	State               string    `url:",omitempty"`
	InactiveTimer       string    `url:"Timers.Inactive,omitempty"`
	ClosedTimer         string    `url:"Timers.Closed,omitempty"`
}

ConversationOptions are all of the options that can be provided to a CreateNewConversation call.

type CreateNewChatUserOptions

type CreateNewChatUserOptions struct {
	RoleSID      string `url:"RoleSid,omitempty"`
	Attributes   string `url:",omitempty"`
	FriendlyName string `url:",omitempty"`
}

CreateNewChatUserOptions are all of the options that can be provided to a CreateNewChatUser call.

type CreateNewIncomingPhoneNumberOptions

type CreateNewIncomingPhoneNumberOptions struct {
	AddressSID           string `url:",omitempty"`
	AreaCode             string `url:",omitempty"`
	BundleSID            string `url:",omitempty"`
	EmergencyAddressSID  string `url:",omitempty"`
	EmergencyStatus      string `url:",omitempty"`
	FriendlyName         string `url:",omitempty"`
	IdentitySID          string `url:",omitempty"`
	PhoneNumber          string `url:",omitempty"`
	SmsApplicationSID    string `url:",omitempty"`
	SmsFallbackMethod    string `url:",omitempty"`
	SmsFallbackURL       string `url:"SmsFallbackUrl,omitempty"`
	SmsMethod            string `url:",omitempty"`
	SmsURL               string `url:"SmsUrl,omitempty"`
	StatusCallback       string `url:",omitempty"`
	StatusCallbackMethod string `url:",omitempty"`
	TrunkSID             string `url:",omitempty"`
	VoiceApplicationSID  string `url:",omitempty"`
	VoiceFallbackMethod  string `url:",omitempty"`
	VoiceFallbackURL     string `url:"VoiceFallbackUrl,omitempty"`
	VoiceMethod          string `url:"VoiceMethod,omitempty"`
	VoiceReceiveMode     string `url:",omitempty"`
	VoiceURL             string `url:"VoiceUrl,omitempty"`
}

CreateNewIncomingPhoneNumberOptions are all of the options that can be provided to a CreateNewIncomingPhoneNumber call.

type CreateNewProxyServiceOptions

type CreateNewProxyServiceOptions struct {
	CallbackURL              string                   `url:"CallbackUrl,omitempty"`
	ChatInstanceSID          string                   `url:",omitempty"`
	DefaultTTL               int                      `url:"DefaultTtl,omitempty"`
	GeoMatchLevel            GeoMatchLevel            `url:",omitempty"`
	InterceptCallbackURL     string                   `url:"InterceptCallbackUrl,omitempty"`
	NumberSelectionBehaviour NumberSelectionBehaviour `url:",omitempty"`
	OutOfSessionCallbackURL  string                   `url:"OutOfSessionCallbackUrl,omitempty"`
}

CreateNewProxyServiceOptions are all of the options that can be provided to a CreateNewProxyService call.

type CreateNewSMSMessageOptions added in v0.2.1

type CreateNewSMSMessageOptions struct {
	Attempt             int    `url:"Attempt,omitempty"`
	From                string `url:"From,omitempty"`
	MessagingServiceSID string `url:"MessagingServiceSid,omitempty"`
	StatusCallback      string `url:"StatusCallback,omitempty"`
}

CreateNewSMSMessageOptions are all of the options that can be provided to a CreateNewSMSMessage call.

type Exception

type Exception struct {
	Status   int    `json:"status"`
	Message  string `json:"message"`
	Code     int    `json:"code"`
	MoreInfo string `json:"more_info"`
}

Exception represents an exception / bad response from the Twilio REST API.

func (Exception) Error

func (e Exception) Error() string

Error will print the current exception as a string.

type GeoMatchLevel

type GeoMatchLevel int

GeoMatchLevel is used to define what matching level a ProxyService should implement for any given phone number belonging to the ProxyService.

const (
	AreaCode GeoMatchLevel = iota + 1
	Country
	ExtendedAreaCode
)

This constant is used to represent the matching level for where a proxy number must be located relative to a given participant.

func (GeoMatchLevel) String

func (geo GeoMatchLevel) String() string

type GetAvailablePhoneNumberOptions

type GetAvailablePhoneNumberOptions struct {
	AreaCode                      int    `url:",omitempty"`
	Beta                          *bool  `url:",omitempty"`
	Contains                      string `url:",omitempty"`
	Distance                      int    `url:",omitempty"`
	ExcludeAllAddressRequired     *bool  `url:",omitempty"`
	ExcludeForeignAddressRequired *bool  `url:",omitempty"`
	ExcludeLocalAddressRequired   *bool  `url:",omitempty"`
	InLata                        string `url:",omitempty"`
	InLocality                    string `url:",omitempty"`
	InPostalCode                  string `url:",omitempty"`
	InRateCenter                  string `url:",omitempty"`
	InRegion                      string `url:",omitempty"`
	MmsEnabled                    *bool  `url:",omitempty"`
	NearLatLong                   string `url:",omitempty"`
	NearNumber                    string `url:",omitempty"`
	Page                          int    `url:",omitempty"`
	PageSize                      int    `url:",omitempty"`
	SmsEnabled                    *bool  `url:",omitempty"`
	VoiceEnabled                  *bool  `url:",omitempty"`
}

GetAvailablePhoneNumberOptions are all of the options that can be provided to a GetAvailablePhoneNumbers call.

type Grant

type Grant interface {
	GetKey() string
	GetPayload() map[string]string
}

Grant represents a type of permission that can be attached to an AccessToken.

type IncomingPhoneNumber

type IncomingPhoneNumber struct {
	AccountSID           string                          `json:"account_sid"`
	AddressRequirements  string                          `json:"address_requirements"`
	AddressSID           *string                         `json:"address_sid"`
	APIVersion           string                          `json:"api_version"`
	Beta                 bool                            `json:"beta"`
	BundleSID            *string                         `json:"bundle_sid"`
	Capabilities         IncomingPhoneNumberCapabilities `json:"capabilities"`
	DateCreated          dates.Rfc2822Time               `json:"date_created"`
	DateUpdated          dates.Rfc2822Time               `json:"date_updated"`
	EmergencyAddressSID  *string                         `json:"emergency_address_sid"`
	EmergencyStatus      string                          `json:"emergency_status"`
	FriendlyName         string                          `json:"friendly_name"`
	IdentitySID          *string                         `json:"identity_sid"`
	Origin               string                          `json:"origin"`
	PhoneNumber          string                          `json:"phone_number"`
	SID                  string                          `json:"sid"`
	SmsApplicationSID    *string                         `json:"sms_application_sid"`
	SmsFallbackMethod    string                          `json:"sms_fallback_method"`
	SmsFallbackURL       *string                         `json:"sms_fallback_url"`
	SmsMethod            string                          `json:"sms_method"`
	SmsURL               *string                         `json:"sms_url"`
	Status               string                          `json:"status"`
	StatusCallback       *string                         `json:"status_callback"`
	StatusCallbackMethod string                          `json:"status_callback_method"`
	TrunkSID             *string                         `json:"trunk_sid"`
	URI                  string                          `json:"uri"`
	VoiceApplicationSID  *string                         `json:"voice_application_sid"`
	VoiceCallerIDLookup  bool                            `json:"voice_caller_id_lookup"`
	VoiceFallbackMethod  string                          `json:"voice_fallback_method"`
	VoiceFallbackURL     *string                         `json:"voice_fallback_url"`
	VoiceMethod          string                          `json:"voice_method"`
	VoiceReceiveMode     string                          `json:"voice_receive_mode"`
	VoiceURL             *string                         `json:"voice_url"`
}

IncomingPhoneNumber represents a phone number purchased from Twilio.

type IncomingPhoneNumberCapabilities

type IncomingPhoneNumberCapabilities struct {
	MMS   bool `json:"mms"`
	SMS   bool `json:"sms"`
	Voice bool `json:"voice"`
}

IncomingPhoneNumberCapabilities describes the capabilities afforded to a given IncomingPhoneNumber according to Twilio.

type Message added in v0.2.1

type Message struct {
	SID                 string             `json:"sid"`
	AccountSID          string             `json:"account_sid"`
	APIVersion          string             `json:"api_version"`
	Body                string             `json:"body"`
	DateCreated         dates.Rfc2822Time  `json:"date_created"`
	DateSent            *dates.Rfc2822Time `json:"date_sent"`
	DateUpdated         dates.Rfc2822Time  `json:"date_updated"`
	Direction           MessageDirection   `json:"direction"`
	ErrorCode           *int               `json:"error_code"`
	ErrorDescription    *string            `json:"error_message"`
	From                string             `json:"from"`
	MessagingServiceSID *string            `json:"messaging_service_sid"`
	NumMedia            string             `json:"num_media"`
	NumSegments         string             `json:"num_segments"`
	Price               *string            `json:"price"`
	PriceUnit           *string            `json:"price_unit"`
	Status              MessageStatus      `json:"status"`
	SubresourceURIs     struct {
		Media string `json:"media"`
	} `json:"subresource_uris"`
	To  string `json:"to"`
	URI string `json:"uri"`
}

Message represents any given type of message from Twilio.

type MessageDirection added in v0.2.1

type MessageDirection int

MessageDirection is used to define the direction that a particular Message was sent.

const (
	Inbound MessageDirection = iota
	OutboundAPI
	OutboundCall
	OutboundReply
)

This constant is used to represent the direction that a particular Message was sent.

func ConvertDirectionToMessageDirection added in v0.3.0

func ConvertDirectionToMessageDirection(direction string) MessageDirection

ConvertDirectionToMessageDirection ...

func (MessageDirection) String added in v0.2.1

func (direction MessageDirection) String() string

type MessageStatus added in v0.2.1

type MessageStatus int

MessageStatus is used to define the current status of a particular Message.

const (
	Accepted MessageStatus = iota
	Queued
	Sending
	Sent
	Failed
	Delivered
	Undelivered
	Receiving
	Received
)

This constant is used to represent the status of a particular Message.

func ConvertStatusToMessageStatus added in v0.3.0

func ConvertStatusToMessageStatus(status string) MessageStatus

ConvertStatusToMessageStatus ...

func (MessageStatus) String added in v0.2.1

func (status MessageStatus) String() string

type NewAccessTokenOptions

type NewAccessTokenOptions struct {
	Identity *string
	TTL      *int
}

NewAccessTokenOptions represents the possible options that can be provided to a new AccessToken.

type NewChatGrantOptions

type NewChatGrantOptions struct {
	EndpointID        *string
	DeploymentRoleSID *string
	PushCredentialSID *string
	ServiceSID        *string
}

NewChatGrantOptions represents the possible options that can be provided to a new ChatGrant.

type NumberSelectionBehaviour

type NumberSelectionBehaviour int

NumberSelectionBehaviour is used to define what number selection behaviour a ProxyService should implement for any given phone number belonging to the ProxyService.

const (
	AvoidSticky NumberSelectionBehaviour = iota + 1
	PreferSticky
)

This constant is used to represent the type of number selection behaviour that the ProxyService should utilize.

func (NumberSelectionBehaviour) String

func (number NumberSelectionBehaviour) String() string

type PhoneNumberType

type PhoneNumberType int

PhoneNumberType is used to define whether a phone number is local, toll-free or mobile.

const (
	Local PhoneNumberType = iota
	TollFree
	Mobile
)

This constant is used to represent a type of phone number to look up from Twilio.

func GetPhoneNumberType

func GetPhoneNumberType(number int, country string) PhoneNumberType

GetPhoneNumberType will convert a given integer into a PhoneNumberType by the given country. Certain countries do not support all PhoneNumberType values, so this function can be used as a safe mapping based on the values from this document https://support.twilio.com/hc/en-us/articles/223183068-Twilio-international-phone-number-availability-and-their-capabilities. Note: Not all cases are currently supported, but can be amended as necessary.

func (PhoneNumberType) String

func (number PhoneNumberType) String() string

type ProxyPhoneNumber

type ProxyPhoneNumber struct {
	SID          string                       `json:"sid"`
	AccountSID   string                       `json:"account_sid"`
	ServiceSID   string                       `json:"service_sid"`
	DateCreated  time.Time                    `json:"date_created"`
	DateUpdated  time.Time                    `json:"date_updated"`
	PhoneNumber  string                       `json:"phone_number"`
	FriendlyName string                       `json:"friendly_name"`
	IsoCountry   string                       `json:"iso_country"`
	Capabilities ProxyPhoneNumberCapabilities `json:"capabilities"`
	URL          string                       `json:"url"`
	IsReserved   bool                         `json:"is_reserved"`
	InUse        int                          `json:"in_use"`
}

ProxyPhoneNumber represents an IncomingPhoneNumber that has been attached to a ProxyService within Twilio.

type ProxyPhoneNumberCapabilities

type ProxyPhoneNumberCapabilities struct {
	MMSInbound    bool `json:"mms_inbound"`
	MMSOutbound   bool `json:"mms_outbound"`
	SMSInbound    bool `json:"sms_inbound"`
	SMSOutbound   bool `json:"sms_outbound"`
	VoiceInbound  bool `json:"voice_inbound"`
	VoiceOutbound bool `json:"voice_outbound"`
}

ProxyPhoneNumberCapabilities describes the capabilities afforded to a given ProxyPhoneNumber according to Twilio.

type ProxyService

type ProxyService struct {
	SID                      string    `json:"sid"`
	AccountSID               string    `json:"account_sid"`
	ChatInstanceSID          *string   `json:"chat_instance_sid"`
	UniqueName               string    `json:"unique_name"`
	DefaultTTL               int       `json:"default_ttl"`
	CallbackURL              *string   `json:"callback_url"`
	GeoMatchLevel            string    `json:"geo_match_level"`
	NumberSelectionBehaviour string    `json:"number_selection_behaviour"`
	InterceptCallbackURL     *string   `json:"intercept_callback_url"`
	OutOfSessionCallbackURL  *string   `json:"out_of_session_callback_url"`
	DateCreated              time.Time `json:"date_created"`
	DateUpdated              time.Time `json:"date_updated"`
	URL                      string    `json:"url"`
	Links                    struct {
		Sessions     string `json:"sessions"`
		PhoneNumbers string `json:"phone_numbers"`
		ShortCodes   string `json:"short_codes"`
	} `json:"links"`
}

ProxyService represents a Twilio Proxy Service that owns one or more proxy phone numbers, sessions, etc.

type SmsWebhook added in v0.1.1

type SmsWebhook struct {
	AccountSID    string `json:"AccountSID"`
	APIVersion    string `json:"ApiVersion"`
	Body          string `json:"Body"`
	From          string `json:"From"`
	FromCity      string `json:"FromCity"`
	FromCountry   string `json:"FromCountry"`
	FromState     string `json:"FromState"`
	FromZip       string `json:"FromZip"`
	MessageSID    string `json:"MessageSid"`
	NumMedia      string `json:"NumMedia"`
	NumSegments   string `json:"NumSegments"`
	SmsMessageSID string `json:"SmsMessageSid"`
	SmsSID        string `json:"SmsSid"`
	SmsStatus     string `json:"SmsStatus"`
	To            string `json:"To"`
	ToCountry     string `json:"ToCountry"`
	ToCity        string `json:"ToCity"`
	ToState       string `json:"ToState"`
	ToZip         string `json:"ToZip"`
}

SmsWebhook represents the response structure sent from Twilio for incoming SMS webhooks.

type Twilio

type Twilio struct {
	AccountSID string
	AuthToken  string
	HTTPClient *http.Client
}

Twilio holds the necessary important information for connecting to the Twilio REST API.

func New

func New(accountSID, authToken string) *Twilio

New creates a new instance of Twilio using the given Account SID and Auth Token.

func NewCustomClient

func NewCustomClient(accountSID, authToken string, HTTPClient *http.Client) *Twilio

NewCustomClient creates a new instance of Twilio using the given Account SID, Auth Token and HTTP Client.

func (*Twilio) AddPhoneNumberToProxyService

func (twilio *Twilio) AddPhoneNumberToProxyService(serviceSID string, options AddPhoneNumberToProxyServiceOptions) (*ProxyPhoneNumber, error)

AddPhoneNumberToProxyService attaches a phone number to the given proxy service in Twilio.

func (*Twilio) CheckSignature added in v0.1.1

func (twilio *Twilio) CheckSignature(r *http.Request, baseURL string) (bool, error)

CheckSignature checks that the X-Twilio-Signature header on a request matches the expected signature defined by GenerateSignature.

func (*Twilio) CreateNewChatService

func (twilio *Twilio) CreateNewChatService(name string) (*ChatService, error)

CreateNewChatService creates a new chat service in Twilio.

func (*Twilio) CreateNewChatUser

func (twilio *Twilio) CreateNewChatUser(identity, serviceSID string, options CreateNewChatUserOptions) (*ChatUser, error)

CreateNewChatUser creates a new chat user for the given chat service in Twilio.

func (*Twilio) CreateNewConversation added in v0.2.0

func (twilio *Twilio) CreateNewConversation(options ConversationOptions) (*Conversation, error)

CreateNewConversation creates a new Conversation in Twilio with the provided options.

func (*Twilio) CreateNewIncomingPhoneNumber

func (twilio *Twilio) CreateNewIncomingPhoneNumber(options CreateNewIncomingPhoneNumberOptions) (*IncomingPhoneNumber, error)

CreateNewIncomingPhoneNumber purchases a new phone number in Twilio.

func (*Twilio) CreateNewProxyService

func (twilio *Twilio) CreateNewProxyService(name string, options CreateNewProxyServiceOptions) (*ProxyService, error)

CreateNewProxyService creates a new proxy service in Twilio.

func (*Twilio) CreateNewSMSMessage added in v0.2.1

func (twilio *Twilio) CreateNewSMSMessage(to, body string, options CreateNewSMSMessageOptions) (*Message, error)

CreateNewSMSMessage sends an SMS message through Twilio using the given parameters.

func (*Twilio) DeleteConversation added in v0.2.0

func (twilio *Twilio) DeleteConversation(conversationSID string) error

DeleteConversation will completely remove the conversation matching the given identifier from within Twilio.

func (*Twilio) DeleteIncomingPhoneNumber

func (twilio *Twilio) DeleteIncomingPhoneNumber(phoneNumberSID string) error

DeleteIncomingPhoneNumber will release an existing IncomingPhoneNumber from Twilio.

func (*Twilio) GenerateSignature added in v0.1.1

func (twilio *Twilio) GenerateSignature(uri string, values url.Values) ([]byte, error)

GenerateSignature computes the Twilio signature for verifying the authenticity of a request. It is based on the specification at https://www.twilio.com/docs/security#validating-requests.

func (*Twilio) GetAvailablePhoneNumbers

func (twilio *Twilio) GetAvailablePhoneNumbers(country string, number PhoneNumberType, options GetAvailablePhoneNumberOptions) ([]*AvailablePhoneNumber, error)

GetAvailablePhoneNumbers retrieves a listing of available phone numbers from Twilio.

func (*Twilio) RemovePhoneNumberFromProxyService

func (twilio *Twilio) RemovePhoneNumberFromProxyService(serviceSID, phoneNumberSID string) error

RemovePhoneNumberFromProxyService remove the given IncomingPhoneNumber from the given ProxyService within Twilio.

func (*Twilio) UpdateConversation added in v0.2.0

func (twilio *Twilio) UpdateConversation(conversationSID string, options ConversationOptions) (*Conversation, error)

UpdateConversation will update an existing conversation in Twilio based on the provided identifier and options.

Jump to

Keyboard shortcuts

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