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

@socioapi/socioapi

v0.0.8

Published

Official Socioapi API package Node.js

Downloads

6

Readme

SocioAPI SDK for WhatsApp Automation

npm version
Easily integrate WhatsApp automation and messaging features into your Node.js application using the SocioAPI SDK.

📦 Installation

npm install @socioapi/socioapi
# or
yarn add @socioapi/socioapi

🧠 Overview The @socioapi/socioapi SDK allows you to interact with WhatsApp via SocioAPI’s robust backend API. It supports:

Connecting sessions via QR or phone number

Fetching contact lists

Sending WhatsApp stories (text, image, video, audio)

Sending direct messages (text, image, video, audio, document)

⚙️ Environment Setup Make sure to set the following environment variables before using the SDK:

SOCIOAPIKEY=your_api_key
SOCIOAPISECRET=your_api_secret
SOCIOAPIENV=production

🚀 Usage Example

import Socioapi from "@socioapi/socioapi";
import { environmentType } from "@socioapi/socioapi/src/whatsapp/interfaces/IWhatsappApi.interface";

const { whatsapp } = new Socioapi(
    process.env.SOCIOAPIKEY!,
    process.env.SOCIOAPISECRET!,
    process.env.SOCIOAPIENV as environmentType
);

🧩 API Reference 📱 1. Session Management Connect via QR

await whatsapp.session.connect(sessionId, "qr");

sessionId: Unique string to identify the session.

"qr": Triggers QR-based authentication.

📌 The SDK returns the QR code string and connection state.

Connect via Phone Number

await whatsapp.session.connect(sessionId, "phoneNumber", "2348100023411");

phoneNumber: Your registered WhatsApp phone number in international format.

👥 2. Fetch Contacts

await whatsapp.contact.getContacts(sessionId, 0, 10000);

Retrieves a paginated list of WhatsApp contacts.

📚 Story Messaging You can post stories (status updates) to selected contacts.

✏️ Send Text Story

await whatsapp.story.sendTextStory(sessionId, {
    message: {
        text: "Hello from Kufuli!",
    },
    options: {
        contactList: ["[email protected]"],
        font: 1,
        backgroundColor: "#000000",
    },
});

🖼️ Send Image Story

await whatsapp.story.sendImageStory(sessionId, {
    message: {
        image: {
            url: "https://example.com/image.jpg",
        },
        caption: "Check this out!",
    },
    options: {
        contactList: ["[email protected]"],
    },
});

🎥 Send Video Story

await whatsapp.story.sendVideoStory(sessionId, {
    message: {
        video: {
            url: "https://example.com/video.mp4",
        },
        caption: "Watch this!",
    },
    options: {
        contactList: ["[email protected]"],
    },
});

🔊 Send Audio Story

await whatsapp.story.sendAudioStory(sessionId, {
    message: {
        audio: {
            url: "https://example.com/audio.wav",
        },
    },
    options: {
        contactList: ["[email protected]"],
        backgroundColor: "#000000",
    },
});

💬 Direct Messaging You can send direct WhatsApp messages of various media types.

📃 Base Message Format

{
jid: "[email protected]",
type: "number",
message: {
text/image/video/audio/document: {...}
}
}

📝 Send Text Message

await whatsapp.message.sendTextMessage(sessionId, {
    jid: "[email protected]",
    type: "number",
    message: {
        text: "Hello!",
    },
});

🖼️ Send Image Message

await whatsapp.message.sendImageMessage(sessionId, {
    jid: "[email protected]",
    type: "number",
    message: {
        image: {
            url: "https://example.com/image.jpg",
        },
    },
});

🎞️ Send Video Message

await whatsapp.message.sendVideoMessage(sessionId, {
    jid: "[email protected]",
    type: "number",
    message: {
        video: {
            url: "https://example.com/video.mp4",
        },
    },
});

🔊 Send Audio Message

await whatsapp.message.sendAudioMessage(sessionId, {
    jid: "[email protected]",
    type: "number",
    message: {
        audio: {
            url: "https://example.com/audio.wav",
        },
    },
});

📄 Send Document Message

await whatsapp.message.sendDocumentMessage(sessionId, {
    jid: "[email protected]",
    type: "number",
    message: {
        document: {
            url: "https://example.com/file.pdf",
        },
    },
    options: {
        mimetype: "application/pdf",
    },
});

🧪 Example: Full Action Handler Here’s a unified function that handles all actions for reference:

async function main(sessionId: string, action: ActionType) {
// ... fetch env variables & instantiate SDK
switch (action) {
case "connect_qr":
await whatsapp.session.connect(sessionId, "qr");
break;
case "send_text_message":
await whatsapp.message.sendTextMessage(sessionId, { ... });
break;
// other cases...
}
}

🧯 Error Handling Each SDK call may throw an error if:

API keys are missing or invalid

Session ID is incorrect

Action payloads are malformed

Wrap calls in try/catch blocks:

try {
    await whatsapp.session.connect("mysession", "qr");
} catch (error) {
    console.error("Error connecting session:", error);
}

📞 Support For issues or help using the SDK, contact the Kufuli/SocioAPI team or open an issue on GitHub.

🪪 License MIT License. See LICENSE for details.