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 🙏

© 2025 – Pkg Stats / Ryan Hefner

w-api-beauty-ia

v1.0.0

Published

WhatsApp API Client for W-API.app

Downloads

7

Readme

W-API Beauty IA

A comprehensive client library for the W-API WhatsApp API service.

Features

  • Full support for all W-API endpoints
  • Simplified client interface with short method names
  • Built-in API server for local use
  • Direct connection to W-API servers
  • TypeScript support

Installation

npm install w-api-beauty-ia

Quick Start

const wapi = require('w-api-beauty-ia');

// Create a client
const client = wapi.createClient({
  instanceId: 'YOUR_INSTANCE_ID',
  apiToken: 'YOUR_API_TOKEN',
  directMode: true // send requests directly to W-API servers
});

// Using the client
async function sendMessage() {
  try {
    // Check if connected
    const status = await client.status();
    console.log('Connection status:', status);
    
    // Send a message
    const result = await client.sendText('5512345678901', 'Hello from W-API Client!');
    console.log('Message sent:', result);
  } catch (error) {
    console.error('Error:', error);
  }
}

sendMessage();

Using Short Variable Names

You can use the wa object for shorter syntax:

const { wa, createClient } = require('w-api-beauty-ia');

const client = createClient({
  instanceId: 'YOUR_INSTANCE_ID',
  apiToken: 'YOUR_API_TOKEN',
  directMode: true
});

// Send a text message
wa.text(client, '5512345678901', 'Hello!');

// Send an image
wa.image(client, '5512345678901', 'https://example.com/image.jpg', 'Check this out!');

// Create a group
wa.createGroup(client, 'My Group', ['5512345678901', '5598765432101']);

Starting the API Server

You can start the built-in API server to use in your local network:

const { startServer } = require('w-api-beauty-ia');

// Start the server
startServer({
  port: 3000,
  instanceId: 'YOUR_INSTANCE_ID',
  apiToken: 'YOUR_API_TOKEN'
}).then(() => {
  console.log('Server started successfully');
}).catch(error => {
  console.error('Failed to start server:', error);
});

Then you can create a client that uses the local server:

const { createClient } = require('w-api-beauty-ia');

const client = createClient({
  baseUrl: 'http://localhost:3000',
  directMode: false // use local server
});

// Now you can use the client methods
client.sendText('5512345678901', 'Hello!');

Available Methods

Instance Methods

  • status() - Get connection status
  • qr() - Get QR code for connection
  • connect() - Connect to WhatsApp
  • disconnect() - Disconnect from WhatsApp
  • restart() - Restart the instance
  • logout() - Logout from WhatsApp

Message Methods

  • sendText(phone, message, options) - Send text message
  • sendImage(phone, image, caption, options) - Send image
  • sendDoc(phone, document, filename, caption, options) - Send document
  • sendAudio(phone, audio, options) - Send audio
  • sendVideo(phone, video, caption, options) - Send video
  • sendLocation(phone, latitude, longitude, name, address, options) - Send location
  • sendContact(phone, contact, options) - Send contact
  • sendButtons(phone, message, buttons, options) - Send button message
  • sendList(phone, message, list, options) - Send list message
  • reply(messageId, message, options) - Reply to a message

Contacts Methods

  • getContact(phone) - Get contact info
  • getContacts() - Get all contacts
  • checkContact(phone) - Check if number exists on WhatsApp
  • saveContact(phone, name) - Save a contact
  • getAbout(phone) - Get contact about/status

Chats Methods

  • getChat(phone) - Get chat info
  • getChats() - Get all chats
  • archiveChat(phone) - Archive a chat
  • unarchiveChat(phone) - Unarchive a chat
  • clearChat(phone) - Clear chat history
  • deleteChat(phone) - Delete a chat
  • pinChat(phone) - Pin a chat
  • unpinChat(phone) - Unpin a chat

Groups Methods

  • createGroup(name, participants) - Create a group
  • getGroup(groupId) - Get group info
  • updateGroupParticipants(groupId, participants, action) - Update group participants
  • updateGroupSettings(groupId, settings) - Update group settings
  • leaveGroup(groupId) - Leave a group
  • getGroupInviteCode(groupId) - Get group invite code

License

MIT