AI + human hybrid email automation. Switch between AI and human control anytime, per conversation.
MailFlow is a full-stack email automation client that lets you manage client conversations with a WhatsApp-style UI. Toggle between AI auto-responses and human takeover on any thread, with full privacy isolation between agents.
- Toggle AI on/off per conversation using a built-in toggle button
- When AI is enabled, it automatically sends emails to clients without manual intervention
- Any human agent can take over a conversation instantly — AI hands off cleanly
- AI responses are clearly tagged with an AI label in the chat UI
- Only the assigned agent can view and respond to their conversation thread
- Chat history is invisible to other agents — complete session isolation
- No cross-agent data leakage across concurrent active sessions
- A new client entry is automatically created when a conversation is started
- WhatsApp-style scrollable chat interface with full message history
- AI and human messages are visually differentiated with labels
- Send to 100+ recipients simultaneously
- All outbound emails are sent from your authenticated Google account
- Login with your personal or company Google account
- All emails sent and received are routed through your authenticated Gmail account
- Powered by Groq API out of the box
- Architected to swap to any other LLM provider with minimal code changes
- AI is prompt-engineered to respond in a consistent, professional tone
| Layer | Technology |
|---|---|
| Frontend | HTML, CSS, JavaScript |
| Backend | Go |
| Gmail API (Google OAuth) | |
| AI | Groq API (swappable) |
| Deployment | Render |
- Go 1.26+
- A Google account with Gmail API enabled
- A Groq API key (or any other LLM provider key)
git clone https://github.com/Goofy-elf1/MailFlow.git
cd MailFlowgo mod tidyCreate a .env file in the root:
GROQ_API_KEY=your_groq_api_key
GROQ_MODEL=openai/gpt-oss-120b
GMAIL_CLIENT_ID=your_google_client_id
GMAIL_CLIENT_SECRET=your_google_client_secret
GMAIL_REDIRECT_URI=http://localhost:3000/auth/callback
SESSION_SECRET=your_session_secretGOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_REDIRECT_URI are also accepted for compatibility.
- Go to Google Cloud Console
- Create a new project
- Enable the Gmail API
- Create OAuth 2.0 credentials
- Add your redirect URI
For local testing, add the exact localhost callback you use, such as:
http://localhost:3000/auth/callback
If you run on another local port, add that exact callback too, for example http://localhost:5300/auth/callback.
go run ./backendVisit http://localhost:3000
MailFlow uses Groq by default but is built to be provider-agnostic. To switch providers:
- Replace the Groq client initialization in
backend/with your preferred provider's SDK - Update your
.envwith the new API key - Adjust the model name in the AI config
Tested providers: Groq (Llama 3). Compatible with: OpenAI, Anthropic, Mistral, and any OpenAI-compatible API.
MailFlow can be deployed on Render as a Web Service.
- Create a new Web Service and connect your repo
- Set Build Command to
go build -o server ./backend - Set Start Command to
./server - Add your environment variables (
APP_ENV=production,GMAIL_CLIENT_ID,GMAIL_CLIENT_SECRET,GMAIL_REDIRECT_URI,GROQ_API_KEY,GROQ_MODEL,SESSION_SECRET,FROM_NAME) in the Render dashboard - Add your Render callback URL (
https://<your-app>.onrender.com/auth/callback) to Google Cloud Console authorized redirect URIs
- Login with your Google account — all emails are sent from this address
- Start a conversation — a client entry is created automatically
- Toggle AI mode — AI handles replies automatically when enabled
- Take over anytime — click the toggle to switch to human mode and respond manually
- Bulk send — use the bulk mail option to reach 100+ clients at once