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

ynastore-baileys

v1.0.21

Published

WhatsApp API Modification

Readme

Ynastore Baileys


Deskripsi

Ynastore Baileys (ynastore-baileys) adalah versi modifikasi dari Baileys library yang dioptimalkan untuk kebutuhan bisnis, otomasi, dan integrasi skala besar. Pustaka ini mendukung berbagai fitur pesan interaktif terbaru dari WhatsApp Business API yang tidak tersedia di library standar.


Fitur Unggulan

  • Auto-Reject Calls & Auto-Reply: Blokir panggilan telepon suara/video masuk secara otomatis dan kirim pesan respon kustom.
  • Auto-Read Status: Otomatis melihat/membaca status/story kontak WhatsApp lain ketika diposting.
  • Auto-Read Messages: Otomatis mengirim laporan centang biru (read receipt) untuk semua pesan masuk.
  • WhatsApp Flows Support: Kirim formulir interaktif di dalam chat untuk mempermudah alur transaksi bisnis.
  • Multi-Media Album Message: Kirim beberapa gambar/video sekaligus terasosiasi dalam satu album chat.
  • Status WhatsApp & Mention: Kirim story/status WhatsApp serta sebut (mention) kontak atau grup secara spesifik.
  • Interactive & Product Message: Dukungan penuh untuk list, native flow buttons, dan katalog produk.
  • Custom Message ID Prefix: Setiap pesan otomatis menggunakan generator ID kustom.

Persyaratan Sistem

  • Node.js: Versi 20 atau yang lebih baru.

Instalasi

npm install ynastore-baileys
# atau menggunakan yarn
yarn add ynastore-baileys

Contoh Penggunaan & Konfigurasi

1. Inisialisasi & Konfigurasi Auto-Reject Calls

const makeWASocket = require('ynastore-baileys').default;
const { useMultiFileAuthState } = require('ynastore-baileys');

async function startSock() {
    const { state, saveCreds } = await useMultiFileAuthState('auth_info_folder');
    
    const sock = makeWASocket({
        auth: state,
        printQRInTerminal: true,
        
        // PENGATURAN KUSTOM AUTO-REJECT CALLS & AUTO-READ
        rejectCalls: true, // Setel ke true untuk menolak semua panggilan masuk secara otomatis
        callRejectMessage: { text: "Maaf, akun ini tidak menerima panggilan suara/video." }, // Pesan balasan otomatis
        autoReadStatus: true, // Setel ke true untuk membaca otomatis semua status/story kontak
        autoReadMessages: false // Setel ke true jika ingin otomatis mengirim centang biru untuk semua chat masuk
    });

    sock.ev.on('creds.update', saveCreds);

    sock.ev.on('connection.update', (update) => {
        const { connection, lastDisconnect } = update;
        if (connection === 'close') {
            console.log('Koneksi terputus, mencoba menghubungkan kembali...');
            startSock();
        } else if (connection === 'open') {
            console.log('Koneksi berhasil terbuka!');
        }
    });

    return sock;
}

startSock();

Dokumentasi API Pengiriman Pesan Kustom

Seluruh fitur di bawah diakses menggunakan method sendMessage standar atau instance utilitas tambahan.

1. Mengirim WhatsApp Flows (Form Interaktif)

await sock.sendMessage(jid, {
    flowMessage: {
        title: "Pilih Layanan",
        body: "Silakan isi formulir pemesanan dengan menekan tombol di bawah ini.",
        footer: "Ynastore Flows",
        flowId: "1234567890", // ID Flow dari Meta Developer
        buttonText: "Buka Formulir",
        screen: "RESERVATION_SCREEN", // ID Screen awal Flow Anda
        params: {
            user_name: "Yna Dev",
            phone: "628xxx"
        }
    }
});

2. Mengirim Album (Multi-Media Terkait)

await sock.sendMessage(jid, {
    albumMessage: [
        { image: { url: 'https://source.unsplash.com/random/800x600?nature' }, caption: 'Foto Alam 1' },
        { image: { url: 'https://source.unsplash.com/random/800x600?water' } },
        { video: { url: 'http://techslides.com/demos/sample-videos/small.mp4' } }
    ],
    albumOptions: {
        newsletterJid: "120363423239131660@newsletter", // Opsional
        newsletterName: "Ynastore Info Channel", // Opsional
        senderName: "Yna Dev" // Opsional
    }
});

3. Mengirim Status / Story Mention (Sebut Kontak/Grup)

await sock.sendStatusMention({
    image: { url: 'https://source.unsplash.com/random/1080x1920?business' },
    text: "Pembaruan sistem Ynastore Baileys siap digunakan!"
}, [
    "[email protected]",
    "[email protected]"
]);

4. Mengirim Pesan Produk & Katalog

await sock.sendMessage(jid, {
    productMessage: {
        title: "Ynastore Premium Bot License",
        description: "Akses bot premium 1 bulan penuh tanpa batas.",
        body: "Dapatkan penawaran terbaik hari ini!",
        footer: "Klik tombol di bawah untuk detail produk",
        productId: "998877",
        retailerId: "ynastore-001",
        priceAmount1000: 50000000, // Rp 50.000 (1000 * harga asli)
        currencyCode: "IDR",
        thumbnail: { url: "https://tourl.ynastore.my.id/cFITq6WW" },
        buttons: [
            {
                name: "send_location",
                buttonParamsJson: "{}"
            }
        ]
    }
});

5. Mengirim Pesan Pembayaran (PAYMENT)

await sock.sendMessage(jid, {
    requestPaymentMessage: {
        amount: 25000000, // Rp 25.000
        currency: "IDR",
        expiry: Math.floor(Date.now() / 1000) + 86400, // Berlaku 24 Jam
        from: "[email protected]",
        note: "Pembayaran lisensi bot bulanan"
    }
});

6. Mengirim Pesan Acara (EVENT)

await sock.sendMessage(jid, {
    eventMessage: {
        name: "Ynastore Gathering 2026",
        description: "Temu komunitas developer & pengguna bot WhatsApp Indonesia.",
        startTime: Date.now() + 86400000,
        endTime: Date.now() + 86400000 + 7200000,
        location: {
            degreesLatitude: -6.200000,
            degreesLongitude: 106.816666,
            name: "Jakarta Convention Center"
        },
        joinLink: "https://chat.whatsapp.com/..."
    }
});

7. Mengirim Hasil Poling (POLL_RESULT)

await sock.sendMessage(jid, {
    pollResultMessage: {
        name: "Hasil polling makan siang hari ini:",
        pollVotes: [
            { optionName: "Nasi Goreng", optionVoteCount: 15 },
            { optionName: "Mie Ayam", optionVoteCount: 8 }
        ]
    }
});

8. Mengirim Pesan Interaktif (Native Flow Buttons / List / Tombol)

await sock.sendMessage(jid, {
    interactiveMessage: {
        header: "Layanan Ynastore",
        title: "Silakan pilih salah satu menu di bawah ini untuk memulai transaksi.",
        footer: "Ynastore Bot System",
        buttons: [
            {
                name: "single_select",
                buttonParamsJson: JSON.stringify({
                    title: "Buka Menu",
                    sections: [
                        {
                            title: "Daftar Produk",
                            rows: [
                                { id: "license_premium", title: "Lisensi Premium", description: "Beli lisensi bot 30 hari" },
                                { id: "topup_balance", title: "Top Up Saldo", description: "Isi ulang saldo instan" }
                            ]
                        }
                    ]
                })
            },
            {
                name: "cta_url",
                buttonParamsJson: JSON.stringify({
                    display_text: "Gabung Grup",
                    url: "https://chat.whatsapp.com/...",
                    merchant_url: "https://chat.whatsapp.com/..."
                })
            }
        ]
    }
});

Kontak & Informasi Pengembang

Jika Anda memerlukan bantuan teknis, integrasi berbayar, atau ingin berkontribusi: