
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
pySMSGateway is an asynchronous Python microservice that interacts with a GSM modem using Gammu. It provides a REST API for sending and receiving SMS messages and retrieving real-time modem and network details such as IMEI, signal quality, and carrier name. Incoming SMS messages can optionally be forwarded to any external service via a configurable webhook.
Set the following environment variables to configure the gateway:
Variable | Description | Default |
---|---|---|
WEBHOOK_URL | URL to forward incoming SMS as a JSON payload (optional) | http://localhost:8123/webhook/sms |
WEBHOOK_TOKEN | Optional bearer token for secure webhook POSTs | — |
GSM_DEVICE | Path to GSM modem serial port (e.g. /dev/ttyUSB0 ) | /dev/ttyUSB0 |
GSM_CONNECTION | Modem connection string (e.g. at19200 , at115200 ) | at115200 |
POLL_INTERVAL | Interval (seconds) to poll modem for new messages | 10 |
POST /api/sms/send
Send an SMS message via modem.
Request:
{
"number": "+15551234567",
"text": "Hello from pySMSGateway!"
}
Response:
{ "status": "SMS sent" }
GET /api/sms/info
Retrieve modem metadata and network diagnostics.
Response:
{
"manufacturer": "Quectel",
"model": "EC25",
"firmware": "01.000.01.001",
"imei": "867322032XXXXX",
"signal_quality": { "SignalStrength": 21, "SignalPercent": 55 },
"network_info": {
"NetworkCode": "310260",
"NetworkName": "T-Mobile",
"LAC": "0001",
"CID": "0A2B"
}
}
When an incoming SMS is received, a POST
request is sent to your WEBHOOK_URL
containing:
{
"phone": "+15559876543",
"date": "2025-06-22 11:30:00",
"message": "Your gateway is working!"
}
The Authorization: Bearer WEBHOOK_TOKEN
header is included if configured.
docker build -t pysmsgateway .
docker run --rm -it \
-e GSM_DEVICE=/dev/ttyUSB0 \
-e GSM_CONNECTION=at115200 \
-e WEBHOOK_URL=https://your-service.example.com/sms \
-e WEBHOOK_TOKEN=your-secret-token \
--device=/dev/ttyUSB0 \
-p 3000:3000 \
pysmsgateway
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt # include aiohttp, python-gammu, etc.
python sms_gateway.py
MIT License
Bug reports, feature suggestions, and pull requests are welcome!
FAQs
Asynchronous SMS gateway using Gammu with RESTful API interface
We found that py-smsgateway-async demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.