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

pi-kapso-whatsapp

v1.0.2

Published

Pi extension for WhatsApp via Kapso AI — contacts access control with SQLite

Downloads

73

Readme

pi-kapso-whatsapp

Pi coding agent extension for WhatsApp via Kapso AI.
Gives Pi a full set of WhatsApp tools: send messages, manage contacts, control the webhook service, set up Cloudflare tunnels, and handle incoming messages with access control.

ko-fi


Installation

pi install pi-kapso-whatsapp

Or manually:

cd ~/.pi/agent/extensions
git clone https://github.com/serlismaldonado/pi-kapso-whatsapp

Then reload Pi's extensions.


Initial setup

Once installed, tell Pi:

"Set up the WhatsApp bot"

Pi will run the full autonomous setup — no questions, no manual steps:

  1. Checks system requirements (PM2, pi-whatsapp-service, .env)
  2. Installs PM2 if missing
  3. Builds and starts the service
  4. Sets up a Cloudflare tunnel (temporary or custom domain)
  5. Registers the webhook in Kapso
  6. Adds you to the contact allowlist
  7. Verifies everything is running

The only step that may require you is pm2 startup (requires sudo once).


Commands

| Command | Description | |---|---| | /kapso-setup | Set API key and phone number ID | | /kapso-contacts | List contacts with notes | | /kapso-instructions | Show paths to SYSTEM.md and PROMPT.md |


Tools reference

Receiving messages

| Tool | Description | |---|---| | whatsapp_receive | Process an incoming webhook payload — checks access, loads history, reads SYSTEM.md / PROMPT.md | | whatsapp_history | Get conversation history for a contact | | whatsapp_log_out | Log an outgoing message to the session history | | whatsapp_session_end | End the active session for a contact | | whatsapp_status | Check current processing status |

Sending messages

| Tool | Description | |---|---| | whatsapp_send | Send a text message | | whatsapp_send_image | Send an image (URL or media_id) | | whatsapp_send_document | Send a document/file (URL or media_id) | | whatsapp_send_audio | Send audio or a voice note (voice: true for transcription) | | whatsapp_send_video | Send a video with optional caption | | whatsapp_send_sticker | Send a sticker (WEBP format) | | whatsapp_send_reaction | React to a message with an emoji | | whatsapp_send_contact | Send a contact card (vCard) | | whatsapp_send_location | Send a location pin | | whatsapp_send_buttons | Interactive message with up to 3 quick-reply buttons | | whatsapp_send_list | Interactive list menu (up to 10 sections) | | whatsapp_send_cta | Message with a call-to-action URL button | | whatsapp_upload_media | Upload a local file and get a media_id |

Templates

| Tool | Description | |---|---| | whatsapp_templates_list | List approved message templates | | whatsapp_send_template | Send a template (works outside the 24h conversation window) |

Contact management

| Tool | Description | |---|---| | whatsapp_contacts_list | List all contacts and their access status | | whatsapp_contact_add | Add a contact to the allowlist | | whatsapp_contact_remove | Remove a contact | | whatsapp_contact_update | Update name, notes, or enabled status | | whatsapp_check_access | Check if a phone number has access |

Webhooks

| Tool | Description | |---|---| | whatsapp_webhook_setup | Register a new Kapso webhook | | whatsapp_webhooks_list | List all registered webhooks | | whatsapp_webhook_register | Register or update the active webhook URL | | whatsapp_numbers_list | List connected WhatsApp numbers (to get phone_number_id) |

Service management

| Tool | Description | |---|---| | whatsapp_setup_check | Inspect all system requirements and current state | | whatsapp_service_status | Check if the service is running | | whatsapp_service_start | Build and start the service with PM2 | | whatsapp_service_stop | Stop the service | | whatsapp_service_restart | Restart the service | | whatsapp_service_logs | View recent logs | | whatsapp_service_configure | Write the .env file | | whatsapp_service_setup_autostart | Configure PM2 to start on login | | whatsapp_tunnel_setup | Start a Cloudflare tunnel and register the webhook URL |


Customizing the bot

Identity and behavior

Edit these two files to define who the agent is and how it responds:

  • ~/.pi/agent/extensions/pi-kapso-whatsapp/SYSTEM.md — agent name, personality, scope
  • ~/.pi/agent/extensions/pi-kapso-whatsapp/PROMPT.md — step-by-step response instructions

Changes take effect immediately — no restart needed.

Example: tell Pi:

"Edit SYSTEM.md and PROMPT.md. The agent is called Javi, responds in Spanish with a professional but direct tone, and only handles questions about my services."

Access control

Only contacts in the allowlist receive responses. Others are silently ignored.

whatsapp_contact_add    with {"name": "Ana", "phone_number": "+50488887777"}
whatsapp_contact_update with {"phone_number": "+50488887777", "enabled": false}
whatsapp_contacts_list

Incoming message flow

Kapso webhook → whatsapp_receive
  → ACCESS DENIED  → silent ignore
  → ACCESS GRANTED →
      read contact data + notes
      read session history
      read SYSTEM.md + PROMPT.md
      → Pi processes and replies →
          whatsapp_send (or send_image, send_document, etc.)
          whatsapp_log_out

Sending files

To send a local file:

1. whatsapp_upload_media with {"file_path": "/path/to/file.pdf"}
   → returns media_id

2. whatsapp_send_document with {"to": "+504...", "media_id": "<id>", "filename": "file.pdf"}

MIME type is auto-detected from the file extension.


Tunnel modes

Quick tunnel (no account, URL changes on restart):

whatsapp_tunnel_setup with {"port": 4721}

Uses trycloudflare.com. The webhook in Kapso is updated automatically on each restart.

Permanent tunnel (Cloudflare account + custom domain):

whatsapp_tunnel_setup with {"port": 4721, "customDomain": "whatsapp.yourdomain.com"}

Requires a DNS CNAME in Cloudflare pointing to your named tunnel UUID.


Related packages

| Package | Description | |---|---| | pi-whatsapp-service | The always-on webhook receiver service | | pi-mono | Pi coding agent SDK |


License

MIT