WhatsApp Bot
April 13, 2025 ยท View on GitHub
A simple bot that processes WhatsApp messages from an SQS queue and responds to them.
Setup
- Install dependencies:
pip install -r requirements.txt
- Copy the environment template and fill in your values:
cp .env.example .env
- Edit the
.envfile with your credentials:
APP_SQS_QUEUE: Your SQS queue URLWHATSAPP_API_TOKEN: Your WhatsApp Business API tokenWHATSAPP_PHONE_NUMBER_ID: Your WhatsApp phone number ID
Usage
Run the bot:
python whatsapp_bot.py
The bot will:
- Listen for messages in the specified SQS queue
- Mark received messages as read
- Reply with a transcription of audio messages.
- Delete processed messages from the queue
Error Handling
The bot includes error handling for:
- SQS connection issues
- WhatsApp API errors
- Message processing errors
Errors are logged to the console but won't stop the bot from running.