npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@thibautrey/chatons-channel-whatsapp

v1.1.0

Published

WhatsApp channel bridge for Chatons. Connect via QR code, automatically syncs messages, and runs in the background using the shared Chatons UI component library.

Downloads

70

Readme

WhatsApp Channel for Chatons

A channel extension that bridges WhatsApp chats as Chatons conversations. Connect via QR code scanning, automatically sync messages, and use Chatons AI to reply to WhatsApp messages.

Features

  • QR Code Connection: Scan a QR code with your WhatsApp to securely connect
  • Message Polling: Continuously polls WhatsApp for new messages (configurable)
  • Automatic Reply Mirror: Sends Chatons AI responses back to WhatsApp
  • Chat Mapping: Maps WhatsApp chats to Chatons conversations automatically
  • Media Support: Handles media files (photos, videos, documents, audio)
  • Contact Filtering: Whitelist specific phone numbers to limit which chats are processed
  • Background Service: Runs polling and mirroring even when UI is not visible
  • Model Selection: Choose which AI model to use for new conversations

Installation

  1. Clone the repository into your Chatons extensions directory:
cd ~/.chaton/extensions
git clone https://github.com/thibautrey/chatons-channel-whatsapp.git @thibautrey/chatons-channel-whatsapp
  1. Restart Chatons

  2. Go to Channels > WhatsApp to start using the extension

Configuration

QR Code Connection

  1. Click "Generate QR Code" in the WhatsApp Channel UI
  2. Scan the displayed QR code with your WhatsApp phone
  3. The connection will establish automatically when confirmed

Settings

  • Poll limit: Number of messages to fetch per polling cycle (1-100, default: 10)
  • Allowed phone numbers (optional): Comma-separated list to whitelist specific contacts
  • Mirror replies: Enable/disable automatic sending of Chatons responses to WhatsApp
  • Handle media: Enable/disable downloading of photos, videos, and documents
  • Model: Choose the AI model for new conversations

Phone Number Whitelist

Leave empty to allow all contacts, or specify comma-separated phone numbers (with or without + prefix):

+1234567890, +0987654321
1234567890, 0987654321

How It Works

Inbound Flow

  1. WhatsApp messages are polled every 5 seconds
  2. Each chat is automatically mapped to a Chatons conversation
  3. The message is ingested and processed by the selected AI model
  4. If a synchronous reply is available, it's immediately sent back to WhatsApp

Outbound Flow

  1. Every 4 seconds, the extension checks for new AI responses
  2. Any new assistant messages are automatically sent to the original WhatsApp chat
  3. Messages are tracked to avoid duplicates

Background Service

  • Polling continues even when the UI tab is closed
  • Outbound mirroring runs in the background
  • Keepalive timer ensures services resume if interrupted

Technical Details

State Management

All configuration and state is persisted to Chatons' storage:

  • whatsapp.config: Connection settings and status
  • whatsapp.mappings: Chat to conversation mappings
  • whatsapp.lastUpdates: Recent activity log
  • whatsapp.outboundMirrorState: Tracking of sent messages

Message Deduplication

  • Uses message IDs and timestamps as idempotency keys
  • Tracks which assistant messages have been sent to avoid duplicates
  • Automatically recreates stale conversation mappings

Error Handling

  • Graceful polling failure handling
  • Automatic connection recovery via keepalive timer
  • Detailed error notifications to user

Backend Integration

This extension uses a QR-code based connection approach similar to WhatsApp Web. In production, it should integrate with:

  • whatsapp-web.js: A Node.js library that interfaces with WhatsApp Web
  • Backend API: A service that manages WhatsApp Web.js instances and message polling

The current implementation includes mock functions that can be connected to a backend:

  • initializeWhatsAppSession(): Generate QR code
  • pollOnce(): Fetch new messages
  • sendWhatsAppMessage(): Send message to WhatsApp

Security Considerations

  • Session data (including phone number) is stored locally in Chatons' encrypted storage
  • QR codes are session-based and expire after connection
  • No credentials or API keys are stored
  • Messages are only sent to whitelisted contacts (if configured)

Limitations

  • Currently simulates connection (needs backend integration)
  • Media downloading is prepared but needs backend implementation
  • Requires stable internet connection for polling to work
  • QR code changes with each reconnection for security

Contributing

Please open an issue or pull request to suggest improvements.

License

MIT