This project automatically sends daily Bible verses to a WhatsApp group using Cloudflare Workers and the WhatsApp HTTP API.
- Daily scheduled delivery of Bible verses
- Typing indicators simulation (can be disabled)
- Romanian date formatting
- Basic authentication for API endpoints
To get your WhatsApp Chat ID and configure WAHA:
-
Install Docker if not already installed:
# For macOS (with Homebrew): brew install --cask docker # Start Docker Desktop open -a Docker
-
Download and run WAHA:
docker-compose up
-
Open the WAHA dashboard:
open http://localhost:3000/dashboard
- default credentials:
dev
/dev-password
- default credentials:
-
In the dashboard:
- Start a new session (leave settings as default)
- Scan the QR code with your WhatsApp mobile app
- Wait for status to change to "WORKING"
-
To get your group chat ID:
- Open the group in WhatsApp
- Click the group name to view group info
- Scroll to the bottom to find the group invite link
- The chat ID is the part after https://chat.whatsapp.com/
- Format it as: 120363367569467119@g.us
-
Add the chat ID to your .env file:
WHATSAPP_CHAT_ID="your-group-id@g.us"
- Node.js (v18 or higher)
- npm or yarn
- Cloudflare Workers CLI (wrangler)
- WhatsApp HTTP API instance
-
Clone the repository:
git clone https://github.com/radio-crestin/versetul-zilei-whatsapp.git cd versetul-zilei-whatsapp
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.example
to.env
and.dev.vars
- Copy
.dev.vars.example
to.dev.vars
- Update the values with your actual credentials
Example
.env
file:WHATSAPP_API_URL="http://localhost:3000" WHATSAPP_CHAT_ID="120363367569467119@g.us" WHATSAPP_SESSION="default" WHATSAPP_AUTH_USER="dev" WHATSAPP_AUTH_PASS="dev-password" WHATSAPP_GROUP_URL="https://chat.whatsapp.com/Fpezp7iQlxT2oexlxs3kN4"
- Copy
-
Start local development server:
npm run dev
-
Install Wrangler CLI if not already installed:
npm install -g wrangler
-
Login to Cloudflare:
wrangler login
-
Update
wrangler.toml
with your Cloudflare account details -
Deploy to Cloudflare Workers:
wrangler deploy
Variable | Description | Example Value |
---|---|---|
WHATSAPP_API_URL | URL of your WhatsApp HTTP API instance | http://localhost:3000 |
WHATSAPP_CHAT_ID | WhatsApp group chat ID | 120363367569467119@g.us |
WHATSAPP_SESSION | WhatsApp session name | default |
WHATSAPP_AUTH_USER | Basic auth username for WhatsApp API | dev |
WHATSAPP_AUTH_PASS | Basic auth password for WhatsApp API | dev-password |
WHATSAPP_GROUP_URL | URL of the WhatsApp group | https://chat.whatsapp.com/Fpezp7iQlxT2oexlxs3kN4 |
The worker is configured to run daily at 5:30 AM UTC (7:30 AM Romania time) via the cron trigger in wrangler.toml
.
GET /
- Redirects to WhatsApp group URLGET /send-daily-verse
- Manually trigger verse sending- Optional query parameter:
?typing=false
to disable typing indicators
- Optional query parameter:
GET /__scheduled
- Internal endpoint for scheduled events
To manually test the verse sending:
curl "http://localhost:8787/send-daily-verse"
To test without typing indicators:
curl "http://localhost:8787/send-daily-verse?typing=false"
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature
) - Create a new Pull Request
MIT License
For support or feature requests, please open an issue on GitHub.