ReplySense - Project Story

Inspiration

We've all been there: staring at a message, fingers hovering over the keyboard, wondering "What do I say?" Whether it's comforting a friend going through a tough time, matching someone's playful energy, or responding to a crush's text without sounding awkward — message paralysis is real.

The inspiration struck when one of us spent 15 minutes crafting a reply to a sensitive message, only to send something that felt... off. We realized: what if AI could suggest replies that match both the conversation context AND our emotional intent?

Unlike generic smart replies ("OK", "Thanks", "Sounds good"), we wanted something that:

  • Understands the full conversation flow, not just the last message
  • Adapts to your chosen tone — playful, empathetic, or neutral
  • Feels authentically human, not robotic
  • Respects privacy by never storing or auto-sending messages

With Gemini's powerful language understanding, we saw an opportunity to build a conversation companion that actually gets it.


What it does

ReplySense is a Chrome extension for Telegram Web that provides AI-powered reply suggestions tailored to your conversation and mood.

Core Features

🎭 Tone Selection Choose between three modes:

  • Playful — Light humor, emojis, casual vibes
  • Empathy — Supportive, warm, understanding
  • Neutral — Professional, clear, balanced

💬 Context-Aware Suggestions

  • Analyzes the last 10 messages in your chat
  • Generates 3 short, natural reply options
  • Updates instantly when you switch tones

🔒 Privacy-First Design

  • Only processes recent messages (not entire history)
  • No conversation storage on servers
  • Never auto-sends — you stay in complete control

⚡ Seamless Integration

  • Floating popup appears when you focus the message composer
  • Click any suggestion to fill the input box
  • Edit before sending, exactly like typing manually

How we built it

Architecture Overview

┌─────────────────┐      ┌──────────────────┐      ┌─────────────────┐
│  Chrome         │─────▶│  Express.js      │─────▶│  Gemini 1.5     │
│  Extension      │      │  Backend API     │      │  Flash API      │
│  (Content       │◀─────│  (/suggest)      │◀─────│                 │
│   Script + UI)  │      └──────────────────┘      └─────────────────┘
└─────────────────┘

Tech Stack

Frontend (Chrome Extension)

  • Vanilla JavaScript for DOM manipulation
  • Chrome Extension Manifest V3
  • Chrome Storage API for settings persistence
  • CSS3 for floating UI with smooth animations

Backend

  • Node.js + Express.js for REST API
  • Google Generative AI SDK for Gemini integration
  • CORS middleware for cross-origin requests

AI Layer

  • Gemini 1.5 Flash for fast suggestion generation

Development Approach

DOM Extraction: Built content scripts to detect Telegram's message composer, extract the last 10 messages, and identify message ownership (sent vs received).

Prompt Engineering: Iterated through multiple prompt versions to achieve:

  • Short, natural replies (under 15 words)
  • Accurate tone matching
  • No AI-like phrases ("I would suggest...", "Here's a response...")

State Management: Implemented clean UI states — idle, loading, error, and disabled — with smooth transitions.


Challenges we ran into

Telegram's Dynamic DOM

Telegram Web uses a React-like structure that changes between updates. We built multiple fallback selectors and used MutationObserver to handle chat switching reliably.

Gemini Response Parsing

The model sometimes returned numbered lists or quoted text instead of clean suggestions. We added strict prompt rules and regex cleanup to ensure consistent output.

Extension Security Restrictions

Chrome's Content Security Policy blocked direct API calls from content scripts. We moved network requests to the background service worker and used message passing.

Composer Text Injection

Simply setting text content didn't activate Telegram's send button. We had to dispatch proper input and change events to trigger the app's internal state.

Tone Consistency

"Playful" mode occasionally generated overly casual replies for serious topics. We refined the prompt to balance tone with conversation context.


Accomplishments that we're proud of

✨ Polished UX: The popup feels native to Telegram with smooth animations and intuitive positioning.

🚀 Fast Response Time: Suggestions appear in under 3 seconds, even with API calls.

🎯 Accurate Tone Matching: The three modes produce distinctly different suggestions that feel appropriate.

🔒 Privacy-Conscious Design: Minimal data transmission, no storage, clear user controls.

🛡️ Robust Error Handling: The extension never crashes — fallback suggestions appear if anything fails.

📦 Clean Architecture: Clear separation between DOM handling, UI, and backend made collaboration smooth.


What we learned

Technical Skills

  • Chrome Extension Manifest V3 architecture and content script patterns
  • Prompt engineering techniques for constraining LLM output
  • Working with dynamic web apps and unstable DOM structures
  • Real-time UI state management in browser extensions

AI Insights

  • Model selection tradeoffs: Flash for speed-critical features, Pro for depth
  • Context window optimization: 10 messages hit the sweet spot for quality vs latency
  • Output formatting: What you forbid in prompts matters as much as what you request

Project Skills

  • Breaking complex features into parallel workstreams with clear contracts
  • Defining integration points upfront saves debugging time
  • User feedback early: People wanted inspiration, not automation — shaping our "no auto-send" decision

What's next for ReplySense

Short-term

  • Cross-Platform Support: Extend to WhatsApp Web and Discord
  • Keyboard Shortcuts: Quick access without mouse clicks
  • More Tone Options: Add "Professional", "Romantic", "Supportive" modes

Medium-term

  • Style Memory: Learn each contact's communication preferences over time
  • Multi-Language Support: Detect conversation language and generate matching suggestions
  • Usage Insights: Show time saved and suggestion patterns (local only)

Long-term Vision

  • Conversation Coaching: Gentle suggestions when messages might be misunderstood
  • Enterprise Version: Brand voice consistency for customer support teams
  • Mobile App: Bring ReplySense to iOS and Android messaging

Our ultimate goal: Make digital communication feel less stressful and more authentic. AI should amplify human connection, not replace it. ReplySense is just the beginning. 💬✨

Built With

Share this project:

Updates