Turn your WhatsApp into a Hinglish AI buddy π
This bot sits on top of WhatsApp Web and auto-replies like an extroverted friend β powered by Googleβs Gemini API. Whitelist your close contacts, keep your vibe, and let AI handle βkya scene hai?β all day long.
Bro, sutta marne chalega? π¬
5:41 PM
Chal na bhai π main toh ready hi baitha hu. Kidhar milna hai? π
5:41 PM ββ
Tu bot hai ya asli? π
5:42 PM
Secret AI dost hu bro π€« Hinglish only, tension free replies 24x7 π
5:42 PM ββ
Why this bot is actually useful π
Real Hinglish replies
Replies feel like a real friend texting β casual, witty, and emoji-aware.
Runs on your machine
No cloud server storing your chats. Everything runs locally using WhatsApp Web automation.
Whitelist + filters
You decide who the bot answers and it ignores tiny βokβ, βhmmβ type spam messages.
How it works under the hood π§
-
1
whatsapp-web.js launches a controlled Chrome instance and logs into WhatsApp Web using QR code.
-
2
The bot listens for
messageevents and filters by your whitelist. -
3
Incoming text goes to Gemini via the official
@google/genaiSDK. -
4
The model returns a Hinglish reply, the bot fakes typing, then sends it back into the chat with a small random delay.
Tech stack
Built to be fully local, hackable and easy to extend β add personalities, commands, logging or more models with minimal changes.
Install & run locally in a few commands π»
1. Clone & install
git clone https://github.com/thelivingsofa/whatsapp-gemini.git
cd whatsapp-gemini
npm install
2. Create your config
cd src
cp config.example.json config.json
3. Fill your details
{
"apiKey": "YOUR_GEMINI_API_KEY",
"allowedContacts": ["919123456789"],
"ignoreShort": true
}
4. Run the bot
npm start
What youβll see
- QR code in the terminal for WhatsApp Web login
- Chromium window labelled βcontrolled by automated softwareβ
- Console logs like
π© 919123456789: "kya kar raha bro?" - Bot replying back with Hinglish messages from Gemini
whatsapp-gemini/
β
ββ src/
ββ bot.js
ββ config.json β your API key (π« do NOT commit)
ββ config.example.json β template (β commit)
β
ββ .gitignore
ββ package.json
ββ README.md
Core bot logic (simplified) π§Ύ
// MAIN LOGIC β only incoming messages
client.on('message', async (msg) => {
if (msg.fromMe) return;
const from = msg.from;
const text = msg.body.trim();
const contact = await msg.getContact();
const number = contact.number;
// Whitelist by phone number
if (!config.allowedContacts.includes(number)) return;
if (config.ignoreShort && text.length <= 2) return;
const chat = await msg.getChat();
await chat.sendStateTyping();
const reply = await generateReply(text);
// Fix status/broadcast to real chat JID if needed
let target = from;
if (!target.endsWith("@c.us")) {
const userId = contact.id._serialized;
if (userId.endsWith("@c.us")) target = userId;
}
await client.sendMessage(target, reply);
});
Full source code is available on GitHub β this is just the important part that wires WhatsApp to Gemini.