StargazeSign in
MAMas

Triage

AI email copilot for insurance agencies. Auto-categorize, draft, approve. Built for control.

Closed sourcesaasTypeScript1
Share on X

★ Embed badge

Paste it in your README. Updates live as you collect right-swipes.

Markdown[![Stargaze](https://stargaze.ashlr.ai/api/badge/triage-607eb3.svg)](https://stargaze.ashlr.ai/p/triage-607eb3)
HTML<a href="https://stargaze.ashlr.ai/p/triage-607eb3"><img src="https://stargaze.ashlr.ai/api/badge/triage-607eb3.svg" alt="Stargaze" /></a>
URLhttps://stargaze.ashlr.ai/api/badge/triage-607eb3.svg

From the README

Insurance Email Copilot

AI-powered email management for insurance agencies. Built by Ashlr.AI.

What is this?

A custom email tool that helps insurance agencies manage their inbox by:

  • Auto-categorizing incoming emails (claims, billing, quotes, etc.)
  • Generating draft responses using AI (Grok 4.1 Fast)
  • Approval workflow - humans review and approve before sending
  • Smart notifications - get alerted for urgent emails

Quick Start

Prerequisites

  • Node.js 18+
  • pnpm (npm install -g pnpm)
  • PostgreSQL database
  • Microsoft 365 account (for Graph API access)
  • xAI API key (for Grok)

Setup

  1. Clone the repo:
git clone <repo-url>
cd insurance-email-copilot
  1. Install dependencies:
pnpm install
  1. Copy environment variables:
cp .env.example .env
  1. Fill in your .env file (see Configuration below)

  2. Set up the database:

pnpm db:generate
pnpm db:migrate
  1. Run the development server:
pnpm dev
  1. Open http://localhost:3000

Configuration

Required Environment Variables

# Microsoft Graph API (Azure AD App Registration)
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
AZURE_TENANT_ID=common  # Use "common" for multi-tenant

# xAI Grok API
XAI_API_KEY=your-xai-api-key
XAI_MODEL=grok-4-1-fast-reasoning

# Database
DATABASE_URL=postgresql://user:pass@host:5432/dbname

# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=generate-a-random-secret

# Slack (optional)
SLACK_BOT_TOKEN=xoxb-your-token
SLACK_CHANNEL_ID=C0123456789

Microsoft Azure Setup

  1. Go to Azure Portal > Azure Active Directory > App Registrations
  2. New Registration:
    • Name: "Insurance Email Copilot"
    • Supported account types: "Accounts in any organizational directory" (multi-tenant)
    • Redirect URI: http://localhost:3000/api/auth/callback/azure-ad
  3. Note the Application (client) ID
  4. Create a client secret under Certificates & Secrets
  5. Add API permissions:
    • Microsoft Graph > Delegated:
      • Mail.Read
      • Mail.ReadWrite
      • Mail.Send
      • User.Read
      • offline_access

xAI API Setup

  1. Go to console.x.ai
  2. Create an API key
  3. You get $25 free credit to start

Project Structure

├── apps/
│   └── web/                 # Next.js frontend + API
├── packages/
│   ├── ai/                  # AI categorization + drafts
│   ├── email/               # Microsoft Graph client
│   ├── database/            # Prisma schema
│   └── shared/              # Shared types
└── docs/                    # Documentation

Development

Commands

pnpm dev          # Start development server
pnpm build        # Build for production
pnpm db:studio    # Open Prisma Studio (database GUI)
pnpm db:migrate   # Run database migrations
pnpm lint         # Run linter
pnpm test         # Run tests

Testing Webhooks Locally

Use ngrok to expose your local server:

ngrok http 3000

Then use the ngrok URL for Microsoft Graph webhook subscriptions.

Deployment

Vercel (Frontend)

  1. Connect your GitHub repo to Vercel
  2. Set environment variables in Vercel dashboard
  3. Deploy

Railway (Database)

  1. Create a PostgreSQL database on Railway
  2. Copy the connection string to DATABASE_URL
  3. Run migrations: pnpm db:migrate

API Reference

Webhook Endpoint

POST /api/webhook - Receives Microsoft Graph notifications

Draft Endpoints

  • GET /api/drafts - List pending drafts
  • POST /api/drafts/:id/approve - Approve and send
  • POST /api/drafts/:id/reject - Reject draft
  • PATCH /api/drafts/:id - Edit draft

Email Endpoints

  • GET /api/emails - List emails
  • GET /api/emails/:id - Get single email

Support

Built by Ashlr.AI for Valley Trust Insurance.

Questions? Contact mason@ashlr.ai

License

Proprietary - AshlrAI, Inc.

Like what you see?

Star this on Stargaze — auto-stars on GitHub when you swipe right.

Star this on Stargaze