# Twilio WhatsApp Setup Guide ## ๐Ÿ”‘ **Step 1: Get Twilio Credentials** 1. **Sign up for Twilio:** - Go to https://console.twilio.com/ - Create a free account 2. **Get Account SID and Auth Token:** - In Twilio Console, go to Dashboard - Copy your Account SID (starts with `AC...`) - Copy your Auth Token 3. **Enable WhatsApp Business API:** - Go to Messaging โ†’ WhatsApp - Follow the setup instructions - Get your WhatsApp number ## ๐Ÿ“ฑ **Step 2: WhatsApp Group ID** ### **Option A: Using Twilio Console** 1. In Twilio Console, go to Messaging โ†’ WhatsApp 2. Look for your group in the list 3. Copy the Group ID (format: `g.1234567890@group`) ### **Option B: Manual Discovery** 1. Open WhatsApp Web 2. Go to your target group 3. Check the URL or use browser dev tools 4. Look for group ID in the page source ### **Option C: Test with Sample Group** For testing, you can use a sample group ID: ``` g.1234567890@group ``` ## โš™๏ธ **Step 3: Environment Configuration** Add these to your `.env` file: ```bash # Twilio Credentials TWILIO_ACCOUNT_SID=AC...your_account_sid_here TWILIO_AUTH_TOKEN=your_auth_token_here # WhatsApp Configuration TWILIO_WHATSAPP_NUMBER=+1234567890 WHATSAPP_GROUP_ID=g.1234567890@group ``` ## ๐Ÿงช **Step 4: Test the Setup** ```bash # Test WhatsApp integration python test_whatsapp.py # Test complete system python test_real_ai.py ``` ## ๐Ÿ” **Troubleshooting** ### **Common Issues:** 1. **"Invalid Account SID"** - Check your Account SID starts with `AC` - Verify it's copied correctly 2. **"Authentication failed"** - Check your Auth Token - Make sure it's the correct token 3. **"WhatsApp number not found"** - Verify your WhatsApp number is activated - Check the number format (+1234567890) 4. **"Group not found"** - Verify the group ID format - Make sure the group exists - Check if you have permission to send to the group ## ๐Ÿ“ž **Support** - **Twilio Documentation:** https://www.twilio.com/docs/whatsapp - **WhatsApp Business API:** https://developers.facebook.com/docs/whatsapp - **Twilio Support:** https://support.twilio.com/ ## ๐ŸŽฏ **Next Steps** Once configured: 1. Test with mock data first 2. Send a test alert to your group 3. Monitor the alerts in your WhatsApp group 4. Fine-tune the alert timing and content