Skip to content
Golang client library for smsgate
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

GO library for SMS Gate


Install GO library

go get

Send SMS

import ""


api := smsgate.NewAPIv4Impl(
        SubmitURL: "https://SMSGATE-SUBMISSION-URL",
sms := &smsgate.SMSRequest{
    Type:     smsgate.TypeText,
    Sender:   "SMS-SENDER",
    Receiver: "SMS-RECEIVER-MSISDN",

    Text: paramText,
    DCS:  smsgate.DCSGSM,
    DlrMask: smsgate.DLRMaskStandard,

     Auth: &smsgate.Auth{
        Username: "YOUR-USERNAME",
        Password: "YOUR-PASSWORD",

response, err := api.Send(sms)
if err != nil {
    if smsgate.IsAPIError(err) {
        apiErr := err.(*smsgate.APIError)
        log.Errorf("API returned error: %d : %s\n",
            apiErr.Code(), apiErr.Error())
    } else {
        log.Errorf("Error: %s\n", err)
} else {
    log.Printf("Sent as message ID %s with %d parts\n",
		response.MsgID, response.NumParts)

Receive DLRs

	mux := http.NewServeMux()
	mux.HandleFunc("/dlr", func(w http.ResponseWriter, req *http.Request) {
		dlr, err := api.ParseDeliveryReport(req)
		if err != nil {
			log.Printf("Cannot parse DLR: %s\n", err)
		log.Printf("Received DLR: %#v\n", dlr)

	httpsrv := &http.Server{
		Addr:           ":YOUR-SERVER-PORT",
		Handler:        mux,
		ReadTimeout:    10 * time.Minute,
		WriteTimeout:   10 * time.Minute,
		MaxHeaderBytes: 1 << 20,

Check examples directory.

You can’t perform that action at this time.