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

whatify-whatsapp-client

v1.1.3

Published

Free WhatsApp API client for Whatify platform

Readme

Whatify

Free WhatsApp API client for Whatify platform.

Getting Started

Before using this SDK, you need to sign up to get a free API token at https://whatify.dev

Installation

npm install whatify-whatsapp-client

Usage

Initialize the client

import { Whatify } from "whatify-whatsapp-client";

// Initialize with API token
const client = new Whatify({
  apiToken: "your-api-token-here",
});

Connect to WhatsApp

// Connect with QR Code (default)
const result = await client.connect();
console.log(result.qrCode); // Display QR code to user

// Connect with Pairing Code
const result = await client.connect({
  method: "pairingCode",
  phoneNumber: "1234567890",
});
console.log(result.pairingCode); // Display pairing code to user

// Force new connection
const result = await client.connect({
  forceNew: true,
});

Check Connection Status

const status = await client.status();
console.log(status);
// {
//   success: true,
//   status: 'connected',
//   phone: '1234567890',
//   name: 'My WhatsApp',
//   profilePic: 'https://...'
// }

Disconnect from WhatsApp

const result = await client.disconnect();
console.log(result);
// { success: true, message: 'Disconnected successfully' }

Send Messages

Send text message

const result = await client.send({
  to: "1234567890",
  text: "Hello, World!",
});

Send to multiple recipients

const result = await client.send({
  to: ["1234567890", "0987654321"],
  text: "Hello, everyone!",
});

Send image with caption

const result = await client.send({
  to: "1234567890",
  text: "Check out this image!",
  attachment: {
    type: "image",
    url: "https://example.com/image.jpg",
    caption: "Beautiful sunset",
  },
});

Send document from base64

const result = await client.send({
  to: "1234567890",
  attachment: {
    type: "document",
    base64: "base64-encoded-data...",
    filename: "report.pdf",
    mimeType: "application/pdf",
    caption: "Monthly report",
  },
});

Send attachment only (no text)

const result = await client.send({
  to: "1234567890",
  attachment: {
    type: "video",
    url: "https://example.com/video.mp4",
  },
});

Send OTP (One-Time Password)

Send OTP codes via WhatsApp with multi-language support.

Send OTP in English (default)

const result = await client.sendOtp({
  phone: "1234567890",
  code: "123456",
});

Send OTP in Arabic

const result = await client.sendOtp({
  phone: "1234567890",
  code: 123456, // Can be string or number
  language: "Arabic",
});

Response:

{
  success: true,
  message: "OTP sent successfully",
  data: {
    messageId: "msg-xxx",
    whatsappMessageId: "wamid.xxx",
    phone: "1234567890",
    code: "123456",
    language: "English",
    sentAt: "2024-01-01T12:00:00.000Z",
  }
}

API Reference

new Whatify(config)

Create a new Whatify client instance.

Parameters:

  • config.apiToken (string, required): Your API token

client.connect(options?)

Connect to WhatsApp.

Parameters:

  • options.method ('qrCode' | 'pairingCode', optional): Connection method
  • options.phoneNumber (string, optional): Phone number for pairing code method
  • options.forceNew (boolean, optional): Force new connection
  • options.rawQrCode (boolean, optional): Return raw QR code data

Returns: Promise<ConnectResponse>

client.disconnect()

Disconnect from WhatsApp.

Returns: Promise<DisconnectResponse>

client.status()

Get current WhatsApp connection status.

Returns: Promise<StatusResponse>

client.send(options)

Send a WhatsApp message.

Parameters:

  • options.to (string | string[], required): Recipient phone number(s)
  • options.text (string, optional): Message text
  • options.attachment (object, optional): Attachment object
    • type ('image' | 'video' | 'audio' | 'document' | 'sticker', required)
    • url (string, optional): URL to the attachment
    • base64 (string, optional): Base64 encoded attachment data
    • filename (string, optional): Filename for the attachment
    • caption (string, optional): Caption for the attachment
    • mimeType (string, optional): MIME type of the attachment
  • options.existingMessageId (string, optional): Existing message ID to reply to

Note: Either text or attachment must be provided.

Returns: Promise<SendMessageResponse>

client.sendOtp(options)

Send an OTP (One-Time Password) via WhatsApp with multi-language support.

Parameters:

  • options.phone (string, required): Recipient phone number with country code (minimum 10 digits)
  • options.code (string | number, required): OTP code (4-8 digits)
  • options.language ('Arabic' | 'English', optional): Language for OTP message (default: 'English')

Returns: Promise<SendOtpResponse>

Rate Limit: 10 requests per minute

Example Response:

{
  success: true,
  message: "OTP sent successfully",
  data: {
    messageId: "msg-xxx",
    whatsappMessageId: "wamid.xxx",
    phone: "1234567890",
    code: "123456",
    language: "English",
    sentAt: "2024-01-01T12:00:00.000Z",
  }
}

TypeScript Support

This package includes TypeScript definitions out of the box.

License

MIT