Documentation
¶
Index ¶
- Variables
- func GenerateOTP() (int, error)
- func GetDeliveryStatus(payload *models.BeemSMSDeliveryStatusPayload) (*models.BeemSMSDeliveryStatusResponse, error)
- func GetStatusMessage(code int) string
- func SendAfricasTalkingSMS(payload *models.ATSMSPayload) (*models.ATSMSResponse, error)
- func SendBeemSMS(payload *models.BeemSMSPayload) (*models.BeemSMSResponse, error)
- func SendEmail(smtpHost string, smtpPort int, username, password string, ...) error
Constants ¶
This section is empty.
Variables ¶
var ATBaseURL = "https://api.africastalking.com/version1/messaging/bulk"
baseURL defines the Africa's Talking API endpoint for bulk SMS messaging Points to the version 1 messaging endpoint
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 Africa's Talking API status codes to human-readable messages Provides descriptions for common success and error states
Functions ¶
func GenerateOTP ¶ added in v1.1.7
func GetDeliveryStatus ¶ added in v1.1.6
func GetDeliveryStatus(payload *models.BeemSMSDeliveryStatusPayload) (*models.BeemSMSDeliveryStatusResponse, error)
func GetStatusMessage ¶
GetStatusMessage retrieves the human-readable message for a given status code Returns the corresponding message from MessageStatusCodes or a default unknown message
func SendAfricasTalkingSMS ¶ added in v1.1.6
func SendAfricasTalkingSMS(payload *models.ATSMSPayload) (*models.ATSMSResponse, error)
SendSMS sends a bulk SMS request to the Africa's Talking API Marshals the SMS payload, sends a POST request, and parses the response Returns the SMS response or an error if the request fails
func SendBeemSMS ¶ added in v1.1.6
func SendBeemSMS(payload *models.BeemSMSPayload) (*models.BeemSMSResponse, error)
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 Configures an email with sender, recipients, subject, body, and attachments Connects to the SMTP server and sends the email, supporting TLS configuration Returns an error if the email sending fails, otherwise nil
Types ¶
This section is empty.