Go: Parse DLR from an Android SMS Gateway API

Featured illustration for Go: Parse DLR from an Android SMS Gateway API

Parse DLR in Go for an Android SMS Gateway API: checklist, mappers, multi-device and bulk monitoring notes.

Written by the SMS Gateway team for operators who run phones and airtime themselves — not for theoretical cloud SMS demos.

InformationAndroid SMS GatewayAPIDevelopers
Article
Published
July 26, 2025
Updated
July 26, 2025
Reading time
17 minute read

Key Takeaways

  • go android sms gateway api parse dlr is encoding/json over GET /api/v1/messages/{id} — not a branded Go SDK or module product.
  • HTTP 202 on send means accepted. Status lives on the message object and on webhooks.
  • Never overwrite Delivered with a late Pending. One precedence mapper for poll and push.
  • Keys in env. Timeouts on the client. Docs win if this sample drifts.
  • Priced by devices and SMS send volume. You use your own phone and operator SMS credit. Polling does not include operator airtime.
  • Prefer webhooks in production; poll is a backfill.

net/http, not a Go SDK product

Search intent for go android sms gateway api parse dlr is mapping a JSON status into your domain — not installing a vendor module. Service pricing is based on device count and total SMS sent through the gateway. Live contract: docs.sms-gateway.app. Go’s own HTTP client is enough (net/http).

If your mapper treats every 2xx GET as Delivered, you are parsing HTTP, not DLR.
curl -X GET "https://app.sms-gateway.app/api/v1/messages/41822" \
  -H "Authorization: Bearer $SMS_GATEWAY_API_KEY"

Same shape from Go:

package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"time"
)

func main() {
	req, _ := http.NewRequest(http.MethodGet, os.Getenv("SMS_GATEWAY_DLR_URL"), nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("SMS_GATEWAY_API_KEY"))
	client := &http.Client{Timeout: 15 * time.Second}
	res, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(res.StatusCode, string(body))
}

That is copyable REST. It is not “Download Go SDK.” Send sibling: C# send (same REST).

GET /messages/{id}

Persist the id from the send response. Example accepted body (nothing has left the device yet):

{
  "campaignId": 17,
  "accepted": 1,
  "scheduledAt": null,
  "messages": [
    {
      "id": 41822,
      "number": "+14155552671",
      "text": "Your verification code is 481920",
      "type": "sms",
      "status": "Pending",
      "campaignId": 17,
      "deviceId": 3
    }
  ]
}
EventStoreTrap
PendingAccepted / queued on deviceTreat as success in the OTP UI
DeliveredTerminal success — do not regressLate poll overwrites with Pending
FailedTerminal fail — page radio/airtimeImmediate resend without Idempotency-Key
Webhook + pollSame mapper; dedupe on message idTwo parsers that disagree

Pending is not Delivered

Encode precedence in one function used by poll and webhook paths. Delivery reports.

Poll vs webhook reconciliation

Webhooks arrive at-least-once. Webhooks setup. Verify HMAC; dedupe on event id. Poll fills gaps — do not hammer GET.

Do not log the code

Log message id, masked MSISDN, status, latency. Strip Authorization. OTP verification. Priced by devices and SMS send volume. You use your own phone and operator SMS credit.

DLR mapper checklist

  • net/http + env key; no fake SDK.
  • Status enum from docs, not folklore.
  • Delivered never regresses to Pending.
  • Webhook + poll share one mapper.
  • Staff canary before production OTP.

Next steps

Fetch one known id, map it, then subscribe. Pricing. Setup.

Jump to the live product docs for this topic—not another long-form article.

FAQ

Frequently asked questions

Direct answers about android sms gateway api.

Is there an official Go SDK?

No. Use net/http (or a generic HTTP client) against the documented REST JSON API. Samples are copyable Go, not a module we sell.

Does a 200 on GET mean the user got the SMS?

It means you fetched a record. Read status. Delivered is the radio story; Pending is still queued.

Should I poll in a tight loop?

No. Back off. Subscribe to message.delivered / message.failed. Poll to reconcile misses.

Who pays for the SMS?

You pay the operator. Platform meters devices and volume.

Live status strings?

Developer Center (https://docs.sms-gateway.app/). Do not hard-code a private enum that docs do not list.

Free canary?

300 SMS lifetime on one device.
Keep learning

Topically related guides—chosen by subject overlap, not a fixed sitewide footer.

Information
what is dlr

What Is DLR? Android SMS Gateway Context

What Is DLR? Android SMS Gateway Context. Glossary-style explainer of DLR specifically as it applies to Android SIM-based gateways versus aggregator APIs. Priced by devices and SMS send volume; BYO phone and operator credit.

Jan 26, 202616 min
Read article

Browse the full Android SMS gateway knowledge base or return to how an Android SMS gateway works.

Get started

Test the gateway on your own Android phone

Install the app, pair one device, and validate your API flow before choosing a paid plan.

You supply the phone, SIM, and operator SMS credit.