SMS Service Setup

Complete implementation guide and SMS provider configuration

Mobile Phone Gateway Implementation

Complete guide to set up your mobile phone as SMS gateway - no third-party services required.

Android Phone SMS Gateway

Easy

Turn your Android phone into SMS gateway server

Your mobile plan only

USB SMS Modem

Medium

Use USB modem with AT commands for SMS

$30 modem + SIM card

Raspberry Pi GSM HAT

Advanced

Build dedicated SMS server with Pi

$100 Pi + GSM module

Old Smartphone Gateway

Easy

Repurpose old Android phone as SMS server

Old phone + SIM card

Android Phone SMS Gateway - Complete Setup

Step 1: Choose SMS Gateway App

SMS Gateway ME
4.5/5
HTTP API
Webhook support
Auto-reply
Message logging
SMS Gateway
4.3/5
REST API
Multiple SIM
Batch sending
Status reports
SMS Server Gateway
4.1/5
JSON API
SSL support
Contact sync
Scheduled SMS
Android SMS Gateway
4.4/5
Simple API
USB tethering
WiFi hotspot
Remote access

Step 2: Phone Setup

  1. 1
    Install SMS Gateway App:

    Download "SMS Gateway ME" from Google Play Store (recommended)

  2. 2
    Grant Permissions:

    Allow SMS, phone, and storage permissions when prompted

  3. 3
    Configure API Settings:

    Set API endpoint, enable HTTP server, note your phone's IP address

  4. 4
    Start Gateway Service:

    Enable the SMS gateway service and keep app running

Step 3: Integration Code

// lib/phone-gateway.js class PhoneGateway { constructor(phoneIP, port = 8080, password = '') { this.baseURL = `http://${phoneIP}:${port}`; this.password = password; } async sendSMS(phoneNumber, message) { try { const response = await fetch(`${this.baseURL}/send-sms`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${this.password}` }, body: JSON.stringify({ phone: phoneNumber, message: message, type: 'sms' }) }); const result = await response.json(); if (result.success) { return { success: true, messageId: result.id, status: 'sent', cost: 0, // Using your mobile plan timestamp: new Date().toISOString() }; } else { throw new Error(result.error || 'SMS sending failed'); } } catch (error) { return { success: false, error: error.message }; } } async sendBulkSMS(phoneNumbers, message) { const results = []; for (const phoneNumber of phoneNumbers) { const result = await this.sendSMS(phoneNumber, message); results.push({ phoneNumber, ...result }); // Add delay between messages to avoid rate limiting await new Promise(resolve => setTimeout(resolve, 1000)); } return results; } async getStatus() { try { const response = await fetch(`${this.baseURL}/status`); const status = await response.json(); return { online: true, signal: status.signal, battery: status.battery, operator: status.operator, phoneNumber: status.phoneNumber }; } catch (error) { return { online: false, error: error.message }; } } } module.exports = { PhoneGateway };

Step 4: API Endpoint Setup

// pages/api/phone-sms.js (or app/api/phone-sms/route.js) import { PhoneGateway } from '../../lib/phone-gateway'; // Configure your phone's IP address const PHONE_IP = '192.168.1.100'; // Replace with your phone's IP const PHONE_PORT = 8080; const PHONE_PASSWORD = 'your_gateway_password'; const gateway = new PhoneGateway(PHONE_IP, PHONE_PORT, PHONE_PASSWORD); export default async function handler(req, res) { if (req.method !== 'POST') { return res.status(405).json({ error: 'Method not allowed' }); } const { phoneNumber, message, bulk = false, phoneNumbers } = req.body; if (!phoneNumber && !phoneNumbers) { return res.status(400).json({ error: 'Phone number required' }); } if (!message) { return res.status(400).json({ error: 'Message required' }); } try { let result; if (bulk && phoneNumbers) { result = await gateway.sendBulkSMS(phoneNumbers, message); } else { result = await gateway.sendSMS(phoneNumber, message); } res.status(200).json(result); } catch (error) { res.status(500).json({ error: error.message }); } }

Android Gateway Benefits

  • • Use your existing mobile plan - no extra costs
  • • Send unlimited SMS (based on your plan)
  • • No third-party dependencies
  • • Complete control over your messages
  • • Works with any Android phone

Integration with Your SMS Platform

Replace Demo Functions in BulkSMSForm.tsx:

// Update handleSingleSMS function: const handleSingleSMS = async (e) => { e.preventDefault(); setIsSending(true); try { const response = await fetch('/api/phone-sms', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ phoneNumber: formData.recipients.split('\n')[0].trim(), message: formData.message }) }); const result = await response.json(); setSendResults([result]); setShowResults(true); } catch (error) { console.error('SMS send error:', error); } finally { setIsSending(false); } };

Environment Configuration:

# For Android Gateway
PHONE_GATEWAY_IP=192.168.1.100
PHONE_GATEWAY_PORT=8080
PHONE_GATEWAY_PASSWORD=your_password

# For USB Modem
USB_MODEM_PORT=/dev/ttyUSB0
USB_MODEM_BAUDRATE=115200

# For Raspberry Pi
PI_SMS_SERVER=http://192.168.1.200:5000
PI_API_KEY=your_api_key

Your Independent SMS Solution

These methods give you complete control over SMS sending using your own mobile infrastructure. No third-party dependencies, no monthly API fees, no rate limits beyond your mobile plan. Choose the method that best fits your technical comfort level and requirements.