6.5 KiB
6.5 KiB
✅ Bug Fixes Complete - Testing Guide
What Was Fixed 🔧
1. Duplicate Guest Finder (404 Error)
- Problem: GET
/guests/duplicatesendpoint didn't exist - Solution: Added event-scoped endpoints with proper authorization
GET /events/{eventId}/guests/duplicates?by=phone|email|name- Find duplicatesPOST /events/{eventId}/guests/merge- Merge duplicate guests
- Backend Changes:
- Added
find_duplicate_guests()CRUD function (60 lines) - Added
merge_guests()CRUD function (56 lines) - Added 2 new API endpoints in main.py (65 lines)
- Added
- Frontend Changes:
- Updated
api.js- getDuplicates() and mergeGuests() now send eventId - Updated
DuplicateManager.jsx- Accepts and passes eventId prop - Updated
GuestList.jsx- Passes eventId to DuplicateManager component
- Updated
2. WhatsApp Configuration
- New File:
.env.examplewith complete WhatsApp setup guide - Includes:
- Where to get each Meta credential
- Template variable explanations
- Example Hebrew template structure
- Production deployment checklist
- Quick setup steps
3. Backend Server
- ✅ Python syntax verified (no errors in crud.py, main.py)
- ✅ Backend restarted with new duplicate endpoints loaded
- ✅ Server running on http://localhost:8000
4. Frontend Build
- ✅ Frontend rebuilt with all updates
- ✅ New JavaScript bundle ready to serve
How to Test 🧪
Test 1: Duplicate Finder
-
Open the app:
http://localhost:5173/events/ee648859-2cbf-487a-bdce-bd780d90e6e3/guests(test event with 870 guests)
-
Click: "🔍 חיפוש כפולויות" button
- Should show a modal asking which field to check
- Select "Phone" (טלפון)
-
Expected Result:
- Modal shows list of duplicate groups
- Each group shows guests with same phone number
- Count visible (e.g., "3 כפולויות")
-
If it fails:
- Check browser console (F12) for errors
- Check backend logs for 404/500 errors
- Verify eventId is being passed correctly
Test 2: WhatsApp Send Button
-
In the same guest list:
- Select 1 or more guests using checkboxes ☑️
-
Button should appear:
- "💬 שלח בוואטסאפ (n)" button appears above the guest table
- Where n = number of selected guests
-
Click the button:
- WhatsApp modal should open
- Shows:
- Preview of selected guests
- Form for Event details (partner names, venue, time, RSVP link)
- Live preview of WhatsApp message in Hebrew
- Send button
-
If button doesn't appear:
- Make sure you actually selected guests (checkbox checked)
- Hard refresh in browser:
Ctrl+Shift+RorCmd+Shift+R - Check browser console (F12) for component errors
-
If modal won't open:
- Check browser console for errors
- Verify event data loads properly
.env.example Setup 📝
Create your .env file from the template:
-
Copy .env.example to .env (don't commit this to git!)
-
Fill in these required fields:
# Database (should already work locally) DATABASE_URL=postgresql://wedding_admin:Aa123456@localhost:5432/wedding_guests # Admin login (change in production!) ADMIN_USERNAME=admin ADMIN_PASSWORD=wedding2025 # WhatsApp (from Meta Business Manager) WHATSAPP_ACCESS_TOKEN=EAAxxxxxxxx... [get from Meta] WHATSAPP_PHONE_NUMBER_ID=123456789... [from your WhatsApp number settings] WHATSAPP_API_VERSION=v20.0 [no change needed] WHATSAPP_TEMPLATE_NAME=wedding_invitation [must match Meta exactly] WHATSAPP_LANGUAGE_CODE=he [Hebrew - adjust if different] -
To get WhatsApp credentials:
- Go to https://developers.facebook.com/
- Select your WhatsApp Business Account
- Navigate to Settings → Apps & Sites
- Generate a permanent access token with these scopes:
- whatsapp_business_messaging
- whatsapp_business_management
- Find your Phone Number ID in API Setup
- Get your template name from Message Templates (must be APPROVED)
Files Modified Summary 📋
| File | Changes | Status |
|---|---|---|
backend/crud.py |
+116 lines: find_duplicate_guests(), merge_guests() | ✅ Syntax OK |
backend/main.py |
+65 lines: 2 duplicate endpoints with auth | ✅ Syntax OK |
frontend/src/api.js |
Updated getDuplicates(), mergeGuests() signatures | ✅ Built |
frontend/src/components/DuplicateManager.jsx |
Added eventId prop, updated API calls | ✅ Built |
frontend/src/components/GuestList.jsx |
Pass eventId to DuplicateManager | ✅ Built |
.env.example |
NEW: Complete setup guide + credentials | ✅ Created |
Next Steps 📌
- Fill in
.envfile with your WhatsApp credentials - Test duplicate finder in guest list
- Test WhatsApp button visibility
- Test WhatsApp sending (requires valid Meta credentials)
- Verify both Hebrew RTL layouts display correctly
- Check browser console for any warnings
Troubleshooting 🆘
Backend won't start?
# Check Python syntax
python -m py_compile backend/crud.py backend/main.py
# Look for database connection errors
# Make sure PostgreSQL is running
# Check DATABASE_URL in .env
Duplicate finder returns 404?
- Clear browser cache: F12 → Right-click refresh → "Empty cache and hard refresh"
- Check backend logs for "GET /events/{eventId}/guests/duplicates"
- Verify eventId is being passed in API call
WhatsApp button not visible?
- Make sure you select at least 1 guest (checkbox)
- Hard refresh browser
- Check console for component errors
- Verify GuestList.jsx has the button code
WhatsApp not sending?
- Verify WHATSAPP_ACCESS_TOKEN in .env
- Verify WHATSAPP_PHONE_NUMBER_ID is correct
- Check that template is APPROVED in Meta (not pending)
- Check backend logs for API errors
Key Endpoints Created 🔑
Duplicate Management
GET /events/{event_id}/guests/duplicates?by=phone
Response: { "duplicates": { "phone_number": [guest1, guest2, ...], ... } }
POST /events/{event_id}/guests/merge
Body: { "keep_id": "uuid", "merge_ids": ["uuid1", "uuid2", ...] }
Response: { "success": true, "message": "Merged X guests" }
WhatsApp Sending
POST /events/{event_id}/guests/{guest_id}/whatsapp/invite
Single guest invitation
POST /events/{event_id}/whatsapp/invite
Bulk guest invitations (rate-limited with 0.5s delay)
Status: ✅ All fixes applied, backend restarted, frontend rebuilt Ready to test: Yes Need from you: WhatsApp credentials in .env file