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

@thejulianjara/whatsapp.js

v1.3.8

Published

A typed WhatsApp Cloud API client for Node.js

Readme

Ask DeepWiki npm version License: MIT Node.js TypeScript

whatsapp.js

Send WhatsApp messages in Node.js in under 2 minutes.

A modern, fully-typed WhatsApp Cloud API client for Node.js. Build bots, automations, and real-time messaging workflows with a simple and unified API.


⚡ Quick Example

import { Client } from "@thejulianjara/whatsapp.js";

const client = new Client({
  phoneId: "YOUR_PHONE_ID",
  accessToken: "YOUR_ACCESS_TOKEN",
});

await client.message.send({
  to: "54911XXXXXXXX",
  content: "Hola mundo 👋",
});

🚀 What can you build?

  • Send automated notifications (orders, alerts, reminders)
  • Build WhatsApp chatbots with replies and interactions
  • Handle incoming messages via webhooks
  • Send products, menus, and interactive lists
  • Create conversational flows with buttons and lists

⭐ Why whatsapp.js?

  • Minimal setup → start sending messages in minutes
  • Unified API → one method for all message types
  • Built-in webhook server → no extra setup needed
  • TypeScript-first → fully typed and safe
  • Powerful features → without complexity

📦 Installation

npm install @thejulianjara/whatsapp.js
pnpm add @thejulianjara/whatsapp.js
yarn add @thejulianjara/whatsapp.js

🧠 Quick Start (with webhook)

import { Client } from "@thejulianjara/whatsapp.js";

const client = new Client({
  phoneId: "YOUR_PHONE_ID",
  accessToken: "YOUR_ACCESS_TOKEN",
  webhook: {
    verifyToken: "YOUR_VERIFY_TOKEN",
    port: 3000,
  },
});

client.on("ready", (info) => {
  console.log(`Connected as ${info.name}`);
});

client.on("message.received", async (message) => {
  if (message.text === "hello") {
    await message.reply({
      to: message.from,
      content: "Hey there! 👋",
    });
  }
});

🧩 Use Cases

Order confirmation

await client.message.send({
  to: customer.phone,
  content: `Tu pedido #123 fue confirmado ✅`,
});

OTP / verification code

await client.message.send({
  to: user.phone,
  content: `Tu código es 482193`,
});

Simple chatbot

client.on("message.received", async (message) => {
  if (message.text === "menu") {
    await message.reply({
      to: message.from,
      content: "Elegí una opción:",
    });
  }
});

💬 Sending Messages

All messages use a unified API:

await client.message.send({
  to: "5491155551234",
  content: "Hello from whatsapp.js!",
});

Media

await client.message.send({
  to: "5491155551234",
  files: [
    {
      type: "image",
      url: "https://example.com/photo.jpg",
      caption: "Check this out",
    },
  ],
});

Templates

import { LanguageCode } from "@thejulianjara/whatsapp.js";

await client.message.send({
  to: "5491155551234",
  template: {
    name: "hello_world",
    language: LanguageCode.ENGLISH_US,
  },
});

Reactions

await client.message.send({
  to: "5491155551234",
  reaction: {
    message_id: "wamid.xxxx",
    emoji: "👍",
  },
});

🔘 Interactive Messages

Buttons

import { ButtonBuilder } from "@thejulianjara/whatsapp.js";

const button = new ButtonBuilder({
  type: "reply",
  id: "opt_1",
  text: "Option 1",
});

await client.message.send({
  to: "5491155551234",
  components: [button],
});

Lists

import { ListBuilder, RowBuilder } from "@thejulianjara/whatsapp.js";

const rows = new RowBuilder()
  .addRow({ id: "1", title: "Pizza" })
  .addRow({ id: "2", title: "Burger" });

const list = new ListBuilder({
  title: "Menu",
  rows,
  buttonText: "View options",
});

await client.message.send({
  to: "5491155551234",
  components: [list],
});

🔔 Webhooks & Events

Built-in HTTP server for real-time events.

Events

  • ready
  • message.received
  • message.delivered
  • message.read
  • message.reaction
  • status.updated
  • interaction.create

Example

client.on("message.received", async (message) => {
  console.log(message.text);

  await message.reply({
    to: message.from,
    content: "Got it ✅",
  });
});

⏳ Message Collectors

const collector = client.createMessageCollector({
  filter: (msg) => msg.from === "5491155551234",
  time: 30000,
  max: 5,
});

collector.on("collect", (msg) => {
  console.log(msg.text);
});

📎 Media Management

const upload = await client.uploadMedia(buffer, "image/jpeg", "photo.jpg");
const media = await client.getMediaUrl(upload.id);
const data = await client.downloadMedia(media.url);

await client.deleteMedia(upload.id);

🏢 Business Profile

const profile = await client.getBusinessProfile();

await client.updateBusinessProfile({
  about: "Built with whatsapp.js 🚀",
});

⌨️ Typing Indicator

await client.sendTypingIndicator("5491155551234");

❌ Error Handling

import { WhatsAppApiException } from "@thejulianjara/whatsapp.js";

try {
  await client.message.send({ to: "invalid", content: "test" });
} catch (error) {
  if (error instanceof WhatsAppApiException) {
    console.error(error.message);
  }
}

📋 Requirements

  • Node.js >= 18
  • WhatsApp Business account (Cloud API)
  • Phone ID + Access Token from Meta

🛠 Development

git clone https://github.com/CodeBids/whatsapp.js.git
cd whatsapp.js

pnpm install
pnpm run build
pnpm test

📄 License

MIT © Julián Jara