Go SDK
The official Go client for the SendAfrica REST API. It is idiomatic, dependency-free, and exposes typed resource objects (SMS, Credits, Rates, SenderIDs, Payments, Webhooks) on the Client, plus flat methods for auth, accounts, contacts, campaigns, notifications, and health checks.
Feature overview
- Module:
github.com/SendAfrica/GO-SDK - Go 1.22 or newer. Standard library only — no third-party dependencies.
- Base URL:
https://api.sendafrica.online/v1
Quickstart
package main
import (
"context"
"log"
"os"
sendafrica "github.com/SendAfrica/GO-SDK"
)
func main() {
client := sendafrica.NewClient(os.Getenv("SENDAFRICA_API_KEY"))
result, err := client.SMS.Send(context.Background(), sendafrica.SendSMSRequest{
To: "0712345678",
Message: "Your verification code is 4921.",
})
if err != nil { log.Fatal(err) }
log.Printf("sent: %s status=%s credits=%d", result.MessageID, result.Status, result.CreditsUsed)
}Keep the API key in SENDAFRICA_API_KEY (or pass it directly to NewClient). Credentials must stay server-side and out of source control.
Pages in this section
Last updated on