Skip to content

email agent with SQL Lite database and Microsoft Graph API via OAuth

Notifications You must be signed in to change notification settings

ATSiem/email-agent-workshop

 
 

Repository files navigation

AI Email Assistant with Client Communication Reports

This application helps you manage your email communications by automatically processing incoming emails, summarizing them, and generating client-specific reports. It combines Next.js, TypeScript, the Vercel AI SDK, and SQLite to create a powerful AI agent for email management.

Features

Email Processing

  • Automatic email collection via webhook endpoint
  • AI-powered email summarization and labeling
  • Clean email display with signature removal
  • Threading support for related emails

Client Management

  • Create and manage clients with their domains and email addresses
  • Filter emails by client domains and addresses
  • Organize communications by client for better relationship management

Communication Reports

  • Generate detailed client communication reports
  • Customizable report formats with placeholders
  • Save and reuse report templates
  • AI synthesizes emails into structured reports with key topics, action items, and more

Custom Report Templates

  • Create fully customizable report templates
  • Use dynamic placeholders like {summary}, {key_topics}, {action_items}
  • Add your own custom placeholders (e.g., {key_technologies}, {project_status}, {stakeholders})
  • The AI intelligently generates content for any placeholder you define

Getting Started

  1. Clone this repository
  2. Create a .env file based on .env.example with your:
    • OPENAI_API_KEY - Get from OpenAI Platform
    • WEBHOOK_SECRET - Random string for webhook security
  3. Install dependencies: npm install
  4. Start the development server: npm run dev
  5. For webhook testing, use npm run dev:webhook with smee.io

Technology Stack

  • Frontend: Next.js, React, TailwindCSS
  • Backend: Next.js API Routes
  • Database: SQLite with Drizzle ORM
  • AI: OpenAI GPT-4o via Vercel AI SDK
  • Authentication: Microsoft OAuth

How It Works

Email Collection

Emails are received via a webhook endpoint that can be connected to email services like Gmail using Google Apps Script. The system validates, processes, and stores these emails with AI-generated summaries and labels.

Client Reports

The application analyzes emails related to specific clients and generates comprehensive reports that summarize communications, highlight key topics, identify action items, and more. Reports are fully customizable with templates that support any placeholder fields you define.

Creating Custom Reports

When creating a report, you can:

  1. Select a client to filter relevant emails
  2. Choose a date range for the report
  3. Use an existing template or create your own format
  4. Add custom placeholders for specialized content

The AI will intelligently fill in all placeholders based on your email content, producing a comprehensive client communication report.

Custom Placeholders

The reporting system supports unlimited custom placeholders. Some examples:

  • {client_name} - Client's name
  • {date_range} - Period covered by the report
  • {summary} - Overall communication summary
  • {key_topics} - Main topics discussed
  • {action_items} - Tasks to be completed
  • {next_steps} - Upcoming actions
  • {key_technologies} - Technologies mentioned in emails
  • {project_status} - Overview of project status
  • {stakeholders} - Key people mentioned
  • {open_questions} - Questions that need answers
  • {decision_summary} - Summary of decisions made

You can add any placeholder that makes sense for your reporting needs, and the AI will generate appropriate content by analyzing your email communications.

License

MIT

About

email agent with SQL Lite database and Microsoft Graph API via OAuth

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.5%
  • CSS 2.4%
  • JavaScript 0.1%