Skip to content

htaswell/gmail-return-assistant

Repository files navigation

Gmail Return Assistant

A React app that connects to your Gmail, finds order confirmation emails, and helps you track return deadlines using AI-powered policy lookups.

Features

  • Gmail Integration - Connects via Google OAuth to scan your inbox for order emails
  • Automatic Order Detection - Identifies purchases from retailers like Amazon, Target, Best Buy, H&M, ASOS, and more
  • AI-Powered Policy Search - Uses ChatGPT to look up return policies for each retailer
  • Deadline Tracking - Calculates return windows and highlights urgent deadlines
  • Chat Interface - Ask questions like "What returns are closing soon?" or "What's my Target return window?"

Prerequisites

  • Node.js (v16 or higher)
  • npm
  • OpenAI API key
  • Google Cloud project with Gmail API enabled

Setup

1. Clone and Install

git clone https://github.com/htaswell/gmail-return-assistant.git
cd gmail-return-assistant
npm install

2. Set Up Environment Variables

Copy the example environment file:

cp .env.example .env.local

Edit .env.local and add your credentials:

REACT_APP_OPENAI_KEY=sk-your-actual-openai-key
REACT_APP_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com

3. Set Up Google OAuth

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Enable the Gmail API
  4. Go to APIs & Services → Credentials
  5. Click Create Credentials → OAuth client ID
  6. Choose Web application
  7. Add authorized JavaScript origins:
    • http://localhost:3000 (for development)
    • Your production URL (for deployment)
  8. Copy the Client ID to your .env.local

4. Run the App

npm start

Open http://localhost:3000 in your browser.

Usage

  1. Enter your OpenAI API key (if not set in environment)
  2. Click Connect Gmail and authorize access
  3. The app will scan for order emails and look up return policies
  4. Ask questions in the chat like:
    • "What returns do I have?"
    • "Which deadlines are coming up?"
    • "How long do I have to return my Amazon order?"

Deployment

Render / Vercel / Netlify

  1. Push your code to GitHub (make sure .env.local is in .gitignore)
  2. Connect your repo to your hosting platform
  3. Add environment variables in the platform's dashboard:
    • REACT_APP_OPENAI_KEY
    • REACT_APP_GOOGLE_CLIENT_ID
  4. Update Google OAuth authorized origins to include your production URL

Tech Stack

  • React
  • Tailwind CSS
  • Google Identity Services (OAuth)
  • Gmail API
  • OpenAI GPT-4 API

Security Notes

  • Never commit .env or .env.local files
  • API keys should only be stored in environment variables
  • The app only requests read-only Gmail access

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published