svc

package
v0.0.0-...-b576ace Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ReceivedMessageFeed = "handle_received_message"

ReceivedMessageFeed is the feed name for handling received messages

View Source
const SendSMSFeed = "send_twilio_sms"

SendSMSFeed is the feed name for sending a Twilio SMS message

View Source
const SentMessageFeed = "handle_sent_message"

SentMessageFeed is the feed name for handling sent messages

Variables

This section is empty.

Functions

This section is empty.

Types

type SNS

type SNS interface {
	Publish(string, string, string) error
}

SNS is an interface for the SNSClient and associated mock

type SNSClient

type SNSClient struct {
	Client *sns.SNS
}

SNSClient implements SNS for a generic way of managing the SNS service

func NewSNSClient

func NewSNSClient() *SNSClient

NewSNSClient creates an SNSClient object

func (*SNSClient) Publish

func (c *SNSClient) Publish(message string, topicArn string, feed string) error

Publish sends a message to a given topic and feed

type TwilioChat

type TwilioChat struct {
	Client  TwilioClient
	From    string // The Twilio automated number
	To      string // The user sending SMS
	Channel string // TODO: Should be SMS, MMS, WhatsApp?
}

TwilioChat implements the chat.Provider interface for Twilio messaging

func NewTwilioChat

func NewTwilioChat(client TwilioClient, from, to string) *TwilioChat

NewTwilioChat is a constructor for Twilio Chat structs

func (*TwilioChat) CheckSignature

func (c *TwilioChat) CheckSignature(url, signature string, values url.Values) (bool, error)

func (*TwilioChat) HandleSMSWebhook

func (c *TwilioChat) HandleSMSWebhook(data gotwilio.SMSWebhook) (chat.Message, error)

HandleSMSWebhook manages incoming SMS webhooks and converts them to chat.Message structs

func (*TwilioChat) SendSMS

func (c *TwilioChat) SendSMS(body string) (*gotwilio.SmsResponse, *gotwilio.Exception, error)

type TwilioClient

type TwilioClient interface {
	SendSMS(string, string, string, string, string) (*gotwilio.SmsResponse, *gotwilio.Exception, error)
	GenerateSignature(string, url.Values) ([]byte, error)
}

TwilioClient generalizes access to Twilio

Jump to

Keyboard shortcuts

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