A Chrome extension that enables you to export WhatsApp Web conversations and generate AI responses using Google's Gemini AI.
- 📤 Export Conversations: Extract and download complete WhatsApp conversations as text files
- 🤖 AI Response Generation: Generate contextually appropriate responses using Google's Gemini AI
- ⚙️ Custom System Instructions: Personalize AI behavior with custom instructions and presets
- ✨ Smart Integration: Insert AI-generated responses directly into WhatsApp's message input
- 📋 Copy to Clipboard: Easily copy generated responses for use elsewhere
- 🔒 Privacy-Focused: All processing happens locally in your browser
- Download or Clone this repository to your local machine
- Open Chrome and navigate to
chrome://extensions/
- Enable Developer Mode (toggle in the top-right corner)
- Click "Load unpacked" and select the extension folder
- Pin the extension to your toolbar for easy access
-
Get a Gemini API Key:
- Visit Google AI Studio
- Sign in with your Google account
- Create a new API key (free tier available)
-
Configure the Extension:
- Open WhatsApp Web
- Look for the green floating AI button (bottom-right corner)
- Click the button and select "Settings"
- Enter your Gemini API key and save
- Optionally customize the system instructions to personalize AI responses
- Open any WhatsApp conversation
- Click the floating AI button
- Select "Export Conversation"
- The conversation will be downloaded as a text file
- Make sure your API key is configured
- Open any WhatsApp conversation
- Click the floating AI button
- Select "Generate AI Response"
- Wait for the AI to analyze and generate a response
- Choose to copy or insert the response directly into the chat
- Click the AI button and go to Settings
- In the "System Instructions" field, enter custom instructions such as:
- "Always respond in a professional manner"
- "Keep responses brief and to the point"
- "Act as a customer support agent"
- "Respond in Spanish with enthusiasm"
- Use preset buttons for common instruction templates
- Save your settings
The AI will use these instructions to tailor its responses to your needs.
The extension uses advanced DOM selectors to extract messages from WhatsApp Web:
- Incoming messages: Detected using
.message-in
class - Outgoing messages: Detected using
.message-out
class - Message content: Extracted from
.selectable-text
elements - Timestamps: Retrieved from message metadata
- Group chat senders: Identified from message attributes
The conversation is then formatted and sent to Google's Gemini AI API to generate contextually appropriate responses.
// Incoming messages (like your HTML example)
document.querySelectorAll('.message-in')
// Outgoing messages
document.querySelectorAll('.message-out')
// Message containers
document.querySelectorAll('[data-testid="msg-container"]')
- Model: Gemini Flash ( Recommended for fast responses )
- Temperature: 0.7 (balanced creativity)
- Max Tokens: 1024
- Context: 100 most recent messages
- ✅ Text messages
- ✅ Group chats
- ✅ Individual chats
- ✅ Message timestamps
- ✅ Sender identification
⚠️ Media messages (Will be available soon)
- All message processing happens locally in your browser
- API key is stored securely in Chrome's sync storage
- Conversations are only sent to Gemini when you explicitly request AI responses
- No data is stored on external servers (except during API calls)
- Extension only works on
web.whatsapp.com
for security
whatsapp-web-ai/
├── manifest.json # Extension configuration
├── content.js # Main functionality and WhatsApp integration
├── styles.css # UI styling
├── popup.html # Extension popup interface
├── popup.js # Popup functionality
├── background.js # Service worker
├── help.html # Documentation page
└── README.md # This file
- Chrome browser
- Basic knowledge of JavaScript/HTML/CSS
- Gemini API key
- Clone the repository
- Make changes to the source files
- Reload the extension in
chrome://extensions/
- Test on WhatsApp Web
content.js: Main script that:
- Detects WhatsApp messages using CSS selectors
- Extracts conversation data
- Interfaces with Gemini AI API
- Manages UI interactions
styles.css: Provides styling for:
- Floating action button
- Modal dialogs
- Responsive design
- Notification system
- Refresh WhatsApp Web page
- Check if extension is enabled in Chrome
- Verify you're on
web.whatsapp.com
- Verify API key is correctly entered
- Check internet connection
- Ensure you haven't exceeded API limits
- Make sure conversation is fully loaded
- Scroll up to load older messages
- Try refreshing the page
Google's Gemini API has rate limits:
- Free tier: 60 requests per minute
- Paid tier: Higher limits available
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly on WhatsApp Web
- Submit a pull request
This project is open source and available under the MIT License.
This extension is not affiliated with WhatsApp or Meta. It's an independent tool designed to enhance the WhatsApp Web experience through AI integration.
For issues, suggestions, or questions:
- Open an issue in the GitHub repository
- Check the help.html file for detailed documentation
- Review the troubleshooting section above
Note: This extension requires a Google Gemini API key to function. Make sure to keep your API key secure and never share it publicly.