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

@nuiisatoru/baileys

v0.0.1

Published

A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by NuiiS4TORU.

Downloads

172

Readme


📚 Navigasi

Koneksi QR Code  ·  Pairing Code  ·  Browser Identity  ·  Opsi Koneksi

Handle Pesan Terima Pesan  ·  Handle Grup

Kirim Pesan Teks  ·  Gambar  ·  Video  ·  Audio & Voice Note  ·  Dokumen  ·  Sticker  ·  Lokasi  ·  Kontak

Interaksi Reaksi  ·  Poll  ·  Poll Result  ·  Poll Update  ·  Forward  ·  Hapus  ·  Edit  ·  Pin

Tambahan Album  ·  Event  ·  Group Status  ·  Flow Reply  ·  Button Reply  ·  Keep In Chat  ·  Scheduled Call  ·  Group Invite  ·  Product

Wrapper View Once  ·  View Once V2  ·  Ephemeral  ·  Spoiler  ·  Group Status Wrap  ·  Lottie Sticker

Interactive Buttons  ·  List Message  ·  Template Buttons  ·  Native Flow  ·  Carousel

Rich Message (AI) Code Block  ·  Links  ·  Table  ·  Rich Response (Gabungan)

Lainnya List Reply  ·  Sticker Pack  ·  External Ad Reply  ·  Request Payment  ·  Invoice  ·  Order  ·  Disappearing Messages  ·  Raw Message


Instalasi

const { default: makeWASocket } = require('@nuiisatoru/baileys')
// atau ESM
import makeWASocket from '@nuiisatoru/baileys'

🔌 Koneksi QR Code

const {
  default: makeWASocket,
  useMultiFileAuthState,
  DisconnectReason,
  fetchLatestBaileysVersion
} = require('@nuiisatoru/baileys')

async function start() {
  const { state, saveCreds } = await useMultiFileAuthState('auth_info')
  const { version } = await fetchLatestBaileysVersion()

  const sock = makeWASocket({
    version,
    auth: state,
    printQRInTerminal: true
  })

  sock.ev.on('creds.update', saveCreds)
  sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
    if (connection === 'close') {
      const code = lastDisconnect?.error?.output?.statusCode
      if (code !== DisconnectReason.loggedOut) start()
    } else if (connection === 'open') {
      console.log('✅ Terhubung!')
    }
  })
}
start()

🔑 Koneksi Pairing Code

Untuk server/VPS tanpa tampilan terminal.

const sock = makeWASocket({
  version,
  auth: state,
  printQRInTerminal: false
})

sock.ev.on('creds.update', saveCreds)
sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
  if (connection === 'close') {
    if (lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut) start()
  }
})

// Nomor HP format internasional tanpa +
if (!sock.authState.creds.registered) {
  const code = await sock.requestPairingCode('628123456789')
  console.log('Pairing code:', code)
  // Masukkan di WA → Perangkat Tertaut → Tautkan Perangkat
}

Pairing code kadaluarsa dalam beberapa menit. Jalankan ulang jika gagal.

Custom pairing code (8 karakter):

const code = await sock.requestPairingCode('628123456789', 'ABCD1234')

🖥️ Browser Identity

const { Browsers } = require('@nuiisatoru/baileys')

makeWASocket({
  browser: Browsers.macOS('Chrome'),   // Mac OS — Chrome
  browser: Browsers.macOS('Firefox'),  // Mac OS — Firefox
  browser: Browsers.windows('Chrome'), // Windows — Chrome
  browser: Browsers.ubuntu('Chrome'),  // Ubuntu — Chrome
  browser: Browsers.baileys('Chrome'), // Baileys — Chrome
  browser: ['MyBot', 'Chrome', '1.0.0'] // custom
})

⚙️ Opsi Koneksi

makeWASocket({
  version,
  auth: state,
  printQRInTerminal: true,
  browser: Browsers.macOS('Chrome'),
  connectTimeoutMs: 20000,
  keepAliveIntervalMs: 30000,
  markOnlineOnConnect: true,
  syncFullHistory: false,
  generateHighQualityLinkPreview: false,
  emitOwnEvents: true,
  getMessage: async key => store?.messages?.[key.remoteJid]?.get(key.id)?.message
})

📥 Terima Pesan

sock.ev.on('messages.upsert', async ({ messages, type }) => {
  if (type !== 'notify') return

  for (const m of messages) {
    if (!m.message) continue
    if (m.key.fromMe) continue

    const jid = m.key.remoteJid
    const isGroup = jid.endsWith('@g.us')
    const sender = isGroup ? m.key.participant : jid

    // Ambil teks
    const text =
      m.message.conversation ||
      m.message.extendedTextMessage?.text ||
      m.message.imageMessage?.caption ||
      m.message.videoMessage?.caption || ''

    // Tandai dibaca
    await sock.readMessages([m.key])

    // Typing indicator
    await sock.sendPresenceUpdate('composing', jid)
  }
})

👥 Handle Grup

// Anggota masuk/keluar
sock.ev.on('group-participants.update', ({ id, participants, action }) => {
  // action: 'add' | 'remove' | 'promote' | 'demote'
})

// Info grup diupdate
sock.ev.on('groups.update', updates => {})

// Metadata grup
const meta = await sock.groupMetadata(groupJid)
console.log(meta.subject, meta.participants)

// Semua grup
const groups = await sock.groupFetchAllParticipating()

// Tambah / keluarkan / promote / demote
await sock.groupParticipantsUpdate(groupJid, ['[email protected]'], 'add')
await sock.groupParticipantsUpdate(groupJid, ['[email protected]'], 'remove')
await sock.groupParticipantsUpdate(groupJid, ['[email protected]'], 'promote')
await sock.groupParticipantsUpdate(groupJid, ['[email protected]'], 'demote')

// Ubah nama / deskripsi
await sock.groupUpdateSubject(groupJid, 'Nama Baru')
await sock.groupUpdateDescription(groupJid, 'Deskripsi baru')

// Kunci / buka grup
await sock.groupSettingUpdate(groupJid, 'announcement')
await sock.groupSettingUpdate(groupJid, 'not_announcement')

// Mention semua anggota
const meta2 = await sock.groupMetadata(groupJid)
const members = meta2.participants.map(p => p.id)
await sock.sendMessage(groupJid, {
  text: members.map(m => `@${m.split('@')[0]}`).join(' '),
  mentions: members
})

💬 Teks

await sock.sendMessage(jid, { text: 'Halo!' })

// Dengan mention
await sock.sendMessage(jid, {
  text: '@628xxx halo!',
  mentions: ['[email protected]']
}, { quoted: m })

🖼️ Gambar

// URL
await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  caption: 'Keterangan'
})

// Buffer / file
await sock.sendMessage(jid, {
  image: fs.readFileSync('image.jpg'),
  caption: 'Keterangan'
})

🎥 Video

await sock.sendMessage(jid, {
  video: { url: 'https://example.com/video.mp4' },
  caption: 'Keterangan',
  gifPlayback: false  // true = GIF looping
})

// Video note (bubble)
await sock.sendMessage(jid, {
  video: fs.readFileSync('video.mp4'),
  ptv: true
})

🎵 Audio & Voice Note

// Audio biasa
await sock.sendMessage(jid, {
  audio: { url: 'https://example.com/audio.mp3' },
  mimetype: 'audio/mpeg'
})

// Voice note (PTT)
await sock.sendMessage(jid, {
  audio: fs.readFileSync('voice.ogg'),
  mimetype: 'audio/ogg; codecs=opus',
  ptt: true
})

📄 Dokumen

await sock.sendMessage(jid, {
  document: fs.readFileSync('file.pdf'),
  mimetype: 'application/pdf',
  fileName: 'dokumen.pdf',
  caption: 'File ini'
})

🎭 Sticker

await sock.sendMessage(jid, {
  sticker: fs.readFileSync('sticker.webp')
})

📍 Lokasi

await sock.sendMessage(jid, {
  location: {
    degreesLatitude: -6.2088,
    degreesLongitude: 106.8456,
    name: 'Monas',
    address: 'Jakarta Pusat'
  }
})

👤 Kontak

await sock.sendMessage(jid, {
  contacts: {
    displayName: 'Nama',
    contacts: [{
      vcard: 'BEGIN:VCARD\nVERSION:3.0\nFN:Nama\nTEL:+62812345678\nEND:VCARD'
    }]
  }
})

😀 Reaksi

await sock.sendMessage(jid, { react: { text: '👍', key: m.key } })
// Hapus reaksi
await sock.sendMessage(jid, { react: { text: '', key: m.key } })

🗳️ Poll

await sock.sendMessage(jid, {
  poll: {
    name: 'Pilih salah satu?',
    values: ['Opsi A', 'Opsi B', 'Opsi C'],
    selectableCount: 1  // 0 = boleh pilih banyak
  }
})

Poll dengan fitur tambahan:

await sock.sendMessage(jid, {
  poll: {
    name: 'Nama Poll',
    values: ['Opsi A', 'Opsi B'],
    selectableCount: 1,
    endDate: new Date('2025-12-31'),   // tanggal berakhir
    hideVoter: true,                    // sembunyikan nama pemilih
    canAddOption: false,                // larang tambah opsi
    toAnnouncementGroup: false          // true = community announcement group (pollV2)
  }
})

Quiz (Poll dengan jawaban benar):

await sock.sendMessage(jid, {
  poll: {
    name: 'Ibu kota Indonesia?',
    values: ['Jakarta', 'Surabaya', 'Bandung'],
    selectableCount: 1,
    pollType: 1,           // 1 = QUIZ
    correctAnswer: 'Jakarta'
  }
})

📊 Poll Result

await sock.sendMessage(jid, {
  pollResult: {
    name: 'Nama Poll',
    votes: [
      { name: 'Opsi A', voteCount: 10 },
      { name: 'Opsi B', voteCount: 5 }
    ],
    pollType: 0  // 0 = POLL, 1 = QUIZ
  }
})

🗳️ Poll Update

await sock.sendMessage(jid, {
  pollUpdate: {
    key: pollMessage.key,  // key dari pesan poll yang mau di-vote
    vote: encryptedVotePayload,
    metadata: optionalMetadata
  }
})

↩️ Forward

await sock.sendMessage(jid, {
  forward: targetMessage,
  force: true  // paksa tampil sebagai forwarded
})

🗑️ Hapus Pesan

await sock.sendMessage(jid, { delete: m.key })

✏️ Edit Pesan

await sock.sendMessage(jid, {
  text: 'Teks yang sudah diedit',
  edit: m.key
})

📌 Pin Pesan

// Pin
await sock.sendMessage(jid, {
  pin: m.key,
  type: 1,
  time: 86400  // 86400=1hr | 604800=7hr | 2592000=30hr
})
// Unpin
await sock.sendMessage(jid, { pin: m.key, type: 2 })

🖼️ Album

await sock.sendMessage(jid, {
  album: [
    { image: { url: 'https://example.com/1.jpg' }, caption: 'Foto 1' },
    { image: { url: 'https://example.com/2.jpg' }, caption: 'Foto 2' },
    { video: { url: 'https://example.com/vid.mp4' }, caption: 'Video' }
  ]
})
// minimal 2 media

📅 Event

await sock.sendMessage(jid, {
  event: {
    name: 'Nama Acara',
    description: 'Deskripsi',
    startDate: new Date('2025-12-01T10:00:00'),
    endDate: new Date('2025-12-01T12:00:00'),
    location: {
      degreesLatitude: -6.2088,
      degreesLongitude: 106.8456,
      name: 'Monas, Jakarta'
    },
    extraGuestsAllowed: true
  }
})

Event dengan scheduled call (audio/video):

await sock.sendMessage(jid, {
  event: {
    name: 'Meeting Online',
    startDate: new Date('2025-12-01T10:00:00'),
    call: 'audio',   // 'audio' | 'video'
    isScheduleCall: true
  }
})

📸 Group Status / Group Story

// Teks
await sock.sendMessage(groupJid, {
  groupStatusMessage: { text: 'Status teks!' }
})

// Gambar
await sock.sendMessage(groupJid, {
  groupStatusMessage: {
    image: { url: 'https://example.com/image.jpg' },
    caption: 'Keterangan'
  }
})

// Video
await sock.sendMessage(groupJid, {
  groupStatusMessage: {
    video: { url: 'https://example.com/video.mp4' },
    caption: 'Keterangan'
  }
})

⚡ Flow Reply

Balas pesan interaktif native flow:

await sock.sendMessage(jid, {
  flowReply: {
    name: 'quick_reply',       // nama button yang ditekan
    paramsJson: '{"id":"btn1"}',
    text: 'Teks balasan',
    format: 1,
    version: 1
  }
})

🔘 Button Reply

// Template button
await sock.sendMessage(jid, {
  buttonReply: {
    displayText: 'Opsi yang dipilih',
    id: 'btn_id',
    index: 0
  },
  type: 'template'
})

// Plain button
await sock.sendMessage(jid, {
  buttonReply: {
    displayText: 'Opsi yang dipilih',
    id: 'btn_id'
  },
  type: 'plain'
})

📌 Keep In Chat

// Simpan
await sock.sendMessage(jid, {
  keep: m.key,
  keepType: 1  // 1 = keep, 2 = unkeep
})

📞 Scheduled Call

await sock.sendMessage(jid, {
  call: {
    time: Date.now() + 3600000,
    type: 1,  // 1 = voice, 2 = video
    title: 'Meeting'
  }
})

🔗 Group Invite

await sock.sendMessage(jid, {
  groupInvite: {
    jid: '[email protected]',
    inviteCode: 'kode',
    inviteExpiration: Date.now() + 86400000,
    subject: 'Nama Grup',
    text: 'Bergabunglah!'
  }
})

🛍️ Product

await sock.sendMessage(jid, {
  product: {
    productImage: fs.readFileSync('produk.jpg'),
    productId: 'prod_123',
    title: 'Nama Produk',
    description: 'Deskripsi',
    currencyCode: 'IDR',
    priceAmount1000: 50000000,
    retailerId: 'sku_001',
    url: 'https://toko.example.com/produk'
  },
  businessOwnerJid: '[email protected]'  // wajib diisi
})

👁️ View Once

await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  viewOnce: true
})

👁️ View Once V2

await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  viewOnceV2: true  // wrap ke viewOnceMessageV2
})

// viewOnceV2Extension
await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  viewOnceV2Extension: true
})

⏱️ Ephemeral

Wrap pesan ke dalam ephemeralMessage:

await sock.sendMessage(jid, {
  text: 'Pesan ini ephemeral',
  ephemeral: true
})

🫣 Spoiler

Wrap pesan ke dalam spoilerMessage:

await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  caption: 'Spoiler!',
  spoiler: true
})

📢 Group Status Wrap

Wrap pesan biasa menjadi groupStatusMessageV2:

await sock.sendMessage(jid, {
  text: 'Status di grup ini',
  groupStatus: true
})

🌀 Lottie Sticker

Wrap sticker ke dalam lottieStickerMessage:

await sock.sendMessage(jid, {
  sticker: fs.readFileSync('sticker.webp'),
  isLottie: true
})

🔲 Buttons

Kirim pesan dengan tombol interaktif (plain buttons):

// Dengan teks biasa
await sock.sendMessage(jid, {
  text: 'Pilih salah satu:',
  footer: 'Footer pesan',
  buttons: [
    { id: 'btn1', text: 'Tombol 1' },
    { id: 'btn2', text: 'Tombol 2' },
    { id: 'btn3', text: 'Tombol 3' }
  ]
})

// Dengan gambar sebagai header
await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  caption: 'Isi pesan',
  footer: 'Footer',
  buttons: [
    { id: 'btn1', text: 'Pilih A' },
    { id: 'btn2', text: 'Pilih B' }
  ]
})

// Native flow button (single select dengan sections)
await sock.sendMessage(jid, {
  text: 'Pilih menu:',
  buttons: [
    {
      text: 'Buka Menu',
      sections: [
        {
          title: 'Kategori A',
          rows: [
            { id: 'row1', title: 'Item 1', description: 'Deskripsi' },
            { id: 'row2', title: 'Item 2' }
          ]
        }
      ]
    }
  ]
})

// Native flow button dengan name kustom
await sock.sendMessage(jid, {
  text: 'Pilih:',
  buttons: [
    { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'Quick Reply' }
  ]
})

📋 List Message

Kirim pesan daftar pilihan:

await sock.sendMessage(jid, {
  text: 'Silakan pilih:',
  title: 'Judul List',
  buttonText: 'Buka Daftar',
  footer: 'Footer pesan',
  sections: [
    {
      title: 'Bagian 1',
      rows: [
        { id: 'row1', title: 'Pilihan A', description: 'Deskripsi A' },
        { id: 'row2', title: 'Pilihan B', description: 'Deskripsi B' }
      ]
    },
    {
      title: 'Bagian 2',
      rows: [
        { id: 'row3', title: 'Pilihan C' }
      ]
    }
  ]
})

🗂️ Template Buttons

Tombol template (quick reply, URL, call) — tampil di WhatsApp Web/Desktop & iOS:

// Dengan teks
await sock.sendMessage(jid, {
  text: 'Pesan template',
  footer: 'Footer',
  id: 'template-unik',
  templateButtons: [
    { id: 'btn1', text: 'Quick Reply' },
    { url: 'https://example.com', text: 'Kunjungi Website' },
    { call: '+62812345678', text: 'Hubungi Kami' }
  ]
})

// Dengan gambar sebagai header
await sock.sendMessage(jid, {
  image: { url: 'https://example.com/img.jpg' },
  caption: 'Isi pesan',
  title: 'Judul',
  footer: 'Footer',
  templateButtons: [
    { id: 'btn1', text: 'Klik Sini' },
    { url: 'https://example.com', text: 'Buka Link' }
  ]
})

🌊 Native Flow

Pesan interaktif dengan native flow buttons (mendukung media header, audio footer):

// Teks dengan native flow buttons
await sock.sendMessage(jid, {
  text: 'Pilih aksi:',
  footer: 'Footer pesan',
  nativeFlow: [
    { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'Opsi 1' },
    { name: 'quick_reply', paramsJson: '{"id":"2"}', text: 'Opsi 2' }
  ]
})

// Dengan gambar sebagai header
await sock.sendMessage(jid, {
  image: { url: 'https://example.com/img.jpg' },
  caption: 'Isi pesan',
  title: 'Judul',
  subtitle: 'Subjudul',
  footer: 'Footer',
  nativeFlow: [
    { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'Tombol 1' }
  ]
})

// Dengan audio footer
await sock.sendMessage(jid, {
  text: 'Pesan dengan audio footer',
  audioFooter: fs.readFileSync('audio.ogg'),
  nativeFlow: [
    { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'OK' }
  ]
})

// Wrap sebagai templateMessage
await sock.sendMessage(jid, {
  text: 'Template interaktif',
  nativeFlow: [
    { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'Tombol' }
  ],
  interactiveAsTemplate: true,
  id: 'template-id-unik'
})

🎠 Carousel

Pesan carousel dengan kartu-kartu (image/video/product per kartu):

await sock.sendMessage(jid, {
  text: 'Carousel utama',
  footer: 'Footer utama',
  cards: [
    {
      image: { url: 'https://example.com/1.jpg' },
      title: 'Kartu 1',
      caption: 'Deskripsi kartu 1',
      footer: 'Footer kartu 1',
      nativeFlow: [
        { name: 'quick_reply', paramsJson: '{"id":"c1"}', text: 'Pilih Ini' }
      ]
    },
    {
      image: { url: 'https://example.com/2.jpg' },
      title: 'Kartu 2',
      caption: 'Deskripsi kartu 2',
      nativeFlow: [
        { name: 'quick_reply', paramsJson: '{"id":"c2"}', text: 'Pilih Itu' },
        { url: 'https://example.com', text: 'Lihat Detail' }
      ]
    },
    {
      video: { url: 'https://example.com/vid.mp4' },
      caption: 'Video kartu',
      nativeFlow: [
        { name: 'quick_reply', paramsJson: '{"id":"c3"}', text: 'Tonton' }
      ]
    }
  ]
})

📝 List Reply

Balas pemilihan dari list message:

await sock.sendMessage(jid, {
  listReply: {
    title: 'Pilihan yang dipilih',
    description: 'Deskripsi pilihan',
    id: 'row1'
  }
})

🎴 Sticker Pack

Kirim paket sticker:

await sock.sendMessage(jid, {
  stickers: [
    {
      sticker: fs.readFileSync('sticker1.webp'),
      metadata: { stickerPackId: 'pack123', stickerPackName: 'My Pack' }
    },
    {
      sticker: fs.readFileSync('sticker2.webp')
    }
  ]
})

🔗 External Ad Reply

Tambahkan konteks iklan eksternal pada pesan (tampil sebagai preview besar di atas pesan):

await sock.sendMessage(jid, {
  text: 'Halo dari iklan!',
  externalAdReply: {
    title: 'Judul Iklan',
    body: 'Deskripsi singkat',
    url: 'https://example.com',
    thumbnail: fs.readFileSync('thumbnail.jpg'),  // wajib Buffer
    mediaType: 1,
    largeThumbnail: true
  }
})

💸 Request Payment

Minta pembayaran dari kontak (dibutuhkan teks atau sticker sebagai pesan catatan):

// Dengan teks
await sock.sendMessage(jid, {
  text: 'Tolong bayar untuk pesanan ini',
  requestPaymentFrom: '[email protected]',
  amount1000: 50000000,      // nominal × 1000 (Rp50.000 → 50000000)
  currencyCodeIso4217: 'IDR',
  expiryTimestamp: Date.now() + 86400000
})

🧾 Invoice

Kirim pesan invoice (butuh gambar atau dokumen sebagai lampiran):

// Invoice dengan gambar
await sock.sendMessage(jid, {
  image: fs.readFileSync('invoice.jpg'),
  invoiceNote: 'Catatan invoice ini'
})

// Invoice dengan PDF
await sock.sendMessage(jid, {
  document: fs.readFileSync('invoice.pdf'),
  mimetype: 'application/pdf',
  fileName: 'invoice.pdf',
  invoiceNote: 'Invoice bulan ini'
})

🛒 Order

Kirim pesan pesanan (order):

await sock.sendMessage(jid, {
  orderText: 'Pesanan dari katalog',
  thumbnail: fs.readFileSync('thumbnail.jpg'),  // wajib Buffer
  itemCount: 3,
  totalAmount1000: 150000000,  // Rp150.000
  totalCurrencyCode: 'IDR'
})

⏳ Disappearing Messages

Aktifkan/nonaktifkan pesan menghilang di sebuah chat:

// Aktifkan (gunakan durasi default 7 hari)
await sock.sendMessage(jid, { disappearingMessagesInChat: true })

// Nonaktifkan
await sock.sendMessage(jid, { disappearingMessagesInChat: false })

// Durasi kustom (dalam detik)
await sock.sendMessage(jid, { disappearingMessagesInChat: 86400 })  // 1 hari

🧩 Raw Message

Kirim pesan proto langsung tanpa transformasi (untuk kasus advanced):

await sock.sendMessage(jid, {
  raw: true,
  extendedTextMessage: {
    text: 'Pesan raw',
    contextInfo: { ... }
  }
})

⚠️ Field raw akan di-delete sebelum dikirim. Sisa object digunakan apa adanya sebagai WAProto.Message.


🤖 Rich Message (AI)

Tipe pesan Rich — ditampilkan sebagai botForwardedMessage dengan rendering khusus (code highlight, tabel, links dengan citation). Cocok untuk bot AI.

💻 Code Block

await sock.sendMessage(jid, {
  code: 'console.log("Hello World")',
  language: 'javascript',  // default: 'javascript'
  headerText: 'Contoh kode:',
  footerText: 'Semoga membantu!'
})

Bahasa yang didukung: javascript, python, java, typescript, cpp, c, go, rust, php, ruby, swift, kotlin, dll (sesuai LANGUAGE_KEYWORDS di constants.js).


🔗 Links (Rich)

Kirim teks dengan citation/referensi link inline:

await sock.sendMessage(jid, {
  links: [
    {
      text: 'Cek dokumentasi resmi',
      title: 'Judul Referensi',
      url: 'https://example.com',
      displayName: 'Nama Tautan',
      sources: [
        {
          displayName: 'Sumber 1',
          subtitle: 'Subjudul',
          url: 'https://source1.com'
        }
      ]
    }
  ],
  headerText: 'Info penting:',
  footerText: 'Sumber terpercaya'
})

📊 Table (Rich)

Kirim pesan dalam bentuk tabel:

await sock.sendMessage(jid, {
  table: [
    ['Nama', 'Usia', 'Kota'],          // baris pertama = header
    ['Budi', '25', 'Jakarta'],
    ['Sari', '22', 'Bandung'],
    ['Andi', '30', 'Surabaya']
  ],
  title: 'Data Pengguna',
  noHeading: false,   // true = baris pertama bukan header
  headerText: 'Daftar data:',
  footerText: 'Total: 3 pengguna'
})

🎨 Rich Response (Gabungan)

Gabungkan teks, code block, dan tabel dalam satu pesan:

await sock.sendMessage(jid, {
  richResponse: [
    {
      text: 'Berikut contoh kode Python:',
      inlineEntities: []  // opsional
    },
    {
      code: 'def greet(name):\n    print(f"Hello, {name}!")',
      language: 'python'
    },
    {
      text: 'Dan berikut tabelnya:'
    },
    {
      table: [
        { isHeading: true, items: ['Kolom A', 'Kolom B'] },
        { isHeading: false, items: ['Data 1', 'Data 2'] }
      ],
      title: 'Tabel Data'
    }
  ],
  disclaimerText: 'Disclaimer di bawah pesan'  // opsional
})

Opsi Umum

Semua sendMessage mendukung opsi ke-3:

await sock.sendMessage(jid, content, {
  quoted: m,                              // reply/quote pesan
  ephemeralExpiration: 86400,             // pesan hilang (detik)
  statusJidList: ['[email protected]'], // kirim status ke JID
  mediaUploadTimeoutMs: 30000,
  backgroundColor: '#FF0000',
  font: 1
})

Opsi tambahan di dalam content:

await sock.sendMessage(jid, {
  text: 'Pesan dengan opsi ekstra',
  mentions: ['[email protected]'],   // mention spesifik
  mentionAll: true,                       // mention semua (nonJidMentions)
  contextInfo: { ... }                    // contextInfo manual (di-merge)
})

Tabel Semua Tipe Pesan

| Property | Tipe Proto | Keterangan | |---|---|---| | text | extendedTextMessage | Teks dengan link preview | | image | imageMessage | Gambar | | video | videoMessage | Video | | audio | audioMessage | Audio / Voice note (ptt: true) | | document | documentMessage | File/dokumen | | sticker | stickerMessage | Sticker WebP | | stickers | stickerPackMessage | Paket sticker | | location | locationMessage | Lokasi GPS | | contacts | contactMessage / contactsArrayMessage | Kontak vCard | | react | reactionMessage | Reaksi emoji | | poll | pollCreationMessage / V2 / V3 / V5 | Poll / Quiz | | pollResult | pollResultSnapshotMessage / V3 | Hasil poll | | pollUpdate | pollUpdateMessage | Update vote poll | | forward | (inherit) | Forward pesan | | delete | protocolMessage (REVOKE) | Hapus pesan | | edit | protocolMessage (MESSAGE_EDIT) | Edit pesan | | pin | pinInChatMessage | Pin/unpin pesan | | keep | keepInChatMessage | Simpan pesan | | album | albumMessage | Album foto/video | | event | eventMessage | Event/acara | | groupStatusMessage | (dugong handler) | Group Story/Status | | groupInvite | groupInviteMessage | Undangan grup | | product | productMessage | Produk katalog | | flowReply | interactiveResponseMessage | Balas native flow | | buttonReply | templateButtonReplyMessage / buttonsResponseMessage | Balas tombol | | listReply | listResponseMessage | Balas list | | call | (scheduled call handler) | Panggilan terjadwal | | buttons | buttonsMessage | Tombol interaktif | | sections | listMessage | Daftar pilihan | | templateButtons | templateMessage | Template buttons | | nativeFlow | interactiveMessage | Native flow buttons | | cards | interactiveMessage (carouselMessage) | Carousel cards | | externalAdReply | (contextInfo inject) | Preview iklan eksternal | | requestPaymentFrom | requestPaymentMessage | Minta pembayaran | | invoiceNote | invoiceMessage | Invoice | | orderText | orderMessage | Pesanan/order | | disappearingMessagesInChat | protocolMessage (EPHEMERAL_SETTING) | Pesan menghilang | | code | botForwardedMessage (richResponseMessage) | Code block (AI) | | links | botForwardedMessage (richResponseMessage) | Links dengan citation (AI) | | table | botForwardedMessage (richResponseMessage) | Tabel (AI) | | richResponse | botForwardedMessage (richResponseMessage) | Gabungan rich message (AI) | | raw | (passthrough) | Kirim proto langsung | | viewOnce | viewOnceMessage | Lihat sekali | | viewOnceV2 | viewOnceMessageV2 | Lihat sekali V2 | | viewOnceV2Extension | viewOnceMessageV2Extension | Lihat sekali V2 extension | | ephemeral | ephemeralMessage | Wrap ephemeral | | spoiler | spoilerMessage | Wrap spoiler | | groupStatus | groupStatusMessageV2 | Wrap group status | | isLottie | lottieStickerMessage | Wrap lottie sticker |


File yang Dimodifikasi

| File | Keterangan | |---|---| | lib/Socket/dugong.js | Handler GROUP_STORY, ALBUM, EVENT, POLL_RESULT | | lib/Socket/messages-send.js | Route pesan + getBizBinaryNode dinamis | | lib/Utils/messages.js | Semua handler tipe pesan lengkap | | lib/Utils/rich-message-utils.js | Helper Rich Message / AI Response | | lib/WABinary/generic-utils.js | getBizBinaryNode dengan FLOWS_MAP | | lib/Types/Message.js | Export ButtonType, ListType, dll | | lib/WABinary/constants.js | LANGUAGE_KEYWORDS untuk syntax highlight | | lib/Defaults/index.js | LEXER_REGEX, DONATE_URL, LIBRARY_NAME |


Project ini tidak berafiliasi dengan WhatsApp atau Meta. "WhatsApp" adalah merek dagang terdaftar dari pemiliknya masing-masing.