communication

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageStatusCodes = map[int]string{
	100: "Processed",
	101: "Sent",
	102: "Queued",
	401: "RiskHold",
	402: "InvalidSenderId",
	403: "InvalidPhoneNumber",
	404: "UnsupportedNumberType",
	405: "InsufficientBalance",
	406: "UserInBlacklist",
	407: "CouldNotRoute",
	409: "DoNotDisturbRejection",
	500: "InternalServerError",
	501: "GatewayError",
	502: "RejectedByGateway",
}

MessageStatusCodes maps specific status codes to their corresponding messages.

Functions

func GetStatusMessage

func GetStatusMessage(code int) string

GetStatusMessage retrieves the human-readable message corresponding to an HTTP status code. It returns "Unknown Status Code" if the code is not found in the predefined map.

func SendEmail

func SendEmail(smtpHost string, smtpPort int, username, password string, InsecureSkipVerify bool, details models.EmailDetails) error

SendEmail sends an email using the provided SMTP server details and email content. smtpHost: The SMTP server host (e.g., "smtp.gmail.com"). smtpPort: The SMTP server port (e.g., 587 for TLS). username: The SMTP username (e.g., email address of sender). password: The SMTP password (or app-specific password). InsecureSkipVerify: A flag to allow insecure SSL connections (use with caution).

func SendSMS

func SendSMS(payload models.SMSPayload) (models.SMSResponse, error)

SendSMS sends a bulk SMS request to the Africa's Talking API. It marshals the payload into JSON, sends a POST request, and returns the response or an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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