A WhatsApp bot for sending Red Alert notifications using the Green API.
WAlert is a Python-based bot that monitors alert notifications from the Oref Website and forwards them via WhatsApp using the Green API. The bot categorizes and formats alerts, sending them to designated WhatsApp numbers in real-time. You can configure it to monitor specific regions and choose whether or not to receive test alerts.
You can install WAlert using either a Docker container or set it up as a systemd service for manual deployment.
docker pull techblog/walert:latest
docker run -d \
-e DEBUG_MODE="False" \
-e REGION="*" \
-e INCLUDE_TEST_ALERTS="False" \
-e GREEN_API_INSTANCE="your_green_api_instance" \
-e GREEN_API_TOKEN="your_green_api_token" \
-e WHATSAPP_NUMBER="your_whatsapp_number" \
--name walert your-dockerhub-user/walert:latest
version: "3.6"
services:
walert:
image: your-dockerhub-user/walert:latest
container_name: walert
restart: always
environment:
- DEBUG_MODE=False
- REGION=*
- INCLUDE_TEST_ALERTS=False
- GREEN_API_INSTANCE=your_green_api_instance
- GREEN_API_TOKEN=your_green_api_token
- WHATSAPP_NUMBER=your_whatsapp_number
To run with docker-compose:
docker-compose up -d
# Clone via Git
git clone https://github.com/your-repo/walert.git
cd walert
# Alternatively, download and extract the ZIP package
curl -LO https://github.com/your-repo/walert/archive/main.zip
unzip main.zip
cd walert-main
pip install -r requirements.txt
touch .env
Add the following to your .env file:
DEBUG_MODE=False
REGION=*
INCLUDE_TEST_ALERTS=False
GREEN_API_INSTANCE=your_green_api_instance
GREEN_API_TOKEN=your_green_api_token
WHATSAPP_NUMBER=your_whatsapp_number
Create a Systemd Service: To run the bot automatically as a service, you can configure it as a systemd service.
sudo nano /etc/systemd/system/walert.service
[Unit]
Description=WAlert - WhatsApp bot for Red Alert alarms
After=network.target
[Service]
User=your-username
WorkingDirectory=/path/to/walert
EnvironmentFile=/path/to/walert/.env
ExecStart=/usr/bin/python3 /path/to/walert/main.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Replace /path/to/walert with the actual path to your WAlert directory and your-username with your system username.
Reload systemd, enable, and start the service:
sudo systemctl daemon-reload
sudo systemctl enable walert
sudo systemctl start walert
sudo systemctl status walert
You can find the full documentation here on the Green API website.
Content type
Image
Digest
sha256:c39ccb7b8…
Size
166.3 MB
Last updated
about 2 years ago
docker pull techblog/walert