A simple bot that processes WhatsApp messages from an SQS queue and responds to them.
- 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
Run the bot:
python whatsapp_bot.pyThe 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
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.