Contact
chatter
Back to Archive
design / ID_010

chatter

chatter This project started out as just a fun experiment—I wanted to see if I could get a local AI model to handle my WhatsApp replies. Chatter is now on its second version, mostly because I needed to move away from bas

Read raw project notes

chatter

This project started out as just a fun experiment—I wanted to see if I could get a local AI model to handle my WhatsApp replies. Chatter is now on its second version, mostly because I needed to move away from basic, random-timed logic. The outbound logic in v2 feels much more natural. Honestly, it just needs a better model now, and then it would be close to perfection.

The hardest part? Getting the groupID or chatID from WhatsApp. I almost lost my sanity over it. Almost every method I found online was deprecated or blocked, and it felt like I was hitting a wall for hours. When I finally figured out how to extract the ID, it was a huge relief. Just a heads up: never abuse this. WhatsApp does not like spammers, and you have to be careful with how you automate these interactions.

Features

  • Integrated with @whiskeysockets/baileys for real-time WhatsApp connectivity and event handling.
  • Uses local Ollama inference to generate smart replies based on incoming chat text and images.
  • Human-mimicking outbound logic that avoids the "random timer" trap for better conversation flow.
  • Privacy-first architecture where all data processing stays on your own hardware.

Technical Specs

Chatter is a Node.js application built on top of the @whiskeysockets/baileys library for protocol implementation. It utilizes pino for logging and qrcode-terminal to handle the initial device pairing session via the terminal. The core logic inside index.js listens for incoming messages, extracts the relevant chat metadata, and pipes the payload into a locally running Ollama model. The system operates entirely offline, bypassing external API fees and rate limits by keeping the inference loop strictly on local hardware.

Most Interesting Code

The logic handling the outbound delay is the most critical part of making the bot feel human. Instead of firing off a reply the millisecond the message arrives, I implemented a simple delay function: const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); await delay(Math.floor(Math.random() * 5000) + 2000);. This snippet is interesting because it forces a variable pause between 2 to 7 seconds, effectively preventing the bot from looking like a script while keeping the timing unpredictable.

Changelog

v2.0 — 2026-06-24 — Changed outbound logic to use natural timing instead of random intervals.

v1.0 — 2026-06-20 — Initial documentation generated.

Mi/OS 7.0

A personal portfolio in two operating systems.