Logo Lanfrica

astianmuchui/at-sms-gofiber

Domain:

natural language processing

Record type:

software
Creator:
ast
Host:
Africa's Talking SMS Wrapper for gofiber # at-sms-gofiber A Go SDK for the Africa's Talking SMS API, built on top of GoFiber (`fiber/v3` and its HTTP client). ## Features - Bulk SMS (current and legacy endpoints) - Premium SMS and subscription requests - Fetching received messages - Parsing inbound webhook notifications (delivery reports, incoming messages, opt-outs, subscription updates) - Sandbox and production modes - Network operator and status code constants for supported African telcos ## Installation ```bash go get github.com ``` ## Usage ```go package main import ( "fmt" v1 "github.com" ) func main() { v1.SetCredentials("your-username", "your-api-key") // v1.SetProductionMode() // uncomment to hit the live API instead of sandbox payload := &v1.BulkSMSRequestPayload{ Username: "your-username", PhoneNumbers: []string{"+254700000000"}, Message: "Hello from at-sms-gofiber!", SenderId: "YourSenderId", } resp, err := payload.Send() if err != nil { fmt.Println("error sending SMS:", err) return } fmt.Printf("%+v\n", resp) } ``` ## Handling inbound webhooks Africa's Talking posts delivery reports and incoming messages to your callback URLs as form-encoded data. Parse them from a Fiber handler with the `Parse*` helpers: ```go app.Post("/sms/delivery-report", func(c fiber.Ctx) error { report, err := v1.ParseDeliveryReport(c) if err != nil { return err } fmt.Printf("%+v\n", report) return c.SendStatus(fiber.StatusOK) }) app.Post("/sms/incoming", func(c fiber.Ctx) error { msg, err := v1.ParseIncomingMessage(c) if err != nil { return err } fmt.Printf("%+v\n", msg) return c.SendStatus(fiber.StatusOK) }) ``` `ParseBulkSMSOptOut` and `ParseSubscriptionNotification` follow the same pattern for opt-out and subscription-update callbacks. ## API reference ### Setup | Function | Description | | --- | --- | | `SetCredentials(username, apiKey string)` | Sets the Africa's Talking username/API key used to authenticate every reques …

Licenses