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

capacitor-wa-autoreply

v1.0.0

Published

Capacitor plugin for WhatsApp auto-reply via Android NotificationListenerService + RemoteInput. Read incoming messages, reply automatically, and run in background without opening WhatsApp.

Readme

capacitor-wa-autoreply


How it works

This plugin uses Android's NotificationListenerService to capture WhatsApp notifications and RemoteInput to reply directly through the notification — the same mechanism used by Android Auto and smartwatches. WhatsApp doesn't know your app exists.

WhatsApp notification arrives
       ↓
NotificationListenerService captures contact + message
       ↓
Your app processes the message (AI, rules, etc.)
       ↓
RemoteInput replies through the notification
       ↓
Message appears in WhatsApp as if the user typed it

Features

  • 📩 Read incoming WhatsApp messages — contact name, message text, timestamp
  • ✉️ Auto-reply via RemoteInput — replies appear as normal messages in WhatsApp
  • 👤 Capture own messages — detect when the user sends messages manually
  • 🔄 Built-in debounce — groups multiple rapid messages from the same contact
  • 🛡️ Anti-loop protection — 20-second cooldown prevents reply loops
  • 🔇 Duplicate filter — ignores duplicate notifications from WhatsApp
  • 📱 Background operation — works with screen off, app closed
  • 📇 Read contacts — access phone book for contact mapping
  • ⏸️ Pause/Resume — toggle auto-reply on/off from your app

Platform Support

| Platform | Supported | |----------|-----------| | Android | ✅ | | iOS | ❌ (not possible due to Apple restrictions) | | Web | ❌ |

Installation

npm install capacitor-wa-autoreply
npx cap sync

Setup

1. Register the plugin in your MainActivity.java

import com.alteri.wareply.WAAutoReplyPlugin;

public class MainActivity extends BridgeActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        registerPlugin(WAAutoReplyPlugin.class);
        super.onCreate(savedInstanceState);
    }
}

2. Add the service to your AndroidManifest.xml

Inside <application>:

<service
    android:name="com.alteri.wareply.WANotificationService"
    android:label="WhatsApp Auto-Reply"
    android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
    android:exported="true">
    <intent-filter>
        <action android:name="android.service.notification.NotificationListenerService" />
    </intent-filter>
</service>

3. Add permissions (optional, for contacts)

<uses-permission android:name="android.permission.READ_CONTACTS" />

4. Grant notification access

The user must manually enable "Notification Access" for your app in Android Settings. You can open this screen programmatically:

import { WAAutoReply } from 'capacitor-wa-autoreply';

const { granted } = await WAAutoReply.checkPermission();
if (!granted) {
  await WAAutoReply.requestPermission(); // Opens Android settings
}

Usage

Listen for incoming messages

import { WAAutoReply } from 'capacitor-wa-autoreply';

WAAutoReply.addListener('whatsappMessage', (data) => {
  console.log(`${data.contact}: ${data.message}`);
  // Process with your AI, rules engine, etc.
});

Reply to a message

await WAAutoReply.reply({
  contact: 'John',    // Must match the notification title
  message: 'Got it!'  // Your reply
});

Listen for debounced messages

When a contact sends multiple messages quickly, they're grouped:

WAAutoReply.addListener('debouncedMessage', (data) => {
  console.log(`${data.contact} sent ${data.count} messages: ${data.message}`);
  // All messages joined with spaces
});

Capture own messages

Detect when the user sends messages manually (useful for learning their writing style):

WAAutoReply.addListener('ownMessage', (data) => {
  console.log(`User sent to ${data.contact}: ${data.message}`);
});

Pause/Resume

await WAAutoReply.setPaused({ paused: true });  // Stop auto-replying
await WAAutoReply.setPaused({ paused: false }); // Resume

Read phone contacts

const { contactos, total } = await WAAutoReply.getContacts();
// contactos = { "John Doe": "1234567890", ... }

API Reference

| Method | Description | |--------|-------------| | checkPermission() | Check if notification access is granted | | requestPermission() | Open Android notification settings | | reply({ contact, message }) | Reply to a WhatsApp contact | | getContacts() | Read device contact list | | saveConfig({ token, userId, server }) | Store config in SharedPreferences | | setPaused({ paused }) | Pause or resume auto-reply |

| Event | Description | |-------|-------------| | whatsappMessage | Incoming message from a contact | | ownMessage | Message sent by the device owner | | debouncedMessage | Grouped messages after 4s debounce |

How is this different from WhatsApp Business API?

| | This plugin | WhatsApp Business API | |---|---|---| | Cost | Free | $0.005-0.08 per message | | Setup | Install plugin, grant permission | Apply to Meta, get approved | | Rate limits | None | 1000 messages/day initially | | Risk of ban | Minimal (uses Android APIs) | None (official) | | Works with personal WA | ✅ | ❌ (business accounts only) | | Requires server | No | Yes |

Important Notes

  • Android only — iOS does not allow reading other apps' notifications
  • Notification access required — users must manually grant this permission
  • Anti-abuse — built-in cooldowns and duplicate filters prevent spam
  • Google Play compliance — apps using NotificationListenerService must justify the permission in Play Store submission
  • This plugin does NOT access WhatsApp's internal APIs — it only interacts with Android's notification system

Use Cases

  • 🤖 AI-powered auto-responders
  • 📊 Message analytics and logging
  • 🏢 Customer service automation
  • ⏰ Out-of-office replies
  • 🧠 Writing style analysis
  • 🔔 Custom notification handling

Credits

Built by the team behind Alteri — your AI-powered WhatsApp alter ego.

License

MIT