🚀 DAY 1 OF LAUNCH WEEK: Reachability for Ruby Now in Beta.Learn more →
Socket
Book a DemoInstallSign in
Socket

@sdkwa/whatsapp-api-client

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sdkwa/whatsapp-api-client

Multi-messenger TypeScript SDK for WhatsApp and Telegram - Unified API for both platforms with dynamic messenger selection

latest
Source
npmnpm
Version
1.0.18
Version published
Maintainers
2
Created
Source

SDKWA Multi-Messenger API Client for JavaScript

build License npm version

A modern JavaScript/TypeScript SDK for integrating with multiple messenger platforms through the SDKWA HTTP API.

Supported Messengers:

  • 🟢 WhatsApp - Full support for messaging, media, groups, and webhooks
  • 🔵 Telegram - Full support for messaging, app creation, and authentication

Switch between messengers with a single parameter. All 40+ API methods work with both platforms.

Installation

npm install @sdkwa/whatsapp-api-client

Quick Start

⚠️ Before sending messages, scan QR code with your mobile app:

import SDKWA from "@sdkwa/whatsapp-api-client";

const sdkwa = new SDKWA({
  idInstance: "YOUR_ID_INSTANCE",
  apiTokenInstance: "YOUR_API_TOKEN_INSTANCE"
});

// Get QR code
const qrCode = await sdkwa.getQr();
console.log(qrCode.message); // base64 image - scan with WhatsApp/Telegram app

// Check authorization
const state = await sdkwa.getStateInstance();
console.log(state.stateInstance); // "authorized" when ready

📱 WhatsApp: Settings → Linked Devices → Link a Device
📱 Telegram: Settings → Devices → Link Desktop Device

2. Send Messages

// Send to WhatsApp (default)
await sdkwa.sendMessage({
  chatId: "712345678989@c.us",
  message: "Hello WhatsApp!"
});

// Send to Telegram (override)
await sdkwa.sendMessage({
  chatId: "@username",
  message: "Hello Telegram!"
}, 'telegram');

3. Receive Messages (Webhooks)

import express from "express";

const app = express();
app.use(express.json());

sdkwa.webhookHandler.onIncomingMessageText((data) => {
  console.log("Received:", data);
});

app.post("/webhook", sdkwa.webhookHandler.webhookHandler());
app.listen(3000);

Messenger Selection

// Set default messenger
const sdkwa = new SDKWA({
  idInstance: "YOUR_ID",
  apiTokenInstance: "YOUR_TOKEN",
  messenger: "whatsapp" // or "telegram"
});

// Use default
await sdkwa.getSettings();

// Override per call
await sdkwa.getSettings('telegram');
await sdkwa.sendMessage(params, 'telegram');

All 40+ methods support both messengers: Account, Messaging, Files, Groups, Contacts, Notifications, etc.

Telegram App Creation

// 1. Send confirmation code
await sdkwa.sendConfirmationCode({ phoneNumber: 712345678989 });

// 2. Sign in with code
await sdkwa.signInWithConfirmationCode({ code: "received_code" });

// 3. Create app
await sdkwa.createApp({
  title: "My App",
  shortName: "myapp",
  url: "https://sdkwa.pro",
  description: "My app"
});

Examples

License

MIT

Keywords

whatsapp

FAQs

Package last updated on 06 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts