An AI-powered email outreach automation system built with PortiaAI SDK, FastAPI backend, and React frontend.
- AI-Powered Research: Automatically researches companies using Tavily API
- Personalized Email Generation: Creates customized emails using OpenAI's LLM
- Gmail Integration: Sends emails directly through Gmail with OAuth authentication
- File Processing: Supports PDF resume extraction, CSV lead import, and text files
- Real-time Updates: Live progress tracking via Server-Sent Events (SSE)
- Authentication Flow: Handles OAuth redirects seamlessly for Gmail access
- PortiaAI Agent: Orchestrates the entire email outreach workflow
- File Processing: Extracts text from PDFs, parses CSV files
- Session Management: Tracks processing states and real-time updates
- SSE Streaming: Provides live updates to the frontend
- OAuth Handling: Manages Gmail authentication through PortiaAI
- Modern UI: Dark-themed interface with gradient styling
- Real-time Updates: Live progress tracking during processing
- File Upload: Drag-and-drop support for attachments
- Authentication: Seamless OAuth redirect handling
- Responsive Design: Works on desktop and mobile devices
- API Keys Required:
-
Navigate to backend directory:
cd backend -
Install dependencies:
pip install -r requirements.txt
-
Create environment file:
cp .env.example .env
-
Configure environment variables in
.env:# Required PORTIA_API_KEY=your_portia_api_key_here OPENAI_API_KEY=your_openai_api_key_here TAVILY_API_KEY=your_tavily_api_key_here
-
Start the backend server:
uvicorn server:app --reload --host 0.0.0.0 --port 8000
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
yarn install
-
Set API URL (optional, defaults to localhost:8000):
echo "REACT_APP_API_URL=http://localhost:8000" > .env
-
Start the development server:
yarn start
-
Open the application: Navigate to http://localhost:3000
-
Enter Lead Information:
- Add lead details in the text area (emails, company names, etc.)
- Optionally provide additional context
- Enter your email for authentication
-
Upload Attachments (optional):
- Resume (PDF)
- Lead lists (CSV)
- Additional context (TXT)
-
Start Processing:
- Click "Start AI Email Outreach"
- Watch real-time progress updates
-
Authentication (when prompted):
- Click the Gmail authentication link
- Grant necessary permissions
- Return to the application (processing will resume)
-
Review Results:
- View the completion summary
- Check final outputs and plan execution details
The backend provides the following main endpoints:
POST /api/process-leads- Start email outreach processingGET /api/status/{session_id}- Stream real-time updates (SSE)GET /api/session/{session_id}- Get session statusPOST /api/upload-files- Upload and process filesPOST /api/resolve-clarification- Resolve user input clarificationsDELETE /api/session/{session_id}- Cleanup session
The system uses PortiaAI as the orchestration layer:
- Plan Generation: Creates dynamic execution plans based on user input
- Tool Execution: Uses Gmail Send, Tavily Search, and custom file processing tools
- Clarification Handling: Manages OAuth authentication and user confirmations
- Streaming Updates: Provides real-time progress via execution hooks
- Input Analysis: Parses lead information and uploaded files
- Company Research: Uses Tavily API to research target organizations
- Email Generation: Creates personalized emails using OpenAI's LLM
- Authentication: Handles Gmail OAuth if not already authenticated
- Email Sending: Delivers emails through Gmail API
- Results: Returns execution summary and final outputs
- Code Formatting:
black . && isort . - Linting:
flake8 - Type Checking:
mypy . - Testing:
pytest
- Development Server:
yarn start - Build:
yarn build - Testing:
yarn test
-
PortiaAI Authentication Errors:
- Verify your PortiaAI API key is correct
- Check you have access to PortiaAI Cloud features
-
Gmail Authentication Fails:
- Ensure the OAuth redirect URL is properly configured
- Check that the PortiaAI Gmail tool is available
-
File Processing Errors:
- Verify file formats are supported (PDF, CSV, TXT)
- Check file size limits
-
Real-time Updates Not Working:
- Ensure CORS is properly configured
- Check that SSE connections are not blocked
The backend provides detailed logging. Check the console output for:
- PortiaAI plan generation and execution
- File processing results
- Authentication flows
- Error details
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.