Use an Android phone as a reliable SMS gateway. The app pulls messages from your server queue and sends them using the mobile operator’s **bundle/off-net offers**, so cost stays tiny—no SMPP fees.
The phone polls your server with a **unique API key**; only authorized devices can send.
Leverages operator **bundle/pack offers** on the SIM for extremely low per-SMS cost.
Enable **delay for bulk** with a per-message delay (seconds) and a **threshold** that decides when to slow down.
Optional **sound on send**. Clear states: “Pending SMS”, “No SMS to send”.
Rate-limit via delay, auto-retry on temporary failures, and **delivery reporting** back to your server.
Minimal REST endpoints: **enqueue**, **poll**, **report**. Examples below.
CREATE TABLE sms_outbox (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
api_key VARCHAR(64) NOT NULL,
phone VARCHAR(20) NOT NULL,
message TEXT NOT NULL,
status ENUM('pending','sent','failed') DEFAULT 'pending',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
sent_at TIMESTAMP NULL,
error TEXT NULL
);
# 1) ENQUEUE (server receives request)
POST /api/sms/enqueue
key=YOUR_API_KEY&to=017XXXXXXXX&text=Hello
# 2) POLL (device asks for work)
GET /api/sms/poll?key=YOUR_API_KEY&limit=10
[
{"id":101,"to":"017XXXXXXXX","text":"Hello","delay_after_sec":5},
...
]
# 3) REPORT (device reports result)
POST /api/sms/report
key=YOUR_API_KEY&id=101&status=sent # or failed&error=reason
HTTP 401 for wrong keys. Use delay_after_sec to honor the app’s bulk delay.<?php
// /api/sms/enqueue
require 'db.php'; // $pdo (PDO)
$key = $_POST['key'] ?? '';
$to = $_POST['to'] ?? '';
$txt = $_POST['text']?? '';
if ($key !== 'YOUR_API_KEY') { http_response_code(401); exit; }
$stmt = $pdo->prepare("INSERT INTO sms_outbox(api_key,phone,message) VALUES (?,?,?)");
$stmt->execute([$key,$to,$txt]);
echo json_encode(['status'=>'queued','id'=>$pdo->lastInsertId()]);