Documentation ¶
Index ¶
- Constants
- type ServiceWhatsapp
- type ServiceWhatsappImpl
- func (s ServiceWhatsappImpl) CheckPreconditions()
- func (s ServiceWhatsappImpl) MakeTwilioRequest(ctx context.Context, method string, urlPath string, content url.Values, ...) error
- func (s ServiceWhatsappImpl) PhoneNumberVerificationCode(ctx context.Context, to string, code string, marketingMessage string) (bool, error)
- func (s ServiceWhatsappImpl) SaveTwilioCallbackResponse(ctx context.Context, data dto.Message) error
- func (s ServiceWhatsappImpl) TemporaryPIN(ctx context.Context, to string, message string) (bool, error)
Constants ¶
View Source
const ( // TwilioHTTPClientTimeoutSeconds determines how long to wait (in seconds) before giving up on a // request to the Twilio API TwilioHTTPClientTimeoutSeconds = 30 TwilioWhatsappSIDEnvVarName = "TWILIO_WHATSAPP_SID" // gosec false positive TwilioWhatsappAuthTokenEnvVarName = "TWILIO_WHATSAPP_AUTH_TOKEN" /* #nosec */ TwilioWhatsappSenderEnvVarName = "TWILIO_WHATSAPP_SENDER" )
Twilio Whatsapp API contants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceWhatsapp ¶
type ServiceWhatsapp interface { 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) }
ServiceWhatsapp defines the interactions with the whatsapp service
type ServiceWhatsappImpl ¶
type ServiceWhatsappImpl struct { BaseURL string AccountSID string AccountAuthToken string Sender string HTTPClient *http.Client Repository database.Repository }
ServiceWhatsappImpl is a WhatsApp service. The receivers implement the query and mutation resolvers.
func NewService ¶
func NewService() *ServiceWhatsappImpl
NewService initializes a properly set up WhatsApp service
func (ServiceWhatsappImpl) CheckPreconditions ¶
func (s ServiceWhatsappImpl) CheckPreconditions()
CheckPreconditions ...
func (ServiceWhatsappImpl) MakeTwilioRequest ¶
func (s ServiceWhatsappImpl) MakeTwilioRequest( ctx context.Context, method string, urlPath string, content url.Values, target interface{}, ) error
MakeTwilioRequest makes a twilio request
func (ServiceWhatsappImpl) PhoneNumberVerificationCode ¶
func (s ServiceWhatsappImpl) PhoneNumberVerificationCode( ctx context.Context, to string, code string, marketingMessage string, ) (bool, error)
PhoneNumberVerificationCode sends Phone Number verification codes via WhatsApp
func (ServiceWhatsappImpl) SaveTwilioCallbackResponse ¶
func (s ServiceWhatsappImpl) SaveTwilioCallbackResponse( ctx context.Context, data dto.Message, ) error
SaveTwilioCallbackResponse saves the twilio callback response for future analysis
func (ServiceWhatsappImpl) TemporaryPIN ¶
func (s ServiceWhatsappImpl) TemporaryPIN( ctx context.Context, to string, message string, ) (bool, error)
TemporaryPIN send PIN via whatsapp to user
Click to show internal directories.
Click to hide internal directories.