HeadlinesBriefing favicon HeadlinesBriefing.com

DIY SMS Gateway: $20 Android Phone Beats Twilio Costs

Hacker News •
×

Jonno.nz's DIY SMS Gateway uses a $20 Android phone running open-source SMS Gateway for Android to slash messaging costs below Twilio's $0.05/msg average. Local mode runs a server directly on the device with no cloud fees, while cloud mode leverages SMS Gateway's hybrid push architecture for remote access. Both setups integrate via REST API and webhooks, with provider abstraction enabling seamless swaps between SMS Gateway, Twilio, or mock services.

The project eliminates $50+/month SMS bills for MVPs by utilizing mobile plan rates (often $0 for unlimited texts). Setup involves configuring the Android app's local server on port 8080, handling AP isolation issues on routers, and disabling battery optimizations. Cloud mode requires HTTPS endpoints and ngrok tunnels for webhook testing, with credentials managed through environment variables.

Next.js integration uses a provider interface pattern to abstract SMS logic. The SmsGateProvider class dynamically routes requests to either localhost:8080 or api.sms-gate.app based on environment variables, while parseWebhook() handles incoming messages with strict event validation. A webhook endpoint returns 200 OK responses to prevent message loss during processing.

This approach proves critical for bootstrapped developers needing SMS functionality without venture capital backing. By cutting infrastructure costs 90%+ compared to commercial providers, it enables experimentation without financial risk. The system's simplicity - an afternoon build with just an Android phone and Node.js knowledge - makes it accessible for solo creators.