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

whatsapp-flow-api-sdk

v1.0.0

Published

Node.js SDK for WhatsApp Flow API Platform - Send messages, manage sessions, and integrate WhatsApp into your applications

Readme

WhatsApp Flow API SDK for Node.js

Official Node.js SDK for the WhatsApp Flow API Platform - Send messages, manage sessions, and integrate WhatsApp into your applications.

🚀 Installation

npm install whatsapp-flow-api-sdk

📋 Quick Start

1. Initialize the Client

const WhatsAppAPI = require('whatsapp-flow-api-sdk');

const client = new WhatsAppAPI({
  apiKey: 'your-api-key-here',
  baseUrl: 'https://whatsapp-flow-i0e2.onrender.com' // Optional, this is the default
});

2. Create a Session and Get QR Code

async function connectWhatsApp() {
  try {
    // Create a new session
    const session = await client.sessions.create({
      name: 'My Website Session'
    });
    
    console.log('Session created:', session.data.id);
    
    // Get QR code for scanning
    const qrData = await client.sessions.getQR(session.data.id);
    console.log('Scan this QR code with WhatsApp:', qrData.data.qrCode);
    
    // Wait for connection (you can poll the session status)
    await waitForConnection(session.data.id);
    
    return session.data.id;
  } catch (error) {
    console.error('Error:', error.message);
  }
}

async function waitForConnection(sessionId) {
  return new Promise((resolve, reject) => {
    const checkStatus = async () => {
      try {
        const session = await client.sessions.get(sessionId);
        if (session.data.status === 'connected') {
          console.log('WhatsApp connected!');
          resolve(session);
        } else if (session.data.status === 'failed') {
          reject(new Error('Connection failed'));
        } else {
          setTimeout(checkStatus, 2000); // Check every 2 seconds
        }
      } catch (error) {
        reject(error);
      }
    };
    checkStatus();
  });
}

3. Send Messages

async function sendMessage(sessionId) {
  try {
    // Send text message
    const textMessage = await client.messages.sendText({
      sessionId: sessionId,
      to: '1234567890', // Phone number without + or country code
      message: 'Hello from WhatsApp Flow API!'
    });
    
    console.log('Text message sent:', textMessage.data.id);
    
    // Send media message
    const mediaMessage = await client.messages.sendMedia({
      sessionId: sessionId,
      to: '1234567890',
      type: 'image',
      mediaUrl: 'https://example.com/image.jpg',
      caption: 'Check out this image!'
    });
    
    console.log('Media message sent:', mediaMessage.data.id);
    
  } catch (error) {
    console.error('Error sending message:', error.message);
  }
}

📚 API Reference

Sessions

// Create session
const session = await client.sessions.create({ name: 'Session Name' });

// List sessions
const sessions = await client.sessions.list();

// Get session details
const session = await client.sessions.get(sessionId);

// Get QR code
const qrData = await client.sessions.getQR(sessionId);

// Delete session
await client.sessions.delete(sessionId);

Messages

// Send text message
await client.messages.sendText({
  sessionId: 'session-id',
  to: '1234567890',
  message: 'Hello World!'
});

// Send media message
await client.messages.sendMedia({
  sessionId: 'session-id',
  to: '1234567890',
  type: 'image', // image, video, audio, document
  mediaUrl: 'https://example.com/file.jpg',
  caption: 'Optional caption'
});

// Get message history
const messages = await client.messages.list({
  sessionId: 'session-id',
  page: 1,
  limit: 50
});

🔑 Authentication

Get your API key from the WhatsApp Flow dashboard:

  1. Go to: https://dist-eta-sooty.vercel.app
  2. Login to your account
  3. Navigate to API Keys section
  4. Create a new API key with required scopes

📖 Complete Example

const WhatsAppAPI = require('whatsapp-flow-api-sdk');

async function main() {
  const client = new WhatsAppAPI({
    apiKey: 'your-api-key-here'
  });
  
  try {
    // 1. Create session
    console.log('Creating session...');
    const session = await client.sessions.create({
      name: 'Demo Session'
    });
    
    // 2. Get QR code
    console.log('Getting QR code...');
    const qrData = await client.sessions.getQR(session.data.id);
    console.log('QR Code:', qrData.data.qrCode);
    console.log('Scan this QR code with WhatsApp');
    
    // 3. Wait for connection
    console.log('Waiting for WhatsApp connection...');
    await waitForConnection(session.data.id);
    
    // 4. Send message
    console.log('Sending message...');
    await client.messages.sendText({
      sessionId: session.data.id,
      to: '1234567890',
      message: 'Hello from WhatsApp Flow API SDK!'
    });
    
    console.log('Message sent successfully!');
    
  } catch (error) {
    console.error('Error:', error.message);
  }
}

main();

🌐 Links

  • API Dashboard: https://dist-eta-sooty.vercel.app
  • API Documentation: https://whatsapp-flow-i0e2.onrender.com/api/docs

📄 License

MIT License