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

@danzfyz/baileys

v6.8.5

Published

Custom Baileys WhatsApp API

Readme

Baileys WhatsApp Bot (TypeScript/JavaScript)

danfyz


💬 Fitur & Contoh Pengiriman Pesan WhatsApp

Pengiriman Pesan Biasa

Pesan Teks

Mengirim pesan teks biasa ke kontak atau grup WhatsApp.

await sock.sendMessage(jid, { text: "Hello World!" });

Pesan Dengan Quoted

Mengirim pesan yang terhubung (quoted) dengan pesan sebelumnya.

await sock.sendMessage(jid, { text: "Halo balik" }, { quoted: message });

Kirim Mention Pengguna

Mengirim pesan dengan menyebut (mention) pengguna tertentu.

await sock.sendMessage(jid, {
  text: "@12345678901",
  mentions: ["[email protected]"],
});

Pengiriman Media

Mengirim Gambar

Mengirim gambar melalui URL dengan keterangan.

await sock.sendMessage(jid, {
  image: { url: "https://example.com/image.jpg" },
  caption: "Gambar contoh",
});

Mengirim Video

Mengirim video melalui URL dengan keterangan.

await sock.sendMessage(jid, {
  video: { url: "https://example.com/video.mp4" },
  caption: "Video contoh",
});

Mengirim Audio/Voice Note

Mengirim file audio atau voice note (ptt) dalam format MP3.

await sock.sendMessage(jid, {
  audio: { url: "https://example.com/audio.mp3" },
  mimetype: "audio/mpeg",
  ptt: true,
});

Mengirim Dokumen atau File

Mengirim dokumen atau file dalam format PDF.

await sock.sendMessage(jid, {
  document: { url: "https://example.com/file.pdf" },
  fileName: "file.pdf",
  mimetype: "application/pdf",
});

Mengirim Lokasi

Mengirim lokasi geografi dengan koordinat latitude dan longitude.

await sock.sendMessage(jid, {
  location: {
    degreesLatitude: -6.2,
    degreesLongitude: 106.8,
    name: "Jakarta",
    address: "Indonesia",
  },
});

Pengiriman Pesan Dengan Button

Kirim Button Biasa

Mengirim pesan dengan satu tombol.

await sock.sendMessage(jid, {
  text: "Hello!",
  footer: "Footer",
  buttons: [
    {
      buttonId: ".idbutton",
      buttonText: { displayText: "namabutton" },
      type: 1,
    },
  ],
  headerType: 1,
  viewOnce: true,
});

Kirim Button Native

Mengirim pesan dengan tombol native flow.

await sock.sendMessage(jid, {
  text: "Hello World!",
  footer: "Footer",
  buttons: [
    {
      buttonId: ".tes",
      buttonText: { displayText: "TESTING BOT" },
      type: 1,
    },
    {
      buttonId: " ",
      buttonText: { displayText: "PRIVATE SCRIPT" },
      type: 1,
    },
    {
      buttonId: "action",
      buttonText: { displayText: "Pesan Interaktif" },
      type: 4,
      nativeFlowInfo: {
        name: "single_select",
        paramsJson: JSON.stringify({
          title: "Pilih Menu",
          sections: [
            {
              title: "title",
              highlight_label: "😜",
              rows: [
                {
                  header: "HEADER",
                  title: "TITLE",
                  description: "DESC",
                  id: "ID",
                },
              ],
            },
          ],
        }),
      },
    },
  ],
  headerType: 1,
  viewOnce: true,
});

Pengiriman Pesan Lainnya

Kirim Pesan Shop

Mengirim pesan berbentuk item shop dengan detail produk.

sock.sendMessage(
  msg.key.remoteJid,
  {
    text: "Isi Pesan",
    title: "Judul",
    subtitle: "Subjudul",
    footer: "Footer",
    viewOnce: true,
    shop: 3,
    id: "199872865193",
  },
  { quoted: m }
);

Kirim Polling

Mengirim pesan polling untuk survei pilihan.

await sock.sendMessage(
  jid,
  {
    pollResult: {
      name: "Polling Contoh",
      votes: [
        ["Opsi A", 10],
        ["Opsi B", 5],
      ],
    },
  },
  { quoted: m }
);

Kirim Card Kartu

Mengirim pesan dengan format kartu (card) untuk penawaran atau informasi.

await sock.sendMessage(
  jid,
  {
    text: "Halo!",
    footer: "Pesan Footer",
    cards: [
      {
        image: { url: "https://example.jpg" },
        title: "Judul Kartu",
        caption: "Keterangan",
        footer: "Footer Kartu",
        buttons: [
          {
            name: "quick_reply",
            buttonParamsJson: JSON.stringify({
              display_text: "Balas Cepat",
              id: "ID",
            }),
          },
          {
            name: "cta_url",
            buttonParamsJson: JSON.stringify({
              display_text: "Kunjungi Web",
              url: "https://example.com",
            }),
          },
        ],
      },
    ],
  },
  { quoted: m }
);

Kirim Album Media

Mengirim beberapa media sekaligus dalam satu album.

await sock.sendAlbumMessage(
  jid,
  [
    { image: { url: "https://example.jpg" }, caption: "Gambar" },
    { video: { url: "https://example.mp4" }, caption: "Video" },
  ],
  { quoted: message, delay: 2000 }
);

Kirim Undangan Grup

Mengirim undangan untuk bergabung ke grup WhatsApp.

await sock.sendMessage(
  jid,
  {
    groupInvite: {
      subject: "Nama Grup",
      jid: "[email protected]",
      text: "Bergabunglah!",
      inviteCode: "ABCDE",
      inviteExpiration: 86400 * 3,
    },
  },
  { quoted: message }
);

Simpan & Sematkan Pesan

Menyimpan atau menyematkan pesan ke dalam chat.

await sock.sendMessage(jid, { keep: message.key, type: 1, time: 86400 });
await sock.sendMessage(jid, { pin: message.key, type: 1, time: 86400 });

Request Pembayaran

Mengirim permintaan pembayaran dengan informasi detail.

await sock.sendMessage(
  jid,
  {
    requestPayment: {
      currency: "IDR",
      amount: "10000000",
      from: "[email protected]",
      note: "Halo!",
      sticker: { url: "https://example.com/sticker.webp" },
      background: {},
    },
  },
  { quoted: message }
);

Event Acara

Mengirim informasi acara atau event dengan detail waktu dan lokasi.

await sock.sendMessage(
  jid,
  {
    event: {
      isCanceled: false,
      name: "Live Event",
      description: "Deskripsi Event",
      location: {
        degreesLatitude: -6.2,
        degreesLongitude: 106.8,
      },
      startTime: m.messageTimestamp.low,
      endTime: m.messageTimestamp.low + 86400,
      extraGuestsAllowed: true,
    },
  },
  { quoted: message }
);

Forward Pesan

Mengirim pesan yang diteruskan dari percakapan lain.

await sock.sendMessage(jid, { forward: message });

Kontak vCard

Mengirim kontak dalam format vCard.

const vcard = `BEGIN:VCARD
VERSION:3.0
FN:Jeff Singh
ORG:Ashoka Uni;
TEL;type=CELL;type=VOICE;waid=911234567890:+91 12345 67890
END:VCARD`;

await sock.sendMessage(jid, {
  contacts: {
    displayName: "Jeff",
    contacts: [{ vcard }],
  },
});

Reaksi Emoji

Mengirim emoji reaksi terhadap pesan tertentu.

await sock.sendMessage(jid, {
  react: {
    text: "💖",
    key: message.key,
  },
});