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

andiwagateway

v1.2.0

Published

Official SDK for Andi WA Gateway - WhatsApp API integration made simple. Supports 40+ endpoints including reactions, polls, stories, and more.

Readme

Andi WA Gateway SDK

SDK Official untuk Andi WA Gateway

Tinggal pasang API Key, langsung kirim pesan WhatsApp!


🎯 Fitur

  • API Key Only - Tidak perlu setup server, tinggal API Key
  • Session Auto-Detect - Tidak perlu pilih session, otomatis dari API Key
  • Base URL Built-in - Sudah terkonfigurasi ke andi-wa-gateway.up.railway.app
  • OTP Plugin - Kirim kode verifikasi dengan 1 baris kode
  • Webhook Handler - Terima pesan masuk dengan mudah
  • Express Ready - Middleware siap pakai
  • 40+ API Endpoints - Pesan, media, reaksi, polling, story, dan lebih banyak!

📦 Install

npm install andiwagateway

🚀 Quick Start

1. Kirim Pesan (Basic)

const sdk = require('andiwagateway');

// Inisialisasi - Cukup API Key saja! Session auto-detect dari API Key
const wa = sdk.createClient({
  apiKey: 'ak_live_abc123xyz789'  // Dari Panel Andi WA Gateway
});

// Kirim pesan - Session auto-detect dari API Key!
await wa.sendMessage('628123456789', 'Halo dari SDK!');

// Kalau mau pakai session spesifik (opsional)
await wa.sendMessage('628123456789', 'Halo!', 'session-khusus');

2. Kirim OTP (Plugin)

const sdk = require('andiwagateway');

const otp = sdk.createOtp({
  apiKey: 'ak_live_abc123xyz789'
});

// Kirim OTP
const result = await otp.send('628123456789', {
  appName: 'MyApp'
});

console.log('Kode OTP:', result.code); // Simpan ke database!

// Verifikasi
const isValid = otp.verify(inputUser, result.code);

3. Webhook Handler (Terima Pesan)

const sdk = require('andiwagateway');
const webhook = sdk.createWebhook();

// Handler pesan masuk
webhook.onMessage(async (msg) => {
  console.log('Dari:', msg.from);
  console.log('Isi:', msg.body);
});

// Express middleware
app.post('/webhook/whatsapp', webhook.middleware());

4. Fitur Baru v1.2.0! 🎉

Kirim Reaction Emoji

await wa.sendReaction('628123456789', 'MESSAGE_ID', '👍');

Edit Pesan

await wa.editMessage('628123456789', 'MESSAGE_ID', 'Pesan yang sudah diedit');

Hapus Pesan

await wa.deleteMessage('628123456789', 'MESSAGE_ID', true); // true = for everyone

Forward Pesan

await wa.forwardMessage('628123456789', 'MESSAGE_ID', '628987654321');

Kirim Polling/Voting

await wa.sendPoll('628123456789', 'Apa warna favoritmu?', ['Merah', 'Biru', 'Hijau']);

Post Story/Status

// Post gambar
await wa.postStory('image', 'https://example.com/photo.jpg', 'Caption story');

// Post video
await wa.postStory('video', 'https://example.com/video.mp4', 'Video hari ini');

Cek Nomor Valid

const result = await wa.checkNumber('628123456789');
console.log('Valid WhatsApp?', result.exists);

📚 API Reference

createClient(config)

Membuat instance client utama.

const wa = sdk.createClient({
  apiKey: 'your-api-key',           // Required
  sessionId: 'default-session',     // Optional
  baseUrl: 'https://custom-url.com'  // Optional (override default)
});

Methods:

| Method | Description | |--------|-------------| | wa.sendMessage(number, message, sessionId?) | Kirim pesan teks | | wa.sendMedia(number, mediaUrl, caption?, sessionId?) | Kirim file/media | | wa.getStatus(sessionId?) | Cek status session | | wa.listSessions() | Daftar semua session | | wa.registerWebhook(url, events?) | Register webhook URL | | wa.sendReaction(number, messageId, reaction, sessionId?) | Kirim emoji reaction | | wa.deleteMessage(number, messageId, forEveryone?, sessionId?) | Hapus pesan | | wa.editMessage(number, messageId, newMessage, sessionId?) | Edit pesan | | wa.forwardMessage(number, messageId, fromNumber, sessionId?) | Forward pesan | | wa.sendPoll(number, question, options, allowMultiple?, sessionId?) | Kirim polling | | wa.postStory(type, mediaUrl, caption?, sessionId?) | Post story/status | | wa.checkNumber(number, sessionId?) | Cek nomor valid |

createOtp(config)

Plugin untuk kirim OTP.

const otp = sdk.createOtp({
  apiKey: 'your-api-key',
  sessionId: 'otp-session'
});

Methods:

| Method | Description | |--------|-------------| | otp.generateCode(length?) | Generate kode random | | otp.send(number, options?) | Kirim OTP | | otp.sendWithTemplate(number, template, options?) | Kirim dengan template custom | | otp.verify(input, stored) | Verifikasi kode |

createWebhook(config)

Handler untuk webhook.

const webhook = sdk.createWebhook({
  secret: 'optional-secret'  // Untuk verify signature
});

Methods:

| Method | Description | |--------|-------------| | webhook.on(event, handler) | Register handler untuk event | | webhook.onMessage(handler) | Handler khusus pesan masuk | | webhook.middleware() | Express middleware | | webhook.createRouter() | Express router instance |


💡 Contoh Lengkap

Lihat folder examples/:

  • basic-usage.js - Kirim pesan & media
  • otp-plugin.js - Sistem verifikasi OTP
  • express-webhook.js - Express server dengan webhook
  • reaction-example.js - Kirim reaction emoji
  • story-example.js - Post story/status
  • poll-example.js - Kirim polling

🔧 Environment Variables

WA_GATEWAY_API_KEY=ak_live_abc123xyz789

📞 Support

  • Panel Admin: https://andi-wa-gateway.up.railway.app
  • API Docs: Lihat dokumentasi di panel
  • Version: v1.2.0 (Latest - 40+ Endpoints!)

📄 License

MIT