A sophisticated AI-powered research assistant that combines intelligent web research, beautiful formatting, and automated email delivery. This full-stack application leverages n8n automation workflows to provide seamless research experiences with professional presentation.
- Intelligent Web Research: Powered by Tavily search API for comprehensive web research
- AI-Powered Processing: Dual AI agents for research synthesis and HTML formatting
- Beautiful Output: Professional HTML formatting optimized for email clients
- PDF Generation: Automatic conversion to PDF format using PDForge
- Email Automation: Automated delivery of research results via Gmail integration
- Responsive Frontend: Modern React interface with real-time chat functionality
- Webhook Integration: RESTful API endpoints for seamless integration
- React 18 with TypeScript for type safety
- Vite for fast development and building
- Shadcn/ui for beautiful, accessible UI components
- Tailwind CSS for responsive styling
- React Query for efficient data fetching
- React Router for navigation
- n8n Workflow: Visual automation platform
- Webhook Trigger: Receives research requests via POST endpoint
- AI Research Agent: Processes queries using OpenAI GPT-4o-mini
- Tavily Integration: Performs comprehensive web searches
- HTML Styling Agent: Converts research into beautiful, email-safe HTML
- PDF Generation: Uses PDForge to create downloadable PDFs
- Gmail Integration: Automated email delivery with formatted results
- Node.js (v16 or higher)
- npm or yarn
- n8n instance (self-hosted or cloud)
- API Keys: OpenAI, Tavily, PDForge, Gmail
git clone <repository-url>
cd apricot-research-agentcd apricot-agent-ui
npm installCreate a .env file in the apricot-agent-ui directory:
# Add your API keys here if needed
VITE_API_URL=https://your-n8n-instance.comnpm run devThe application will be available at http://localhost:5173
- Copy the
Personalized Learning Assistant.jsonfile to your n8n instance - Import it into your n8n dashboard
- The workflow will be available as "Personalized Learning Assistant"
OpenAI API Key
- Create account at OpenAI Platform
- Generate API key
- Add as "OpenAI account 2" credential in n8n
Tavily API Key
- Create account at Tavily
- Generate API key
- Add as "Tavily account" credential in n8n
PDForge API Key
- Create account at [PDForge]
- Generate API key
- Add as "PDForge account" credential in n8n
Gmail OAuth2
- Enable Gmail API in Google Cloud Console
- Create OAuth2 credentials
- Add as "Gmail account" credential in n8n
The webhook endpoint is automatically generated when you import the workflow. Update the frontend API call in ChatInterface.tsx if using a different n8n instance:
const response = await fetch(
"https://your-n8n-instance.com/webhook/66fd6d27-e67d-4600-935b-17b21026c779",
// ... rest of the code
);- User Input: User enters research query and email in the chat interface
- Webhook Trigger: Request sent to n8n webhook endpoint
- AI Research: Research agent processes query using Tavily search
- Content Formatting: Styling agent converts to beautiful HTML
- Dual Output:
- Email: Formatted HTML sent to user's email
- PDF: Research compiled into downloadable PDF
- Web Response: Formatted content returned to frontend
- Utilizes OpenAI GPT-4o-mini for intelligent research synthesis
- Integrates Tavily search for comprehensive web research
- Performs multiple search iterations for thorough coverage
- Synthesizes information from multiple sources
- Converts research output to email-safe HTML
- Uses responsive design principles
- Ensures compatibility across email clients
- Applies professional formatting and styling
apricot-research-agent/
βββ apricot-agent-ui/ # React frontend
β βββ src/
β β βββ components/ # UI components
β β βββ pages/ # Page components
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utilities
β βββ public/ # Static assets
β βββ package.json # Dependencies
βββ n8n json/
βββ Personalized Learning Assistant.json # n8n workflow
- Main chat interface with email input
- Handles API communication with n8n
- Manages message state and loading states
- Displays formatted research results
- Handles markdown rendering
- Provides download and sharing options
- Custom markdown rendering component
- Supports research-specific formatting
Edit the system prompt in the n8n workflow to customize research behavior:
- Adjust search strategies
- Modify output formatting
- Add new research capabilities
Update the styling agent prompt to change:
- HTML structure
- CSS styling
- Email compatibility settings
POST /webhook/66fd6d27-e67d-4600-935b-17b21026c779
Content-Type: application/json
{
"prompt": "Your research query",
"email": "user@example.com"
}{
"formatted-research-content": "HTML formatted research results"
}The system automatically sends two emails:
- Research Results: Formatted HTML with research findings
- PDF Download: Link to downloadable PDF version
Email templates are optimized for:
- Gmail compatibility
- Mobile responsiveness
- Professional presentation
- Accessibility standards
- All API communications use HTTPS
- Credentials stored securely in n8n
- No personal data stored in frontend
- Webhook endpoints use unique identifiers
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is created by Madhav S Baidya. Please respect the intellectual property and give appropriate credit when using or referencing this work.
- n8n for the automation platform
- OpenAI for AI capabilities
- Tavily for web search functionality
- PDForge for PDF generation
- Shadcn/ui for beautiful UI components
For questions or support, please contact Madhav S Baidya or create an issue in the repository.
Built with β€οΈ by Madhav S Baidya

