Key Takeaways
- Rails sends OTP through an Android SMS gateway with HTTPS/JSON from the server — not a Complete Rails SMS SDK product.
- Enqueue with ActiveJob; require idempotency (client_ref). Do not mint a new code on every retry.
- HTTP success is accepted. Persist gateway ids; close with DLR/webhooks. Confirm fields in Developer Center.
- Isolate OTP device_id from promo. You bring the Android and operator credit.
- Platform pricing is devices plus send volume.
android sms gateway api from Rails for OTP is a job plus a paired phone. Sibling: Rails queue workers. OTP product: OTP. Live JSON: Developer Center.
You bring the handset and airtime. Devices and send volume. Samples are HTTPS/JSON — not a gem branded as a Complete SDK. Official app: Downloads.
ActiveJob · HTTPS · SIM
retry: 5 without client_ref is five OTPs.
Net::HTTP, not a Rails SMS SDK
Conceptual only — copy live path and JSON from Developer Center:
# Pseudocode — confirm fields in Developer Center
Net::HTTP.post(
URI(ENV.fetch('SMS_GATEWAY_URL')),
{ to:, text:, client_ref:, device_id: }.to_json,
'Authorization' => "Bearer #{ENV.fetch('SMS_GATEWAY_API_KEY')}",
'Content-Type' => 'application/json'
)If your gem README promises “drop-in Twilio replacement with unmetered carrier SMS,” you are reading marketing — not this product’s meter (devices + volume) or your carrier bill.
Rails OTP failure table
| Mistake | Result | Fix |
|---|---|---|
| Retry mints new code | User locked out | Same client_ref / hash |
| No device_id | OTP on promo SIM | Pin quiet handset |
| Trust HTTP 201 only | False “sent” | DLR / webhook |
| Token in credentials.yml leaked | Abuse | Env + rotate |
| UCS-2 OTP copy | Multipart / filters | GSM-7 brand + digits |
ActiveJob with client_ref
Pace Sidekiq/Solid Queue to one OTP radio. Throughput per SIM.
Accepted vs delivered
DLR, webhooks. Active Job. Messaging practices.
Next steps
One OtpSendJob, client_ref required, staff canary. Spend 300 lifetime SMS proving Rails → SIM — then a funded production handset.
Related product pages
Jump to the live product docs for this topic—not another long-form article.
- OTP and 2FA SMS on AndroidAuthentication flows
- SMS API documentationLive endpoint reference
- device and SMS volume pricingPlans and allowances
- Android SMS gateway product guideDefinition, product, and how to buy





