twilio

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TwilioWhatsappSIDEnvVarName = "TWILIO_WHATSAPP_SID"

	TwilioWhatsappSenderEnvVarName = "TWILIO_WHATSAPP_SENDER"
)

TODO: check if this will be an alternative to inaccessible fields from the services

Functions

This section is empty.

Types

type ImplTwilio

type ImplTwilio struct {
	WhatsappAccountSID string
	Sender             string
	// contains filtered or unexported fields
}

ImplTwilio is the twilio service implementation

func NewImplTwilio

func NewImplTwilio(
	infrastructure infrastructure.Interactor,
) *ImplTwilio

NewImplTwilio initializes a twilio service instance

func (*ImplTwilio) MakeTwilioRequest added in v0.0.25

func (t *ImplTwilio) MakeTwilioRequest(
	method string,
	urlPath string,
	content url.Values,
	target interface{},
) error

MakeTwilioRequest makes a twilio request

func (*ImplTwilio) MakeWhatsappTwilioRequest added in v0.0.25

func (t *ImplTwilio) MakeWhatsappTwilioRequest(
	ctx context.Context,
	method string,
	urlPath string,
	content url.Values,
	target interface{},
) error

MakeWhatsappTwilioRequest makes a twilio request

func (*ImplTwilio) PhoneNumberVerificationCode

func (t *ImplTwilio) PhoneNumberVerificationCode(
	ctx context.Context,
	to string,
	code string,
	marketingMessage string,
) (bool, error)

PhoneNumberVerificationCode sends Phone Number verification codes via WhatsApp

func (*ImplTwilio) Room

func (t *ImplTwilio) Room(
	ctx context.Context,
) (*dto.Room, error)

Room represents a real-time audio, data, video, and/or screen-share session, and is the basic building block for a Programmable Video application.

func (*ImplTwilio) SaveTwilioCallbackResponse

func (t *ImplTwilio) SaveTwilioCallbackResponse(
	ctx context.Context,
	data dto.Message,
) error

SaveTwilioCallbackResponse saves the twilio callback response for future analysis

func (*ImplTwilio) SaveTwilioVideoCallbackStatus

func (t *ImplTwilio) SaveTwilioVideoCallbackStatus(
	ctx context.Context,
	data dto.CallbackData,
) error

SaveTwilioVideoCallbackStatus saves status callback data

func (*ImplTwilio) SendSMS

func (t *ImplTwilio) SendSMS(
	ctx context.Context,
	to string,
	msg string,
) error

SendSMS sends a text message through Twilio's programmable SMS

func (*ImplTwilio) TemporaryPIN

func (t *ImplTwilio) TemporaryPIN(
	ctx context.Context,
	to string,
	message string,
) (bool, error)

TemporaryPIN send PIN via whatsapp to user

func (*ImplTwilio) TwilioAccessToken

func (t *ImplTwilio) TwilioAccessToken(
	ctx context.Context,
) (*dto.AccessToken, error)

TwilioAccessToken is used to generate short-lived credentials used to authenticate the client-side application to Twilio.

type UsecaseTwilio

type UsecaseTwilio interface {
	MakeTwilioRequest(
		method string,
		urlPath string,
		content url.Values,
		target interface{},
	) error

	MakeWhatsappTwilioRequest(
		ctx context.Context,
		method string,
		urlPath string,
		content url.Values,
		target interface{},
	) error

	Room(
		ctx context.Context,
	) (*dto.Room, error)

	TwilioAccessToken(
		ctx context.Context,
	) (*dto.AccessToken, error)

	SendSMS(
		ctx context.Context,
		to string,
		msg string,
	) error

	SaveTwilioVideoCallbackStatus(
		ctx context.Context,
		data dto.CallbackData,
	) error

	PhoneNumberVerificationCode(
		ctx context.Context,
		to string,
		code string,
		marketingMessage string,
	) (bool, error)

	SaveTwilioCallbackResponse(
		ctx context.Context,
		data dto.Message,
	) error

	TemporaryPIN(
		ctx context.Context,
		to string,
		message string,
	) (bool, error)
}

UsecaseTwilio defines twilio service usecases interface

Jump to

Keyboard shortcuts

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