4.3 KiB
4.3 KiB
Quick Reference: Response Verification Feature
Quick Start
For Developers
# 1. Update database
./scripts/build-nocodb.sh
# 2. Update .env
echo 'APP_NAME="BNKops Influence"' >> .env
echo 'BASE_URL=http://localhost:3333' >> .env
# 3. Rebuild
docker compose build && docker compose up -d
# 4. Test at
open http://localhost:3333/response-wall.html?campaign=your-campaign-slug
For Testers
- Navigate to any campaign Response Wall
- Click "Share a Response"
- Enter postal code: T5K 2J1
- Click Search
- Select a representative
- Fill in response details
- Check "Send verification request"
- Submit
File Locations
Frontend
app/public/response-wall.html- Main pageapp/public/js/response-wall.js- Logicapp/public/css/response-wall.css- Styles
Backend
app/controllers/responses.js- Main controllerapp/services/email.js- Email serviceapp/templates/email/response-verification.*- Email templatesapp/routes/api.js- Route definitions
Database
scripts/build-nocodb.sh- Schema definitions
Documentation
IMPLEMENTATION_SUMMARY.md- Full implementation detailsDEPLOYMENT_GUIDE.md- Deployment instructionsRESPONSE_WALL_UPDATES.md- Feature documentation
Key Functions
Frontend (response-wall.js)
handlePostalLookup() // Searches by postal code
displayRepresentativeOptions() // Shows rep dropdown
handleRepresentativeSelect() // Auto-fills form
handleSubmitResponse() // Submits with verification
Backend (responses.js)
submitResponse() // Handles submission + verification
verifyResponse() // Verifies via token
reportResponse() // Reports as invalid
Email Service (email.js)
sendResponseVerification() // Sends verification email
API Endpoints
POST /api/campaigns/:slug/responses # Submit response
GET /api/responses/:id/verify/:token # Verify response
GET /api/responses/:id/report/:token # Report response
Database Fields
Table: influence_representative_responses
| Field | Type | Purpose |
|---|---|---|
| representative_email | Rep's email address | |
| verification_token | Text | 32-byte random hex |
| verification_sent_at | DateTime | When email sent |
| verified_at | DateTime | When verified |
| verified_by | Text | Who verified |
Environment Variables
APP_NAME="BNKops Influence"
BASE_URL=https://yourdomain.com
SMTP_HOST=smtp.provider.com
SMTP_PORT=587
SMTP_USER=email@domain.com
SMTP_PASS=password
SMTP_FROM_EMAIL=sender@domain.com
SMTP_FROM_NAME="Campaign Name"
Testing Checklist
Frontend:
- Postal search works
- Rep dropdown populates
- Form auto-fills
- Checkbox enables/disables
- Submission succeeds
Backend:
- Token generated
- Email sent
- Verification works
- Report works
- HTML pages display
Security:
- Invalid tokens rejected
- Duplicate verification handled
- XSS prevention working
Common Issues
Email Not Sending
- Check SMTP settings in
.env - Test at
/email-test.html - Check logs:
docker logs influence-app -f
Postal Search Fails
- Verify Represent API accessible
- Check postal code format (T5K 2J1)
- Check browser console for errors
Verification Link Fails
- Verify BASE_URL is correct
- Check token in database
- Check application logs
URLs for Testing
# Main page
http://localhost:3333/response-wall.html?campaign=test-campaign
# Verification (replace ID and TOKEN)
http://localhost:3333/api/responses/123/verify/abc123...
# Report (replace ID and TOKEN)
http://localhost:3333/api/responses/123/report/abc123...
Support
- Logs:
docker logs influence-app -f - Docs: See markdown files in project root
- Email Test: http://localhost:3333/email-test.html
Quick Troubleshooting
| Problem | Solution |
|---|---|
| No representatives found | Check postal code format (T5K 2J1) |
| Email not received | Check SMTP settings, spam folder |
| Verification fails | Check BASE_URL, token validity |
| Checkbox disabled | Representative has no email |
| Form won't submit | Check required fields, validation |
Last Updated: October 16, 2025 Version: 1.0.0