A web application for organizing workplace gift exchanges with Slack bot integration. Features conversational onboarding, automatic matching, and timezone-aware gift reminders.
- Participant Management - Add, edit, and delete participants with full address details
- Slack Bot Integration - Import users from Slack and collect details via interactive DM conversations
- Smart Matching - Fisher-Yates shuffle algorithm with backtracking to handle exclusion rules
- Exclusion Rules - Prevent specific people from being matched (e.g., spouses, managers)
- Customizable Messages - Edit notification templates with placeholders
- Timezone-Aware Reminders - Send reminders at 10:00 AM in each user's local time
- Gift Tracking - Track which gifts have been sent
- Password Protection - Secure admin access with session-based authentication
- Frontend: React 18, TypeScript, Vite, Tailwind CSS, Shadcn/ui
- Backend: Express.js, TypeScript
- Database: PostgreSQL with Drizzle ORM
- Integration: Slack API (Bot Token)
- Node.js 18+
- PostgreSQL database
- Slack workspace with admin access (for bot setup)
git clone https://github.com/YOUR_USERNAME/secret-santa-manager.git
cd secret-santa-managernpm install- Create a new PostgreSQL database:
createdb secret_santaOr use a hosted PostgreSQL service (Neon, Supabase, Railway, etc.)
- Note your database connection URL in this format:
postgresql://USERNAME:PASSWORD@HOST:PORT/DATABASE_NAME
Create a .env file in the root directory:
# Database Configuration (Required)
DATABASE_URL=postgresql://username:password@localhost:5432/secret_santa
# Session Secret (Required) - Generate a random string
SESSION_SECRET=your-random-session-secret-at-least-32-characters
# App Password (Required) - Password to access the admin dashboard
APP_PASSWORD=your-secure-password
# Slack Bot Token (Optional) - Can also be configured via UI
SLACK_BOT_TOKEN=xoxb-your-slack-bot-tokenYou can generate a secure session secret using:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"Push the database schema to your PostgreSQL database:
npm run db:pushThis creates all necessary tables:
participants- Stores participant informationevents- Tracks Secret Santa eventsassignments- Gift giver/receiver pairsexclusions- Forbidden matching pairsslack_settings- Slack bot configurationslack_contacts- Imported Slack usersslack_onboarding_sessions- Bot conversation state
- Go to Slack API Apps
- Click Create New App > From scratch
- Name your app (e.g., "Secret Santa Bot") and select your workspace
- Go to OAuth & Permissions in the sidebar
- Under Scopes > Bot Token Scopes, add:
chat:write- Send messagesusers:read- Read user infousers:read.email- Read user emailsim:write- Open DM channelsim:history- Read DM history
- Go to Event Subscriptions
- Enable Events
- Set Request URL to:
https://YOUR_DOMAIN/api/slack/events - Under Subscribe to bot events, add:
message.im- Receive DM messages
- Go to Install App in the sidebar
- Click Install to Workspace
- Authorize the permissions
- Copy the Bot User OAuth Token (starts with
xoxb-)
npm run devThe app will be available at http://localhost:5000
npm run build
npm start- Open
http://localhost:5000in your browser - Enter your
APP_PASSWORDto log in - Configure Slack (if not done via environment variable):
- Click Connect Slack
- Paste your Bot Token
- Set an Admin Contact person for notifications
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string |
SESSION_SECRET |
Yes | Secret for session encryption (32+ chars) |
APP_PASSWORD |
Yes | Password to access the admin dashboard |
SLACK_BOT_TOKEN |
No | Slack bot token (can be set via UI instead) |
PORT |
No | Server port (default: 5000) |
You can configure the Slack bot directly in the app:
- Click Connect Slack on the dashboard
- Paste your Bot Token
- Click Set Admin Contact to choose who receives support messages
- Test the connection
Option 1: Manual Entry
- Click Add on the Participants card
- Fill in name, email, address, phone, and optional wishlist
- Click Save
Option 2: Import from Slack
- Click Import from Slack
- Select users to import as contacts
- Click Send Invitations to start bot onboarding
- Bot collects: name, country, city, ZIP, street, phone, delivery notes
- Completed contacts become participants automatically
- Click Manage Exclusions
- Select two people who should NOT be matched
- Add the exclusion (add both directions if needed)
- Ensure you have at least 3 participants
- Click Run Matching
- Review matches by clicking Reveal All Matches
- Click Message Template to customize the notification
- Available placeholders:
{{giver_name}}- Gift giver's name{{receiver_name}}- Recipient's name{{receiver_street}},{{receiver_city}},{{receiver_zip}},{{receiver_country}}{{receiver_phone}},{{receiver_notes}}{{admin_contact}}- Admin contact mention
- Click Send Notifications to notify all participants via Slack DM
- First reminder: 7 days after notification at 10:00 AM local time
- Subsequent reminders: Daily at 10:00 AM local time
- Reminders stop when gift is marked as sent
# Test your connection
psql $DATABASE_URL -c "SELECT 1"
# Check if tables exist
psql $DATABASE_URL -c "\dt"- Verify the bot token is correct
- Check that Event Subscriptions are enabled
- Ensure the Request URL is publicly accessible
- Check server logs for webhook errors
- Ensure
SESSION_SECRETis set - Check that cookies are enabled in your browser
- Clear cookies and try logging in again
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ └── lib/ # Utilities
├── server/ # Express backend
│ ├── index.ts # Server entry point
│ ├── routes.ts # API routes
│ └── storage.ts # Database operations
├── shared/ # Shared types
│ └── schema.ts # Database schema & types
├── package.json
├── tsconfig.json
├── vite.config.ts
└── drizzle.config.ts
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/login |
Login with password |
| GET | /api/auth/check |
Check authentication |
| GET | /api/participants |
List all participants |
| POST | /api/participants |
Create participant |
| PATCH | /api/participants/:id |
Update participant |
| DELETE | /api/participants/:id |
Delete participant |
| GET | /api/events/current |
Get current event |
| POST | /api/events/match |
Run matching algorithm |
| POST | /api/events/notify |
Send notifications |
| GET | /api/assignments |
Get all assignments |
| GET | /api/exclusions |
List exclusions |
| POST | /api/exclusions |
Add exclusion |
| GET | /api/slack/status |
Check Slack connection |
| POST | /api/slack/settings |
Save Slack settings |
| GET | /api/slack/users |
Fetch Slack users |
| POST | /api/slack/events |
Slack webhook endpoint |
MIT License - Feel free to use and modify for your own Secret Santa events!