108 lines
2.6 KiB
Markdown
108 lines
2.6 KiB
Markdown
# OmegaBaSMS
|
|
|
|
Forward WhatsApp group messages to SMS — batched and free.
|
|
|
|
## How it works
|
|
|
|
- Monitors specified WhatsApp groups via WhatsApp Web
|
|
- Queues incoming messages for a configurable interval (default 30s)
|
|
- Flushes all queued messages as a single SMS via **TextBee** (uses your Android phone's mobile plan)
|
|
- If the WhatsApp session expires, sends the QR code to **Telegram** for easy re-auth
|
|
|
|
## Requirements
|
|
|
|
- Node.js 18+
|
|
- Android phone with mobile plan (for TextBee)
|
|
- Telegram account (for QR re-auth notifications)
|
|
|
|
## Setup
|
|
|
|
### 1. TextBee (SMS Gateway)
|
|
|
|
1. Create a free account at [textbee.dev](https://textbee.dev)
|
|
2. Install the TextBee app on your Android phone
|
|
3. In the dashboard, register your device (scan QR with the app)
|
|
4. Copy your **Device ID** and **API key**
|
|
|
|
### 2. Telegram Bot (QR re-auth)
|
|
|
|
1. Open Telegram, search for `@BotFather`, send `/newbot`
|
|
2. Choose a name and username, get the **bot token**
|
|
3. Message your bot once, then visit:
|
|
`https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates`
|
|
4. Copy your **chat ID** from the response
|
|
|
|
### 3. Configuration
|
|
|
|
Copy the example env file and fill in your details:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
```env
|
|
# WhatsApp groups to monitor (comma-separated)
|
|
GROUP_NAMES=MyGroup,AnotherGroup
|
|
|
|
# TextBee
|
|
TEXTBEE_DEVICE_ID=your_device_id
|
|
TEXTBEE_API_KEY=your_api_key
|
|
SMS_RECIPIENT=+972501234567
|
|
|
|
# Telegram
|
|
TELEGRAM_BOT_TOKEN=your_bot_token
|
|
TELEGRAM_CHAT_ID=your_chat_id
|
|
|
|
# Batch settings (30s for testing, 900000 = 15min for production)
|
|
BATCH_INTERVAL_MS=30000
|
|
BATCH_MAX_CHARS=700
|
|
|
|
# Your name shown in forwarded messages
|
|
INCLUDE_OWN_MESSAGES=true
|
|
OWN_NAME=Dvir
|
|
OWN_LAST_NAME=
|
|
```
|
|
|
|
### 4. Run
|
|
|
|
```bash
|
|
npm start
|
|
```
|
|
|
|
On first run, scan the QR code with WhatsApp on your phone. The session is saved for next time.
|
|
|
|
## Log format
|
|
|
|
```
|
|
[12:34:56] [INIT] Starting OmegaBaSMS...
|
|
[12:34:56] [INIT] Launching WhatsApp Web...
|
|
[12:34:58] [QR] New QR code received — scan with WhatsApp
|
|
[12:35:10] [READY] WhatsApp connected successfully
|
|
[13:01:23] [QUEUE] Queue #1 - Message from Dvir, flushed at 13:16
|
|
[13:16:23] [INFO] Flushed 2 messages
|
|
```
|
|
|
|
## Batch messaging
|
|
|
|
Messages are queued and flushed together to avoid SMS spam:
|
|
|
|
```
|
|
[GroupName]
|
|
Dvir: Hey everyone
|
|
Dudi: What's up?
|
|
Dvir: Meeting at 5
|
|
```
|
|
|
|
## Project structure
|
|
|
|
```
|
|
OmegaBaSMS/
|
|
├── index.js # Main — WhatsApp client, queue, logging
|
|
├── config.js # Reads from .env
|
|
├── sms.js # TextBee API
|
|
├── telegram.js # Telegram notification
|
|
├── .env # Your secrets (git-ignored)
|
|
├── .env.example # Template
|
|
└── package.json
|
|
```
|