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

wapilot-sdk

v1.0.1

Published

Official Node.js SDK for WAPILOT.io - WhatsApp Business API Integration

Downloads

12

Readme

WAPILOT Node.js SDK

Official Node.js SDK for WAPILOT.io - WhatsApp Business API Integration Platform

Overview

WAPILOT SDK provides a simple and intuitive way to integrate WhatsApp Business API functionality into your Node.js applications. This SDK handles all the complexity of API communication, authentication, and data formatting, allowing you to focus on building your application logic.

Features

  • 📱 Contact Management - Create, update, and manage WhatsApp contacts
  • 👥 Contact Groups - Organize contacts into groups for better management
  • 💬 Message Sending - Send text, media, and interactive messages
  • 📝 Templates - Manage and send template messages
  • 🤖 Automated Replies - Set up and manage automated responses
  • Modern Architecture - Built with modern JavaScript, supports both ES Modules and CommonJS
  • 🔒 Secure - Built-in token-based authentication and HTTPS
  • 🚀 Promise-based - All operations return promises for easy async/await usage

Installation

npm install wapilot-sdk

Quick Start

The SDK supports both modern ES Modules and traditional CommonJS imports:

ES Modules (Recommended)

import WapilotSDK from 'wapilot-sdk';

const wapilot = new WapilotSDK({
    token: 'your-api-token'  // Get this from your WAPILOT dashboard
});

CommonJS

const WapilotSDK = require('wapilot-sdk');

const wapilot = new WapilotSDK({
    token: 'your-api-token'
});

Configuration Options

| Option | Type | Required | Default | Description | |--------|------|----------|---------|-------------| | token | string | Yes | - | Your WAPILOT API token | | baseURL | string | No | https://app.wapilot.io | API base URL |

API Reference

Contact Management

Get All Contacts

const contacts = await wapilot.getContacts();

Create Contact

const newContact = await wapilot.createContact({
    name: 'John Doe',
    phone: '+1234567890',  // International format with country code
    // Optional fields
    email: '[email protected]',
    notes: 'VIP Customer'
});

Update Contact

const updatedContact = await wapilot.updateContact('contact-uuid', {
    name: 'John Smith',
    // Include only fields you want to update
});

Delete Contact

await wapilot.deleteContact('contact-uuid');

Message Sending

Send Text Message with Interactive Buttons

await wapilot.sendMessage({
    phone: '+1234567890',
    message: 'Hello! How can we help you today?',
    header: 'Welcome Message',  // Optional
    footer: 'Reply with a button',  // Optional
    buttons: [
        {
            id: 'support',
            title: 'Get Support'
        },
        {
            id: 'sales',
            title: 'Sales Inquiry'
        }
    ]
});

Send Media Message

await wapilot.sendMediaMessage({
    phone: '+1234567890',
    media_type: 'image',  // 'image', 'video', 'document', 'audio'
    media_url: 'https://example.com/image.jpg',
    caption: 'Check out our new product!',  // Optional
    file_name: 'product.jpg'  // Required for documents
});

Send Template Message

await wapilot.sendTemplateMessage({
    phone: '+1234567890',
    template: {
        name: 'appointment_reminder',
        language: {
            code: 'en'  // Language code
        },
        components: [
            {
                type: 'header',
                parameters: [
                    {
                        type: 'image',
                        image: {
                            link: 'https://example.com/appointment.jpg'
                        }
                    }
                ]
            },
            {
                type: 'body',
                parameters: [
                    {
                        type: 'text',
                        text: 'John Doe'  // Dynamic parameter
                    },
                    {
                        type: 'text',
                        text: '3:00 PM'  // Dynamic parameter
                    }
                ]
            }
        ]
    }
});

Contact Groups

Get All Groups

const groups = await wapilot.getContactGroups();

Create Group

const newGroup = await wapilot.createContactGroup({
    name: 'VIP Customers',
    description: 'Our premium customers'  // Optional
});

Update Group

const updatedGroup = await wapilot.updateContactGroup('group-uuid', {
    name: 'Premium Customers'
});

Delete Group

await wapilot.deleteContactGroup('group-uuid');

Automated Replies

Get All Automated Replies

const replies = await wapilot.getCannedReplies();

Create Automated Reply

const newReply = await wapilot.createCannedReply({
    name: 'Welcome Message',
    message: 'Thank you for contacting us! Our team will respond shortly.',
    keywords: ['hi', 'hello', 'hey']  // Optional trigger keywords
});

Update Automated Reply

const updatedReply = await wapilot.updateCannedReply('reply-uuid', {
    message: 'Thank you for reaching out! We will get back to you soon.'
});

Delete Automated Reply

await wapilot.deleteCannedReply('reply-uuid');

Templates

Get All Templates

const templates = await wapilot.getTemplates();

Error Handling

The SDK uses Promise-based error handling. All errors include detailed information about what went wrong:

try {
    const contacts = await wapilot.getContacts();
} catch (error) {
    if (error.response) {
        // API Error (4xx or 5xx response)
        console.error('API Error:', error.response.data);
        console.error('Status Code:', error.response.status);
    } else if (error.request) {
        // Network Error (no response received)
        console.error('Network Error:', error.request);
    } else {
        // SDK Error (error in request setup)
        console.error('Error:', error.message);
    }
}

Common Error Codes:

  • 401: Invalid or expired API token
  • 400: Invalid request parameters
  • 404: Resource not found
  • 429: Rate limit exceeded
  • 500: Server error

Best Practices

  1. Error Handling: Always implement proper error handling using try/catch blocks
  2. Token Security: Never expose your API token in client-side code
  3. Rate Limiting: Implement proper rate limiting in your application
  4. Message Templates: Use templates for recurring messages
  5. Contact Management: Keep contact information up to date
  6. Testing: Test your integration thoroughly in a development environment

Support

For support or inquiries, please contact:

License

MIT License - feel free to use this SDK in your projects.