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

@pontalabs/baileys

v1.1.5

Published

PontaLabs Baileys is a lightweight, modern, and customizable WhatsApp Web API library built on Baileys.

Readme


📑 Table of Contents


# npm
npm install @pontalabs/baileys

# yarn
yarn add @pontalabs/baileys

import makeWASocket, { useMultiFileAuthState } from '@pontalabs/baileys'

async function start() {
  const { state, saveCreds } = await useMultiFileAuthState('./sessions')

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

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

  sock.ev.on('messages.upsert', ({ messages }) => {
    console.log('New message:', messages[0].message)
  })
}

start()

📖 Documentation

🔌 Connecting

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

if (!sock.authState.creds.registered) {
  const number = '62xxxx'
  const code = await sock.requestPairingCode(number)
  // Or custom 8-digit code:
  const customCode = await sock.requestPairingCode(number, 'PontaLabs')
  console.log(code)
}

📡 Events

sock.ev.on('messages.upsert', ({ messages }) => {
  const msg = messages[0]
  console.log('From:', msg.key.remoteJid)
  console.log('Content:', msg.message)
})
sock.ev.on('messages.update', (m) => {
  if (m.pollUpdates) {
    console.log('Poll vote received:', m.pollUpdates)
  }
})

📨 Sending Messages

sock.sendMessage(jid, content, options?)
  // jid     — Recipient JID (user or group)
  // content — Message payload object
  // options — Optional: { quoted, ephemeral, ... }

Standard Messages

await sock.sendMessage(jid, { text: 'Hello!' })
await sock.sendMessage(jid, { text: 'Reply!' }, { quoted: message })
// From file
await sock.sendMessage(jid, {
  image: fs.readFileSync('image.jpg'),
  caption: 'Caption here'
})

// From URL
await sock.sendMessage(jid, {
  image: { url: 'https://example.com/image.jpg' },
  caption: 'Downloaded image'
})
await sock.sendMessage(jid, {
  video: fs.readFileSync('video.mp4'),
  caption: 'Funny clip!'
})

// View Once
await sock.sendMessage(jid, {
  video: fs.readFileSync('secret.mp4'),
  viewOnce: true
})
// Regular audio
await sock.sendMessage(jid, { audio: fs.readFileSync('audio.mp3'), ptt: false })

// Push-to-talk
await sock.sendMessage(jid, {
  audio: fs.readFileSync('voice.ogg'),
  ptt: true,
  waveform: [0, 1, 0, 1, 0]
})
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'
].join('\n')

await sock.sendMessage(jid, {
  contacts: { displayName: 'Jeff Singh', contacts: [{ vcard }] }
})
await sock.sendMessage(jid, {
  location: {
    degreesLatitude: 37.422,
    degreesLongitude: -122.084,
    name: 'Google HQ'
  }
})
await sock.sendMessage(jid, { react: { text: '👍', key: message.key } })
// Remove reaction
await sock.sendMessage(jid, { react: { text: '', key: message.key } })
await sock.sendMessage(jid, {
  poll: {
    name: 'Favorite color?',
    values: ['Red', 'Blue', 'Green'],
    selectableCount: 1
  }
})
await sock.sendAlbumMessage(jid, [
  { image: { url: 'https://example.com/1.jpg' }, caption: 'First' },
  { video: { url: 'https://example.com/clip.mp4' }, caption: 'Second' }
], { quoted: message, delay: 3000 })
// Native Flow
await sock.sendMessage(jid, {
  text: 'Choose an option:',
  title: 'Title',
  footer: '© PontaLabs Baileys',
  interactive: [{
    name: 'quick_reply',
    buttonParamsJson: JSON.stringify({ display_text: 'Quick Reply', id: '123' })
  }]
})

// Carousel
await sock.sendMessage(jid, {
  text: 'Check out our collection!',
  title: 'Catalog',
  footer: '© PontaLabs Baileys',
  cards: [{
    image: { url: 'https://example.com/image.jpg' },
    title: 'Product Name',
    body: 'Product description',
    footer: '© PontaLabs',
    buttons: [{
      name: 'quick_reply',
      buttonParamsJson: JSON.stringify({ display_text: 'Select', id: '1' })
    }]
  }]
})

Varian tombol raw/proto WhatsApp mentah — lebih fleksibel, tapi kamu yang susun strukturnya sendiri.

buttonsMessage

Kirim objek buttonsMessage proto WhatsApp mentah — thumbnail lokasi di dalamnya otomatis diproses kalau berupa Buffer/URL/path.

await sock.sendMessage(jid, {
  buttonsMessage: {
    contentText: 'Pilih salah satu:',
    footerText: '© PontaCT',
    buttons: [
      { buttonId: 'a', buttonText: { displayText: 'Opsi A' }, type: 1 },
      { buttonId: 'b', buttonText: { displayText: 'Opsi B' }, type: 1 }
    ]
  }
}, { quoted: message })

templateButtons

await sock.sendMessage(jid, {
  text: 'Butuh bantuan?',
  footer: '© PontaCT',
  templateButtons: [
    { index: 1, urlButton: { displayText: 'Kunjungi Website', url: 'https://example.com' } },
    { index: 2, callButton: { displayText: 'Telepon', phoneNumber: '+6281234567890' } }
  ]
}, { quoted: message })

interactiveButtons

await sock.sendMessage(jid, {
  title: 'Menu Utama',
  subtitle: 'Silakan pilih',
  text: 'Ada yang bisa dibantu?',
  footer: '© PontaCT',
  interactiveButtons: [
    { name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: 'Mulai', id: 'start' }) }
  ]
}, { quoted: message })
// Pin — 24h = 86400 · 7d = 604800 · 30d = 2592000
await sock.sendMessage(jid, { pin: { type: 1, time: 86400, key: message.key } })

// Keep
await sock.sendMessage(jid, { keep: { key: message.key, type: 1 } })

📍 Location + Buttons

Location message with native list menu (single_select) and extra buttons — all in one buttonsMessage.

await sock.sendMessage(jid, {
  buttonLocation: {
    latitude: -6.2088,
    longitude: 106.8456,
    name: 'Kantor Pusat PontaCT',
    address: 'Jl. Sudirman No. 1, Jakarta Pusat',
    text: 'Temukan kami di sini:',
    footer: '© PontaCT',
    thumbnail: 'https://example.com/map-preview.jpg',
    listButtonText: 'Pilih Layanan',
    listSectionTitle: 'Layanan Tersedia',
    listMenu: [
      { title: 'Customer Service', description: 'Lantai 1, Senin–Jumat 08.00–17.00', id: 'cs' },
      { title: 'Kasir & Pembayaran', description: 'Lantai 2, buka setiap hari', id: 'kasir' },
      { title: 'Gudang & Pengiriman', description: 'Gedung B, pintu belakang', id: 'gudang' }
    ]
  }
})
await sock.sendMessage(jid, {
  buttonLocation: {
    latitude: -6.2088,
    longitude: 106.8456,
    name: 'Toko PontaCT',
    address: 'Jl. Kebon Sirih No. 10, Jakarta',
    text: 'Kunjungi toko kami!',
    footer: '© PontaCT',
    thumbnail: 'https://example.com/store.jpg',
    extraButtons: [
      { id: 'call', displayText: '📞 Hubungi Kami' },
      { id: 'whatsapp', displayText: '💬 WhatsApp' },
      { id: 'maps', displayText: '🗺️ Buka di Maps' }
    ]
  }
})
await sock.sendMessage(jid, {
  buttonLocation: {
    latitude: -6.2088,
    longitude: 106.8456,
    name: 'Plaza PontaCT',
    address: 'Jl. MH Thamrin No. 5, Jakarta',
    text: 'Selamat datang di pusat layanan kami.',
    footer: 'Buka setiap hari 09.00–21.00',
    thumbnail: 'https://example.com/plaza.jpg',
    listButtonText: 'Pilih Tujuan',
    listSectionTitle: 'Area Tersedia',
    listMenu: [
      { title: 'Food Court', description: 'Lt. 1 — lebih dari 30 tenant', id: 'food' },
      { title: 'Cinema', description: 'Lt. 4 — 8 studio', id: 'cinema' },
      { title: 'Customer Care', description: 'Lt. 2 — sebelah eskalator', id: 'care' }
    ],
    extraButtons: [
      { id: 'navigate', displayText: '🧭 Navigasi' },
      { id: 'promo', displayText: '🎁 Promo Hari Ini' }
    ]
  }
})

| Field | Type | Required | Default | Description | |:---|:---|:---:|:---|:---| | latitude | number | — | 0 | Latitude coordinate | | longitude | number | — | 0 | Longitude coordinate | | name | string | — | 'Location' | Place name | | address | string | — | '' | Text address | | text | string | — | '' | Message body text | | footer | string | — | '' | Footer text | | thumbnail | Buffer / URL / path | ✅ | — | Map preview image | | listButtonText | string | — | 'Pilih Menu' | List button label | | listSectionTitle | string | — | 'Pilihan' | List section title | | listMenu | array | — | — | Menu rows | | extraButtons | array | — | — | Extra buttons |


📦 Order Status

Interactive order tracking card using native order_status flow button.

await sock.sendMessage(jid, {
  orderStatus: {
    image: 'https://example.com/order-banner.jpg',
    title: 'Status Pesanan',
    text: 'Pesanan kamu sedang diproses oleh penjual.',
    referenceId: 'ORD-20250629-001',
    status: 'PROCESSING',
    currency: 'IDR'
  }
})
await sock.sendMessage(jid, {
  orderStatus: {
    image: 'https://example.com/order.jpg',
    title: 'Update Pesanan #ORD-2025-001',
    text: 'Pesananmu sedang dalam perjalanan! 🚚',
    footer: 'Estimasi tiba: 2–3 hari kerja',
    referenceId: 'ORD-2025-001',
    status: 'SHIPPED',
    subtotalValue: 15000000,
    subtotalOffset: 100,
    taxValue: 1500000,
    taxOffset: 100,
    currency: 'IDR'
  }
})
const fs = require('fs')
await sock.sendMessage(jid, {
  orderStatus: {
    image: fs.readFileSync('./assets/order-confirm.jpg'),
    title: 'Pesanan Dikonfirmasi ✅',
    text: 'Terima kasih telah berbelanja!',
    referenceId: 'ORD-LOCAL-001',
    status: 'PROCESSING',
    currency: 'IDR'
  }
})

| Field | Type | Required | Default | Description | |:---|:---|:---:|:---|:---| | image | Buffer / URL / path | ✅ | — | Header card image | | title | string | — | 'Order Status' | Header title | | text | string | — | 'Silakan cek status pesanan Anda.' | Body text | | footer | string | — | 'Powered by PontaCT' | Footer text | | referenceId | string | — | 'PT-001' | Order reference ID | | status | string | — | 'PROCESSING' | Order status | | subtotalValue | number | — | 0 | Subtotal value (in offset units) | | subtotalOffset | number | — | 100 | Value divider | | taxValue | number | — | 0 | Tax value | | taxOffset | number | — | 100 | Tax divider | | currency | string | — | 'IDR' | Currency code |

Status values: PROCESSING · SHIPPED · DELIVERED · CANCELLED · REFUNDED


🤖 Rich Messages

All rich messages are sent via standard sendMessage and rendered as AI bot messages in WhatsApp. Use the appropriate key instead of text, image, video, etc.

Quick jump: Rich Text · Code · Table · Images · Video · Suggestions · LaTeX · Product · Post · Reels · Sources · Tip & Footer · Mixed · Response


📝 Rich Text

AI bot-styled markdown text rendered in richResponseMessage.

await sock.sendMessage(jid, { richText: 'Halo! Ini pesan dari bot.' }, { quoted: message })
await sock.sendMessage(jid, {
  richText: '*Hasil eksekusi:*\nStatus: `success`\nWaktu: _120ms_'
}, { quoted: message })
await sock.sendMessage(jid, {
  richText: ['Baris pertama.', 'Baris kedua.', 'Baris ketiga.']
}, { quoted: message })

💻 Rich Code Block

Syntax-highlighted code. Use code for single block, codes for multiple.

await sock.sendMessage(jid, {
  code: 'console.log("Hello World")',
  language: 'javascript'
}, { quoted: message })
await sock.sendMessage(jid, {
  codes: [
    { code: 'SELECT * FROM users WHERE id = 1;', language: 'sql' },
    { code: '{ "id": 1, "name": "Ponta", "role": "admin" }', language: 'json' }
  ]
}, { quoted: message })

| Language | Key | |:---|:---| | JavaScript | javascript · js | | TypeScript | typescript · ts | | Python | python · py | | Bash / Shell | bash · sh · zsh | | Go | go · golang | | Rust | rust · rs | | C / C++ | c · h · cpp · c++ | | C# | csharp · cs | | CSS / HTML | css · html | | PowerShell / CMD | powershell · ps1 · cmd · bat | | SQL / JSON | sql · json |


📊 Rich Table

Structured table with title, headers, and rows.

await sock.sendMessage(jid, {
  table: {
    title: 'Daftar User',
    headers: ['Name', 'Role', 'Status'],
    rows: [
      ['Ponta', 'Admin', 'Active'],
      ['Yue', 'Member', 'Idle'],
      ['Frieren', 'Guest', 'Offline']
    ]
  }
}, { quoted: message })
await sock.sendMessage(jid, {
  table: {
    headers: ['Command', 'Description'],
    rows: [
      ['.ping', 'Cek latency bot'],
      ['.info', 'Info bot'],
      ['.help', 'List semua command']
    ]
  }
}, { quoted: message })
await sock.sendMessage(jid, {
  table: {
    rows: [
      ['RAM', '512 MB'],
      ['CPU', '4 Core'],
      ['Uptime', '99.9%']
    ]
  }
}, { quoted: message })

🖼️ Rich Images

AI image grid. Single URL = single image, multiple URLs = carousel.

await sock.sendMessage(jid, { richImages: 'https://example.com/photo.jpg' }, { quoted: message })
await sock.sendMessage(jid, {
  richImages: [
    'https://example.com/photo1.jpg',
    'https://example.com/photo2.jpg',
    'https://example.com/photo3.jpg'
  ]
}, { quoted: message })
// items
await sock.sendMessage(jid, {
  items: [
    { text: 'Hasil foto hari ini:' },
    { images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] }
  ]
}, { quoted: message })

// richResponse
await sock.sendMessage(jid, {
  richResponse: [
    { text: 'Lihat gambarnya:' },
    { images: 'https://example.com/banner.jpg' }
  ]
}, { quoted: message })

🎥 Rich Video

Video embed as AI animated media (GenAIImaginePrimitive with imagine_type: ANIMATE).

await sock.sendMessage(jid, { richVideo: 'https://example.com/clip.mp4' }, { quoted: message })
await sock.sendMessage(jid, {
  richVideo: {
    url: 'https://example.com/clip.mp4',
    mimeType: 'video/mp4',        // default: 'video/mp4'
    duration: 15,                   // seconds, default: 10
    fallbackText: 'Preview video' // default: '[ VIDEO - PontaCT ]'
  }
}, { quoted: message })
// items
await sock.sendMessage(jid, {
  items: [
    { text: 'Cek videonya:' },
    { videoUrl: 'https://example.com/clip.mp4', duration: 20 }
  ]
}, { quoted: message })

// richResponse
await sock.sendMessage(jid, {
  richResponse: [
    { text: 'Tutorial:' },
    { video: { url: 'https://example.com/tutorial.mp4', duration: 30 } }
  ]
}, { quoted: message })

💡 Rich Suggestions

Follow-up prompt pills — like native AI chat buttons.

await sock.sendMessage(jid, {
  richSuggestions: ['Coba lagi', 'Lihat detail', 'Batalkan']
}, { quoted: message })
// items
await sock.sendMessage(jid, {
  items: [
    { text: 'Mau lanjut ke mana?' },
    { suggestions: ['Halaman utama', 'Bantuan', 'Hubungi admin'] }
  ]
}, { quoted: message })

// richResponse
await sock.sendMessage(jid, {
  richResponse: [
    { text: 'Hasil pencarian ditemukan.' },
    { suggestions: ['Tampilkan semua', 'Filter ulang', 'Export'] }
  ]
}, { quoted: message })

🔣 Rich LaTeX

Math formula rendering as GenAILatexItem inline entity. url points to a rendered formula image (PNG/JPG from external LaTeX renderer).

await sock.sendMessage(jid, {
  richLatex: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2'
}, { quoted: message })
await sock.sendMessage(jid, {
  richLatex: {
    url: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2',
    text: 'E = mc²',     // label & fallback
    width: 120,            // default: 100
    height: 60,            // default: 100
    font_height: 83.33,    // default: 83.33
    padding: 15            // default: 15
  }
}, { quoted: message })
// items
await sock.sendMessage(jid, {
  items: [
    { text: 'Rumus energi kinetik:' },
    {
      latexUrl: 'https://latex.codecogs.com/png.latex?E_k%3D%5Cfrac%7B1%7D%7B2%7Dmv%5E2',
      latexText: 'Ek = ½mv²',
      latexWidth: 150,
      latexHeight: 60
    }
  ]
}, { quoted: message })

// richResponse
await sock.sendMessage(jid, {
  richResponse: [
    { text: 'Solusi integral:' },
    { latex: { url: 'https://latex.codecogs.com/png.latex?%5Cint%20x%5E2%20dx', text: '∫x² dx = x³/3 + C' } }
  ]
}, { quoted: message })

🛍️ Rich Product

Product card(s) as GenAIProductItemCardPrimitive. Object = single card, Array = horizontal scroll carousel.

await sock.sendMessage(jid, {
  richProduct: {
    title: 'Sepatu Adidas Samba',
    price_display_string: 'Rp 1.200.000',
    description: 'Sepatu casual ikonik, tersedia berbagai ukuran.',
    retailer_id: 'adidas_store',
    thumbnail: { url: 'https://example.com/adidas.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
  }
}, { quoted: message })
await sock.sendMessage(jid, {
  richProduct: [
    {
      title: 'Sepatu A',
      price_display_string: 'Rp 500.000',
      thumbnail: { url: 'https://example.com/a.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
    },
    {
      title: 'Sepatu B',
      price_display_string: 'Rp 750.000',
      thumbnail: { url: 'https://example.com/b.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
    }
  ]
}, { quoted: message })
// items
await sock.sendMessage(jid, {
  items: [
    { text: 'Rekomendasi produk hari ini:' },
    { product: { title: 'Produk X', price_display_string: 'Rp 99.000' } }
  ]
}, { quoted: message })

// richResponse
await sock.sendMessage(jid, {
  richResponse: [
    { text: 'Pilih produkmu:' },
    { product: [{ title: 'A' }, { title: 'B' }] }
  ]
}, { quoted: message })

📰 Rich Post

Post card(s) as GenAIPostPrimitive. Object = single post, Array = carousel.

await sock.sendMessage(jid, {
  richPost: {
    title: 'Caption post ini',
    author_display_name: '@pontalabs',
    author_profile_image: 'https://example.com/avatar.jpg',
    media_url: 'https://example.com/post.jpg',
    timestamp: Math.floor(Date.now() / 1000)
  }
}, { quoted: message })
await sock.sendMessage(jid, {
  richPost: [
    { title: 'Post 1', author_display_name: '@user1', media_url: 'https://example.com/1.jpg' },
    { title: 'Post 2', author_display_name: '@user2', media_url: 'https://example.com/2.jpg' }
  ]
}, { quoted: message })

🎬 Rich Reels

Reels carousel as GenAIReelPrimitive with contentItemsMetadata. Auto-injects richResponseSourcesMetadata with provider: 'PontaCT'.

await sock.sendMessage(jid, {
  richReels: {
    title: '@creator_name',
    profileIconUrl: 'https://example.com/avatar.jpg',
    thumbnailUrl: 'https://example.com/thumb.jpg',
    videoUrl: 'https://example.com/reel.mp4',
    reels_title: 'Judul reel ini',
    likes_count: 12400,
    shares_count: 340,
    view_count: 89000,
    reel_source: 'IG',
    is_verified: true
  }
}, { quoted: message })
await sock.sendMessage(jid, {
  richReels: [
    {
      title: '@creator1',
      profileIconUrl: 'https://example.com/av1.jpg',
      thumbnailUrl: 'https://example.com/th1.jpg',
      videoUrl: 'https://example.com/r1.mp4',
      likes_count: 5000,
      reel_source: 'IG'
    },
    {
      title: '@creator2',
      profileIconUrl: 'https://example.com/av2.jpg',
      thumbnailUrl: 'https://example.com/th2.jpg',
      videoUrl: 'https://example.com/r2.mp4',
      likes_count: 8200,
      reel_source: 'TT'
    }
  ]
}, { quoted: message })

| Field | Type | Default | Description | |:---|:---|:---:|:---| | title | string | — | Username / creator name | | profileIconUrl | string | — | Avatar URL | | thumbnailUrl | string | — | Thumbnail cover URL | | videoUrl | string | — | Video source URL | | reels_title | string | '' | Reel title | | likes_count | number | 0 | Like count | | shares_count | number | 0 | Share count | | view_count | number | 0 | View count | | reel_source | string | 'IG' | Source platform | | is_verified | boolean | false | Verified badge |


🔍 Rich Sources

Search result source list as GenAISearchResultPrimitive. Accepts full objects or shorthand [faviconUrl, sourceUrl, displayName].

await sock.sendMessage(jid, {
  richSources: [
    ['https://wikipedia.org/favicon.ico', 'https://wikipedia.org/wiki/Node.js', 'Wikipedia'],
    ['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs'],
    ['https://github.com/favicon.ico', 'https://github.com/nodejs/node', 'GitHub']
  ]
}, { quoted: message })
await sock.sendMessage(jid, {
  richSources: [
    {
      source_type: 'THIRD_PARTY',
      source_display_name: 'Wikipedia',
      source_subtitle: 'wikipedia.org',
      source_url: 'https://wikipedia.org/wiki/Node.js',
      favicon: { url: 'https://wikipedia.org/favicon.ico', mime_type: 'image/jpeg', width: 16, height: 16 }
    }
  ]
}, { quoted: message })
await sock.sendMessage(jid, {
  richSources: [
    ['https://wikipedia.org/fav.ico', 'https://wikipedia.org', 'Wikipedia'],
    { source_type: 'THIRD_PARTY', source_display_name: 'Docs', source_url: 'https://docs.example.com' }
  ]
}, { quoted: message })

📌 Rich Tip & Footer

richTip — small metadata text above/center of message.
richFooter — metadata text below message (disclaimer / branding).

await sock.sendMessage(jid, {
  richTip: 'Dihasilkan oleh AI · pontalabs v0.3.4'
}, { quoted: message })
await sock.sendMessage(jid, {
  richFooter: '© 2025 PontaCT · Data bersumber dari layanan publik'
}, { quoted: message })
// items
await sock.sendMessage(jid, {
  items: [
    { text: 'Hasil pencarian:' },
    { sources: [['https://fav.ico', 'https://example.com', 'Example']] },
    { tip: 'AI-generated content' },
    { footer: '© PontaCT Baileys' }
  ]
}, { quoted: message })

// richResponse
await sock.sendMessage(jid, {
  richResponse: [
    { text: 'Summary di sini.' },
    { footer: '© PontaCT · pontalabs' }
  ]
}, { quoted: message })

🔀 Rich Mixed — items

Combine all rich types in any order. Array order = display order.

Valid keys in items:

| Key | Type | |:---|:---| | { text } | Rich text | | { code, language } | Code block | | { table } | Table | | { images } | Image grid | | { videoUrl, mimeType?, duration? } | Video embed | | { suggestions } | Suggestion pills | | { latexUrl, latexText?, latexWidth?, latexHeight? } | LaTeX formula | | { product } | Product card(s) | | { post } | Post card(s) | | { reels } | Reels carousel | | { sources } | Search sources | | { tip } | Tip metadata | | { footer } | Footer metadata |

await sock.sendMessage(jid, {
  items: [
    { text: 'Query yang dijalankan:' },
    { code: 'SELECT id, name, score FROM users ORDER BY score DESC LIMIT 3', language: 'sql' },
    { text: 'Hasil:' },
    {
      table: {
        headers: ['id', 'name', 'score'],
        rows: [
          ['1', 'Ponta', '98'],
          ['2', 'Yue', '87'],
          ['3', 'Frieren', '75']
        ]
      }
    }
  ]
}, { quoted: message })
await sock.sendMessage(jid, {
  items: [
    { text: '*Konten hari ini*' },
    { images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] },
    { videoUrl: 'https://example.com/preview.mp4', duration: 15 },
    { suggestions: ['Lihat selengkapnya', 'Bagikan', 'Simpan'] }
  ]
}, { quoted: message })
await sock.sendMessage(jid, {
  items: [
    { text: '*Laporan Harian Bot*' },
    { table: { headers: ['Metric', 'Value'], rows: [['Uptime', '99.9%'], ['Messages', '1.2K']] } },
    { code: 'SELECT COUNT(*) FROM messages WHERE date = CURDATE()', language: 'sql' },
    { text: 'Formula uptime:' },
    {
      latexUrl: 'https://latex.codecogs.com/png.latex?U%3D%5Cfrac%7Bt_u%7D%7Bt_t%7D%5Ctimes100',
      latexText: 'U = (tu/tt) × 100'
    },
    { sources: [['https://example.com/fav.ico', 'https://example.com', 'Dashboard']] },
    { suggestions: ['Refresh', 'Export PDF'] },
    { footer: 'Auto-generated · PontaCT' }
  ]
}, { quoted: message })

🔗 Rich Response — richResponse

Full array mode supporting all types including inline citations via inlineEntities.

Valid keys in richResponse:

| Key | Type | |:---|:---| | { text, inlineEntities? } | Text + optional citation/hyperlink | | { code, language } | Code block | | { table, title? } | Table | | { images } | Image grid | | { video } | Video embed | | { suggestions } | Suggestion pills | | { latex } | LaTeX formula | | { product } | Product card(s) | | { post } | Post card(s) | | { reels } | Reels carousel | | { sources } | Search sources | | { tip } | Tip metadata | | { footer } | Footer metadata |

await sock.sendMessage(jid, {
  richResponse: [
    {
      text: 'Node.js {{SS_0}}¹{{/SS_0}} adalah runtime JavaScript. Dibuat oleh Ryan Dahl {{SS_1}}²{{/SS_1}} pada 2009.',
      inlineEntities: [
        {
          key: 'SS_0',
          metadata: {
            reference_id: 1,
            reference_url: 'https://nodejs.org',
            reference_title: 'Node.js Official',
            reference_display_name: 'nodejs.org',
            sources: [{
              source_type: 'THIRD_PARTY',
              source_display_name: 'nodejs.org',
              source_subtitle: 'nodejs.org',
              source_url: 'https://nodejs.org'
            }],
            __typename: 'GenAISearchCitationItem'
          }
        },
        {
          key: 'SS_1',
          metadata: {
            reference_id: 2,
            reference_url: 'https://wikipedia.org/wiki/Ryan_Dahl',
            reference_title: 'Ryan Dahl - Wikipedia',
            reference_display_name: 'Wikipedia',
            sources: [{
              source_type: 'THIRD_PARTY',
              source_display_name: 'Wikipedia',
              source_subtitle: 'wikipedia.org',
              source_url: 'https://wikipedia.org/wiki/Ryan_Dahl'
            }],
            __typename: 'GenAISearchCitationItem'
          }
        }
      ]
    }
  ]
}, { quoted: message })
await sock.sendMessage(jid, {
  richResponse: [
    { text: '*Hasil Pencarian:* Node.js {{SS_0}}¹{{/SS_0}}', inlineEntities: [/* ... */] },
    { images: ['https://example.com/nodejs.png'] },
    { text: 'Cara install:' },
    { code: 'npm install node', language: 'bash' },
    { table: { headers: ['Version', 'LTS', 'Release'], rows: [['22.x', 'Yes', '2024'], ['21.x', 'No', '2023']] } },
    { sources: [['https://nodejs.org/fav.ico', 'https://nodejs.org', 'Node.js']] },
    { suggestions: ['Lihat changelog', 'Download', 'Docs'] },
    { footer: 'PontaCT · pontalabs' }
  ]
}, { quoted: message })

Mode teks kaya versi lama: tulis kutipan/link/LaTeX langsung di dalam teks pakai sintaks [teks](url) untuk link, [](url) untuk sitasi, dan [rumus|w|h](rumus) untuk LaTeX — otomatis di-parse jadi entity inline.

await sock.sendMessage(jid, {
  richMessage: {
    text: 'Menurut [Wikipedia](https://wikipedia.org/wiki/Node.js), Node.js dibuat oleh Ryan Dahl.'
  }
}, { quoted: message })

📣 Newsletter

// By invite code
const newsletter = await sock.newsletterMetadata('invite', '0029Vaf0HPMLdQeZsp3XRp2T')

// By JID
const newsletter = await sock.newsletterMetadata('jid', '120363282083849178@newsletter')
const nlJid = '120363282083849178@newsletter'

await sock.newsletterFollow(nlJid)
await sock.newsletterUnfollow(nlJid)
await sock.newsletterMute(nlJid)
await sock.newsletterUnmute(nlJid)
const newsletter = await sock.newsletterCreate(
  'Newsletter Name',
  'Description here',
  { url: 'https://example.com/image.jpg' }
)
await sock.newsletterReactMessage(
  '120363282083849178@newsletter',
  '12',   // server message ID
  '🦖'    // emoji
)

👥 Groups

const group = await sock.groupCreate('Group Title', [
  '[email protected]',
  '[email protected]'
])

console.log('Group JID:', group.id)
const jid = '[email protected]'

await sock.groupSettingUpdate(jid, 'announcement')      // admin-only messages
await sock.groupSettingUpdate(jid, 'not_announcement')  // all members can send
await sock.groupSettingUpdate(jid, 'locked')            // admin-only edit info
await sock.groupSettingUpdate(jid, 'unlocked')          // all members can edit info
const participants = ['[email protected]']

await sock.groupParticipantsUpdate(jid, participants, 'add')
await sock.groupParticipantsUpdate(jid, participants, 'remove')
await sock.groupParticipantsUpdate(jid, participants, 'promote')
await sock.groupParticipantsUpdate(jid, participants, 'demote')
const code = await sock.groupInviteCode(jid)
console.log('Link: https://chat.whatsapp.com/' + code)

// Revoke & generate new link
const newCode = await sock.groupRevokeInvite(jid)
const metadata = await sock.groupMetadata(jid)
console.log('Name:', metadata.subject)
console.log('Participants:', metadata.participants.length)

Send group status (groupStatusMessageV2) with audience control and styling. message can be a string or a prepared WAMessage object.

// Text Status
await sock.sendMessage(jid, {
  groupStatus: {
    message: 'Selamat datang di grup PontaCT! 🎉',
    audienceType: 0  // 0 = all members
  }
})

// Styled Text Status
await sock.sendMessage(jid, {
  groupStatus: {
    message: 'Bot aktif kembali! ✅',
    audienceType: 0,
    backgroundArgb: 0xFF1A1A2E,
    textArgb: 0xFFFFFFFF,
    font: 4
  }
})

// Media Status
const { imageMessage } = await prepareWAMessageMedia(
  { image: { url: 'https://example.com/banner.jpg' } },
  { upload: sock.waUploadToServer }
)

await sock.sendMessage(jid, {
  groupStatus: { message: { imageMessage }, audienceType: 0 }
})

| Field | Type | Required | Default | Description | |:---|:---|:---:|:---|:---| | message | string / object | ✅ | — | Status content (string or WAMessage) | | audienceType | number | — | 0 | Target audience (0 = all) | | backgroundArgb | number | — | — | Background ARGB color (text only) | | textArgb | number | — | — | Text ARGB color (text only) | | font | number | — | — | Font style 0–9 (text only) |


🔒 Privacy

await sock.updateProfilePicture(jid, { url: 'https://example.com/image.jpg' })
await sock.removeProfilePicture(jid)
await sock.updateBlockStatus(jid, 'block')
await sock.updateBlockStatus(jid, 'unblock')
await sock.updateLastSeenPrivacy('all')         // 'all' | 'contacts' | 'none'
await sock.updateOnlinePrivacy('all')           // 'all' | 'match_last_seen'
await sock.updateProfilePicturePrivacy('all')   // 'all' | 'contacts' | 'none'
await sock.updateReadReceiptsPrivacy('all')     // 'all' | 'none'
await sock.updateGroupsAddPrivacy('all')        // 'all' | 'contacts'
await sock.updateDefaultDisappearingMode(86400) // 0 = disable

⚙️ Advanced

const sock = makeWASocket({
  logger: { level: 'debug' }, // 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace'
  auth: state
})
sock.ws.on('CB:presence', (json) => {
  console.log('Presence update:', json)
})

sock.ws.on('CB:edge_routing', (node) => {
  console.log('Edge routing:', node)
})

Dua fungsi util untuk memproses respons RSVP (GOING / NOT_GOING / MAYBE) pada pesan event kalender secara lokal, tanpa perlu ambil ulang dari server.

const { updateMessageWithEventResponse, getAggregateResponsesInEventMessage } = require('@pontalabs/baileys')

// terapkan RSVP baru ke object event message yang sudah kamu simpan
updateMessageWithEventResponse(eventMsg, {
  eventResponseMessageKey: update.key,
  response: { response: 1 } // 1 = GOING
})

// rekap semua RSVP jadi { GOING: [...], NOT_GOING: [...], MAYBE: [...] }
const summary = getAggregateResponsesInEventMessage(eventMsg, sock.user.lid)

⚡ Contact

| Platform | Link | |:---|:---| | 💬 Telegram | @pontact | | 📢 Channel | WhatsApp Channel | | 🌐 REST API | api.codeteam.web.id |


🤝 Contributing

  1. Fork repository
  2. Create a feature branch: git checkout -b feat/your-feature
  3. Commit your changes: git commit -m "feat: add something awesome"
  4. Push to your branch: git push origin feat/your-feature
  5. Open a Pull Request

📜 License

This project is licensed for personal and non-commercial use only.

| | | |:---:|:---| | ✅ | Personal use and modification allowed | | ✅ | Redistribution with attribution allowed | | ❌ | Commercial use strictly prohibited | | ❌ | Resale or rebranding prohibited |


⚠️ Disclaimer

This project is not affiliated with WhatsApp or Meta in any way.
Use at your own risk and refer to WhatsApp's Terms of Service for compliance.


📦 NPM · 📖 Baileys Wiki · ⭐ Star this repo

Made with ♥ by PontaCT