Documentation ¶
Index ¶
- Constants
- type ServiceTwilio
- type ServiceTwilioImpl
- func (s ServiceTwilioImpl) CheckPreconditions()
- func (s ServiceTwilioImpl) MakeTwilioRequest(method string, urlPath string, content url.Values, target interface{}) error
- func (s ServiceTwilioImpl) MakeWhatsappTwilioRequest(ctx context.Context, method string, urlPath string, content url.Values, ...) error
- func (s ServiceTwilioImpl) PhoneNumberVerificationCode(ctx context.Context, to string, code string, marketingMessage string) (bool, error)
- func (s ServiceTwilioImpl) Room(ctx context.Context) (*dto.Room, error)
- func (s ServiceTwilioImpl) SaveTwilioCallbackResponse(ctx context.Context, data dto.Message) error
- func (s ServiceTwilioImpl) SaveTwilioVideoCallbackStatus(ctx context.Context, data dto.CallbackData) error
- func (s ServiceTwilioImpl) SendSMS(ctx context.Context, to string, msg string) error
- func (s ServiceTwilioImpl) TemporaryPIN(ctx context.Context, to string, message string) (bool, error)
- func (s ServiceTwilioImpl) TwilioAccessToken(ctx context.Context) (*dto.AccessToken, error)
Constants ¶
const ( TwilioRegionEnvVarName = "TWILIO_REGION" TwilioVideoAPIURLEnvVarName = "TWILIO_VIDEO_API_URL" TwilioVideoAPIKeySIDEnvVarName = "TWILIO_VIDEO_SID" TwilioVideoAPIKeySecretEnvVarName = "TWILIO_VIDEO_SECRET" TwilioAccountSIDEnvVarName = "TWILIO_ACCOUNT_SID" TwilioAccountAuthTokenEnvVarName = "TWILIO_ACCOUNT_AUTH_TOKEN" TwilioSMSNumberEnvVarName = "TWILIO_SMS_NUMBER" ServerPublicDomainEnvVarName = "SERVER_PUBLIC_DOMAIN" TwilioCallbackPath = "/twilio_callback" TwilioHTTPClientTimeoutSeconds = 10 TwilioPeerToPeerMaxParticipants = 3 TwilioAccessTokenTTL = 14400 TwilioWhatsappSIDEnvVarName = "TWILIO_WHATSAPP_SID" // gosec false positive TwilioWhatsappAuthTokenEnvVarName = "TWILIO_WHATSAPP_AUTH_TOKEN" /* #nosec */ TwilioWhatsappSenderEnvVarName = "TWILIO_WHATSAPP_SENDER" )
#nosec
DefaultTwilioRegion is set to global low latency auto-selection
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceTwilio ¶
type ServiceTwilio interface { Room(ctx context.Context) (*dto.Room, error) TwilioAccessToken(ctx context.Context) (*dto.AccessToken, error) SendSMS(ctx context.Context, to string, msg string) error // TODO: Remove db call SaveTwilioVideoCallbackStatus( ctx context.Context, data dto.CallbackData, ) error PhoneNumberVerificationCode( ctx context.Context, to string, code string, marketingMessage string, ) (bool, error) // TODO: Remove db implementation SaveTwilioCallbackResponse( ctx context.Context, data dto.Message, ) error TemporaryPIN( ctx context.Context, to string, message string, ) (bool, error) 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 }
ServiceTwilio defines the interaction with the twilio service
type ServiceTwilioImpl ¶
type ServiceTwilioImpl struct { BaseURL string WhatsappAccountSID string AccountAuthToken string Sender string HTTPClient *http.Client Repository database.Repository // contains filtered or unexported fields }
ServiceTwilioImpl organizes methods needed to interact with Twilio for video, voice and text
func NewService ¶
func NewService(sms sms.ServiceSMS, repo database.Repository) *ServiceTwilioImpl
NewService initializes a service to interact with Twilio
func (ServiceTwilioImpl) CheckPreconditions ¶ added in v0.0.23
func (s ServiceTwilioImpl) CheckPreconditions()
CheckPreconditions checks preconditions for the twilio service
func (ServiceTwilioImpl) MakeTwilioRequest ¶
func (s ServiceTwilioImpl) MakeTwilioRequest( method string, urlPath string, content url.Values, target interface{}, ) error
MakeTwilioRequest makes a twilio request
func (ServiceTwilioImpl) MakeWhatsappTwilioRequest ¶ added in v0.0.23
func (s ServiceTwilioImpl) MakeWhatsappTwilioRequest( ctx context.Context, method string, urlPath string, content url.Values, target interface{}, ) error
MakeWhatsappTwilioRequest makes a twilio request
func (ServiceTwilioImpl) PhoneNumberVerificationCode ¶ added in v0.0.23
func (s ServiceTwilioImpl) PhoneNumberVerificationCode( ctx context.Context, to string, code string, marketingMessage string, ) (bool, error)
PhoneNumberVerificationCode sends Phone Number verification codes via WhatsApp
func (ServiceTwilioImpl) Room ¶
Room represents a real-time audio, data, video, and/or screen-share session, and is the basic building block for a Programmable Video application.
In a Peer-to-peer Room, media flows directly between participants. This supports up to 10 participants in a mesh topology.
In a Group Room, media is routed through Twilio's Media Servers. This supports up to 50 participants.
Participants represent client applications that are connected to a Room and sharing audio, data, and/or video media with one another.
Tracks represent the individual audio, data, and video media streams that are shared within a Room.
LocalTracks represent the audio, data, and video captured from the local client's media sources (for example, microphone and camera).
RemoteTracks represent the audio, data, and video tracks from other participants connected to the Room.
Room names must be unique within an account.
Rooms created via the REST API exist for five minutes to allow the first Participant to connect. If no Participants join within five minutes, the Room times out and a new Room must be created.
Because of confidentiality issues in healthcare, we do not enable recording for these meetings.
func (ServiceTwilioImpl) SaveTwilioCallbackResponse ¶ added in v0.0.23
func (s ServiceTwilioImpl) SaveTwilioCallbackResponse( ctx context.Context, data dto.Message, ) error
SaveTwilioCallbackResponse saves the twilio callback response for future analysis
func (ServiceTwilioImpl) SaveTwilioVideoCallbackStatus ¶
func (s ServiceTwilioImpl) SaveTwilioVideoCallbackStatus( ctx context.Context, data dto.CallbackData, ) error
SaveTwilioVideoCallbackStatus saves status callback data
func (ServiceTwilioImpl) TemporaryPIN ¶ added in v0.0.23
func (s ServiceTwilioImpl) TemporaryPIN( ctx context.Context, to string, message string, ) (bool, error)
TemporaryPIN send PIN via whatsapp to user
func (ServiceTwilioImpl) TwilioAccessToken ¶
func (s ServiceTwilioImpl) TwilioAccessToken(ctx context.Context) (*dto.AccessToken, error)
TwilioAccessToken is used to generate short-lived credentials used to authenticate the client-side application to Twilio.
An access token should be generated for every user of the application.
An access token can optionally encode a room name, which would allow the user to connect only to the room specified in the token.
Access tokens are JSON Web Tokens (JWTs).