Android SMS Gateway
Self-hosted SMS gateway using an Android phone with HTTP API integration. Full control, no third-party dependencies.
Overview
This skill enables sending and receiving SMS messages through an Android phone running an SMS Gateway app. The phone exposes a local HTTP API that this skill uses to send messages and check received messages.
Supported Apps
Primary (Original Scripts)
- - SMS Gateway API (⭐ Recommended) - https://github.com/itsmeichigo/SMSGateway
- SMSGate - https://github.com/iamsmgate/smsgate
- SMS Forwarder - https://github.com/pppscn/SmsForwarder
capcom6/android-sms-gateway (New Scripts)
- - SMS Gateway for Android - https://github.com/capcom6/android-sms-gateway
- ✅ End-to-end encryption
- ✅ Local + Cloud + Private server modes
- ✅ Multi-device support
- ✅ Webhooks for incoming messages
- ✅ Multi-recipient bulk sends
Quick Start
Prerequisites
- 1. Android phone with SMS capability
- Install SMS Gateway app on the phone
- Phone and OpenClaw host on same network (or port forwarding)
- Configure app with API access enabled
Setup (Once)
CODEBLOCK0
Commands
Send SMS
CODEBLOCK1
Check Received Messages
CODEBLOCK2
Check Gateway Status
CODEBLOCK3
Bulk SMS
CODEBLOCK4
Configuration
Option 1: Environment Variables
CODEBLOCK5
Option 2: Config File
Create ~/.openclaw/sms-gateway.json:
CODEBLOCK6
Option 3: Command Line Args
All scripts support --url and --token flags:
CODEBLOCK7
capcom6/android-sms-gateway Configuration
Environment Variables
CODEBLOCK8
Config File
Create ~/.openclaw/sms-gateway-capcom6.json:
CODEBLOCK9
Usage Examples
CODEBLOCK10
Save to TOOLS.md
Add your configuration to TOOLS.md for reference:
CODEBLOCK11
API Reference
See references/api_reference.md for detailed API endpoints for each supported app.
Security Considerations
Network Security
- - LAN only: Keep gateway on local network when possible
- Firewall: Restrict access to gateway port
- HTTPS: Use HTTPS if exposing externally (requires app support)
- VPN: Use VPN for remote access instead of port forwarding
capcom6-Specific Security
| Feature | Benefit |
|---|
| E2E Encryption | Message content encrypted before API transit |
| Private Server |
Deploy your own backend (no cloud dependency) |
|
Basic Auth | Standard HTTP authentication |
|
Webhooks | Incoming messages pushed directly from device |
Recommendation: Use capcom6's private server mode for maximum security:
https://docs.sms-gate.app/getting-started/private-server/
Authentication
- - Strong tokens: Use random API tokens (32+ chars)
- Token rotation: Rotate tokens periodically
- File permissions: INLINECODE5
Rate Limiting
- - Avoid spam: Implement sending limits in your workflows
- Carrier limits: Respect SMS carrier rate limits (~1 msg/sec)
- Queue system: Use queue for bulk sends
Troubleshooting
Gateway Not Responding
CODEBLOCK12
Authentication Failed
CODEBLOCK13
Message Not Sent
CODEBLOCK14
Usage Examples
Security Alert System
CODEBLOCK15
Two-Factor Auth Codes
CODEBLOCK16
Scheduled Reminders
CODEBLOCK17
Monitoring Integration
CODEBLOCK18
Scripts
Original (itsmeichigo/SMSGateway)
- -
scripts/send_sms.sh - Send single SMS - INLINECODE7 - Fetch received messages
- INLINECODE8 - Check gateway health
- INLINECODE9 - Send to multiple recipients
capcom6/android-sms-gateway
- -
scripts/send_sms_capcom6.sh - Send single SMS - INLINECODE11 - Register webhook for incoming SMS
- INLINECODE12 - Check gateway health
- INLINECODE13 - Send to multiple recipients (supports multi-recipient API)
References
Notes
- - Message encoding: Scripts handle UTF-8 for international characters
- Long messages: Automatically split for messages > 160 chars (GSM) or > 70 chars (Unicode)
- Delivery reports: Some apps support delivery callbacks (see api_reference.md)
- Dual SIM: Specify SIM slot if phone has dual SIM (app-dependent)
Android SMS 网关
通过集成 HTTP API 的安卓手机实现自托管短信网关。完全可控,无第三方依赖。
概述
本技能支持通过运行短信网关应用的安卓手机发送和接收短信。手机暴露本地 HTTP API,供本技能用于发送消息和检查已接收消息。
支持的应用
主要(原始脚本)
- - SMS Gateway API(⭐ 推荐)- https://github.com/itsmeichigo/SMSGateway
- SMSGate - https://github.com/iamsmgate/smsgate
- SMS Forwarder - https://github.com/pppscn/SmsForwarder
capcom6/android-sms-gateway(新脚本)
- - Android 短信网关 - https://github.com/capcom6/android-sms-gateway
- ✅ 端到端加密
- ✅ 本地 + 云端 + 私有服务器模式
- ✅ 多设备支持
- ✅ 接收消息的 Webhook
- ✅ 多收件人群发
快速开始
前置条件
- 1. 具备短信功能的安卓手机
- 在手机上安装短信网关应用
- 手机与 OpenClaw 主机处于同一网络(或配置端口转发)
- 配置应用,启用 API 访问
设置(一次性操作)
bash
1. 在安卓手机上安装 SMS Gateway API 应用
下载地址:https://github.com/itsmeichigo/SMSGateway/releases
2. 配置应用:
- 启用 HTTP API 服务器
- 设置 API 令牌/密码
- 记录手机的 IP 地址和端口(默认:8080)
3. 测试连接
curl http://手机IP:8080/api/v1/status -H Authorization: Bearer 你的令牌
4. 保存配置到 TOOLS.md(参见配置部分)
命令
发送短信
bash
基本发送
./scripts/send_sms.sh --to +1234567890 --message 来自 OpenClaw 的问候
使用配置文件
./scripts/send_sms.sh --config ~/.openclaw/sms-gateway.json \
--to +1234567890 \
--message 警报:安全扫描完成
通过环境变量
export SMS
GATEWAYURL=http://192.168.1.100:8080
export SMS
GATEWAYTOKEN=your-api-token
./scripts/send_sms.sh --to +1234567890 --message 测试消息
检查已接收消息
bash
列出最近接收的消息
./scripts/receive_sms.sh --limit 10
检查自某个时间戳以来的新消息
./scripts/receive_sms.sh --since 2026-02-22T00:00:00Z
检查网关状态
bash
验证网关是否在线
./scripts/check_status.sh
群发短信
bash
发送给多个收件人
./scripts/bulk_sms.sh --recipients +1234567890,+0987654321 --message 广播消息
从文件读取(每行一个号码)
./scripts/bulk_sms.sh --recipients-file ./contacts.txt --message 警报
配置
选项 1:环境变量
bash
export SMSGATEWAYURL=http://192.168.1.100:8080
export SMSGATEWAYTOKEN=your-api-token
export SMSGATEWAYTIMEOUT=30
选项 2:配置文件
创建 ~/.openclaw/sms-gateway.json:
json
{
gateway_url: http://192.168.1.100:8080,
api_token: your-api-token,
timeout_seconds: 30,
default_sender: +1234567890,
retry_count: 3
}
选项 3:命令行参数
所有脚本均支持 --url 和 --token 标志:
bash
./scripts/send_sms.sh --url http://192.168.1.100:8080 --token token --to +1234567890 --message 你好
capcom6/android-sms-gateway 配置
环境变量
bash
export SMSGATEWAYURL=http://192.168.1.100:8080 # 本地服务器
export SMSGATEWAYURL=https://api.sms-gate.app/3rdparty/v1 # 云端
export SMS
GATEWAYUSER=your-username
export SMS
GATEWAYPASS=your-password
export SMS
GATEWAYTIMEOUT=30
配置文件
创建 ~/.openclaw/sms-gateway-capcom6.json:
json
{
gateway_url: http://192.168.1.100:8080,
gateway_user: your-username,
gateway_pass: your-password,
server_mode: local,
timeout_seconds: 30
}
使用示例
bash
发送短信
./scripts/send
smscapcom6.sh --to +1234567890 --message 你好
云端模式
./scripts/send
smscapcom6.sh --mode cloud --to +1234567890 --message 你好
注册接收短信的 Webhook
./scripts/register
webhookcapcom6.sh --url https://your-server.com/webhook
群发(单次 API 调用多收件人)
./scripts/bulk
smscapcom6.sh --multi --recipients +1234567890,+0987654321 --message 警报
检查状态
./scripts/check
statuscapcom6.sh
保存到 TOOLS.md
将配置添加到 TOOLS.md 以供参考:
markdown
Android 短信网关
- - 应用: SMS Gateway API (itsmeichigo/SMSGateway)
- 手机: 三星 Galaxy,IP:192.168.1.100
- 端口: 8080
- 令牌: 存储在 ~/.openclaw/sms-gateway.json (chmod 600)
API 参考
有关每个支持应用的详细 API 端点,请参见 references/api_reference.md。
安全注意事项
网络安全
- - 仅限局域网: 尽可能将网关保留在本地网络
- 防火墙: 限制对网关端口的访问
- HTTPS: 如果对外暴露,请使用 HTTPS(需要应用支持)
- VPN: 使用 VPN 进行远程访问,而非端口转发
capcom6 特定安全
| 功能 | 优势 |
|---|
| 端到端加密 | 消息内容在 API 传输前已加密 |
| 私有服务器 |
部署自己的后端(无云端依赖) |
|
基本认证 | 标准 HTTP 认证 |
|
Webhook | 接收消息直接从设备推送 |
建议: 使用 capcom6 的私有服务器模式以获得最大安全性:
https://docs.sms-gate.app/getting-started/private-server/
认证
- - 强令牌: 使用随机 API 令牌(32 个字符以上)
- 令牌轮换: 定期轮换令牌
- 文件权限: chmod 600 ~/.openclaw/sms-gateway.json
速率限制
- - 避免垃圾信息: 在工作流中实施发送限制
- 运营商限制: 遵守短信运营商速率限制(约 1 条/秒)
- 队列系统: 群发时使用队列
故障排除
网关无响应
bash
检查手机连接
ping 手机IP
检查 API 端点
curl -v http://手机IP:8080/api/v1/status
检查应用是否运行(在手机上)
- 打开短信网关应用
- 确认服务器已启动
- 查看应用日志
认证失败
bash
验证令牌
curl -v http://手机IP:8080/api/v1/status -H Authorization: Bearer 你的令牌
检查令牌格式(某些应用使用不同的认证头)
参见 references/api_reference.md 了解应用特定认证
消息未发送
bash
检查手机信号
检查短信余额/套餐
检查应用日志
验证收件人号码格式(包含国家代码)
使用示例
安全警报系统
bash
扫描发现问题时发送警报
./scripts/send_sms.sh --to +1234567890 \
--message 🛡️ 警报:在 192.