A comprehensive Django REST Framework application for creating, managing, and attending events with smart WhatsApp integration.
This Event Management API allows users to create events, generate registration links, manage attendees, and implement automated reminders via email and WhatsApp. It also includes a WhatsApp integration with Google's Gemini AI model that can answer attendee questions based on event descriptions.
- User Authentication: Register and manage user accounts with phone number support
- Event Management: Create, read, update, and delete events
- Event Registration: Generate unique links for attendees to register for events
- Attendee Management: Track and manage event attendees
- Automated Reminders: Send scheduled reminders via email and WhatsApp as events approach
- WhatsApp Integration: Answer questions about events using Google Gemini AI
- Public Event Listing: View all available events
- Backend: Django 4.2+ and Django REST Framework
- Database: PostgreSQL (recommended)
- Task Queue: Celery with Redis for background tasks and scheduled reminders
- External APIs:
- WhatsApp Business API for messaging
- Google Gemini AI for natural language processing
- Python 3.8+
- PostgreSQL
- Redis
- Clone the repository
git clone https://github.com/yourusername/event-management-api.git
cd event-management-api- Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Set up environment variables
Create a .env file in the project root and add:
# Django
SECRET_KEY=your_secret_key
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# Database
DATABASE_URL=postgres://user:password@localhost:5432/eventdb
# Email
EMAIL_HOST=smtp.yourmailprovider.com
EMAIL_PORT=587
EMAIL_HOST_USER=your_email@example.com
EMAIL_HOST_PASSWORD=your_email_password
DEFAULT_FROM_EMAIL=events@yourdomain.com
# WhatsApp API
WHATSAPP_API_URL=https://your-whatsapp-api-endpoint.com/v1/messages
WHATSAPP_API_TOKEN=your_whatsapp_api_token
# Google Gemini AI
GEMINI_API_KEY=your_gemini_api_key
# Celery
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0- Set up the database
python manage.py migrate- Create a superuser
python manage.py createsuperuser- Start the Django development server
python manage.py runserver- Start Celery worker
celery -A main worker -l info- Start Celery beat for scheduled tasks
celery -A main beat -l infoPOST /api/register/- Register a new user with phone number -POST /api/login/- Login a user
GET /api/events/- List events created by the authenticated userPOST /api/events/- Create a new eventGET /api/events/{id}/- Get details of a specific eventPUT /api/events/{id}/- Update an eventDELETE /api/events/{id}/- Delete an eventGET /api/events/{id}/attendees/- List attendees for a specific eventGET /api/public-events/- List all public events
GET /api/register-event/{registration_link}/- View event details for registrationPOST /api/register-event/{registration_link}/- Register for an event as an attendee
The WhatsApp integration is handled via webhooks that are configured with your WhatsApp Business API provider. These webhooks will process incoming messages, interact with the Gemini AI, and deliver responses back to users.
curl -X POST http://localhost:8000/api/events/ \
-H "Authorization: Bearer {your_token}" \
-H "Content-Type: application/json" \
-d '{
"title": "TechyJaunty 2025",
"description": "Annual technology conference showcasing the latest innovations",
"location": "Obafemi Awolowo University",
"date": "2025-06-15T09:00:00Z"
}'curl -X POST http://localhost:8000/api/register-event/abc123-xyz456/ \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"phone_number": "+1234567890"
}'To set up the WhatsApp integration:
- Register with a WhatsApp Business API provider
- Configure your webhook URL to point to your application's WhatsApp webhook endpoint
- Set up the necessary environment variables for the WhatsApp API
- Configure Google Gemini AI with your API key
The application uses Celery to send automated reminders to attendees:
- 3 days before the event
- 1 day before the event
Reminders are sent via both email and WhatsApp (if a phone number is provided).