{"_id":"@aseppxyzz12/baileys","_rev":"4-024570269bf5d66c118748f6aab5e7c2","name":"@aseppxyzz12/baileys","dist-tags":{"latest":"2.1.2"},"versions":{"1.1.8":{"name":"@aseppxyzz12/baileys","version":"1.1.8","keywords":["whatsapp","automation","baileys","AsepXyz","bot"],"author":{"name":"AsepXyz"},"license":"MIT","_id":"@aseppxyzz12/baileys@1.1.8","maintainers":[{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"}],"homepage":"https://www.npmjs.com/package/asepxyz","dist":{"shasum":"b73c3f1d3c11d24b40bd564bda4a31ac3345aa65","tarball":"https://registry.npmjs.org/@aseppxyzz12/baileys/-/baileys-1.1.8.tgz","fileCount":185,"integrity":"sha512-WeAWd9vqWgS6LRRWj1iWG8OdjsDynQQ2HKNpcxRio8sB8p0xpJIhqP0SRDapS3nt42IWyGRvTZugRjI/VM0p4Q==","signatures":[{"sig":"MEQCIAhR6DyJEnoj2rWdMvpcxvTWYHq66BD5NAKOXJbHnA+FAiAJmToI3LXXvjkNQinVJ4HTGjIuzgXrpwXiQeGIwEDXJg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22966677},"main":"lib/index.js","engines":{"node":">=20.0.0"},"exports":{".":{"import":"./lib/index.js","default":"./lib/index.js","require":"./lib/index.js"},"./*":"./lib/*","./package.json":"./package.json"},"scripts":{"lint":"eslint src --ext .js,.ts","test":"jest","release":"release-it","lint:fix":"yarn lint --fix","preinstall":"node ./engine-requirements.js","changelog:last":"conventional-changelog -p angular -r 2","changelog:update":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","changelog:preview":"conventional-changelog -p angular -u"},"_npmUser":{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"},"_npmVersion":"11.17.0","description":"A complete WhatsApp Web library — fork of Baileys with @username support, rich messages, LID/PN mapping, TikTok downloader, Turnstile bypass, and more.","directories":{"lib":"lib"},"_nodeVersion":"24.17.0","dependencies":{"ws":"^8.13.0","pino":"^9.6","uuid":"^9.0.0","axios":"^1.3.3","chalk":"^4.1.2","fflate":"^0.8.2","lodash":"^4.17.21","p-queue":"^9.0.0","libsignal":"npm:asepxyz-signal","lru-cache":"^11.1.0","unfurl.js":"^6.4.0","@hapi/boom":"^9.1.3","node-cache":"^5.1.2","node-fetch":"^2.6.1","protobufjs":"^7.5.6","async-mutex":"^0.5.0","futoin-hkdf":"^1.5.1","audio-decode":"^2.2.2","cache-manager":"^5.7.6","music-metadata":"^11.12.3","qrcode-terminal":"^0.12.0","libphonenumber-js":"^1.10.20","@adiwajshing/keyed-db":"^0.2.4","@cacheable/node-cache":"1.5.3"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.19","devDependencies":{"jest":"^30.1.1","jimp":"^0.22.12","json":"^11.0.0","open":"^8.4.2","eslint":"^8.0.0","ts-jest":"^29.4.1","ts-node":"^10.8.1","typedoc":"^0.27.9","@types/ws":"^8.0.0","release-it":"^15.10.3","typescript":"^5.8.2","@types/jest":"^29.5.14","@types/node":"^16.0.0","eslint-config":"npm:asepxyz-eslint-config","typedoc-plugin-markdown":"4.4.2","conventional-changelog-cli":"^2.2.2"},"peerDependencies":{"jimp":"^0.22.12","sharp":"*"},"peerDependenciesMeta":{"jimp":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/baileys_1.1.8_1783314199206_0.964956936921872","host":"s3://npm-registry-packages-npm-production"}},"1.1.9":{"name":"@aseppxyzz12/baileys","version":"1.1.9","keywords":["whatsapp","automation","baileys","AsepXyz","bot"],"author":{"name":"AsepXyz"},"license":"MIT","_id":"@aseppxyzz12/baileys@1.1.9","maintainers":[{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"}],"homepage":"https://www.npmjs.com/package/asepxyz","dist":{"shasum":"d2d8da6ddfce842c5112d204889e80c0f2b0e386","tarball":"https://registry.npmjs.org/@aseppxyzz12/baileys/-/baileys-1.1.9.tgz","fileCount":185,"integrity":"sha512-2gmayBK2AR3OC5Vd130DmG0Gdidrtqko/5jVvr+Q/VkmlRLI6ylwPKXKh2YszISpwXgWm1UasKmhLHTYs6rSWg==","signatures":[{"sig":"MEUCIHLmi0QD1puleCtQq2IJevhCSLU3Fbbobb5Xi4Z0qerXAiEA30qTHrru8ZZa6VKh65GzWBwjIm4sJLKgqv1J5ZzEqMY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22966675},"main":"lib/index.js","engines":{"node":">=20.0.0"},"exports":{".":{"import":"./lib/index.js","default":"./lib/index.js","require":"./lib/index.js"},"./*":"./lib/*","./package.json":"./package.json"},"scripts":{"lint":"eslint src --ext .js,.ts","test":"jest","release":"release-it","lint:fix":"yarn lint --fix","preinstall":"node ./engine-requirements.js","changelog:last":"conventional-changelog -p angular -r 2","changelog:update":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","changelog:preview":"conventional-changelog -p angular -u"},"_npmUser":{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"},"_npmVersion":"11.17.0","description":"A complete WhatsApp Web library — fork of Baileys with @username support, rich messages, LID/PN mapping, TikTok downloader, Turnstile bypass, and more.","directories":{"lib":"lib"},"_nodeVersion":"24.17.0","dependencies":{"ws":"^8.13.0","pino":"^9.6","uuid":"^9.0.0","axios":"^1.3.3","chalk":"^4.1.2","fflate":"^0.8.2","lodash":"^4.17.21","p-queue":"^9.0.0","libsignal":"npm:asepxyz-signal","lru-cache":"^11.1.0","unfurl.js":"^6.4.0","@hapi/boom":"^9.1.3","node-cache":"^5.1.2","node-fetch":"^2.6.1","protobufjs":"^7.5.6","async-mutex":"^0.5.0","futoin-hkdf":"^1.5.1","audio-decode":"^2.2.2","cache-manager":"^5.7.6","music-metadata":"^11.12.3","qrcode-terminal":"^0.12.0","libphonenumber-js":"^1.10.20","@adiwajshing/keyed-db":"^0.2.4","@cacheable/node-cache":"1.5.3"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.19","devDependencies":{"jest":"^30.1.1","jimp":"^0.22.12","json":"^11.0.0","open":"^8.4.2","eslint":"^8.0.0","ts-jest":"^29.4.1","ts-node":"^10.8.1","typedoc":"^0.27.9","@types/ws":"^8.0.0","release-it":"^15.10.3","typescript":"^5.8.2","@types/jest":"^29.5.14","@types/node":"^16.0.0","eslint-config":"npm:asepxyz-eslint-config","typedoc-plugin-markdown":"4.4.2","conventional-changelog-cli":"^2.2.2"},"peerDependencies":{"jimp":"^0.22.12","sharp":"*"},"peerDependenciesMeta":{"jimp":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/baileys_1.1.9_1783314616527_0.9441713930880273","host":"s3://npm-registry-packages-npm-production"}},"2.1.1":{"name":"@aseppxyzz12/baileys","version":"2.1.1","keywords":["whatsapp","automation","baileys","AsepXyz"],"author":{"name":"AsepXyz"},"license":"MIT","_id":"@aseppxyzz12/baileys@2.1.1","maintainers":[{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"}],"homepage":"https://www.npmjs.com/package/asepxyz","dist":{"shasum":"db852d053eaab78bcc68492ff301055dbc9d42c9","tarball":"https://registry.npmjs.org/@aseppxyzz12/baileys/-/baileys-2.1.1.tgz","fileCount":476,"integrity":"sha512-18CFK/igjBtTgQZqeEMzOKpB7ecZA0PZgT86xiAIN1UB79zYWDuwE+xAFEsbJQUkMth88q8roeVZOeNRBKwv9A==","signatures":[{"sig":"MEQCIHOkcqMuG7ttJyI8ovFz5ZI9rwl/ZF1YeGmD2P9ZZexRAiBVfiS+KTn224N0yuQF4+rH9/gnHvKXqJROLMIUgjHw6A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":36762872},"main":"lib/index.js","engines":{"node":">=20.0.0"},"scripts":{"lint":"eslint src --ext .js,.ts","test":"jest","release":"release-it","lint:fix":"yarn lint --fix","preinstall":"node ./engine-requirements.js","changelog:last":"conventional-changelog -p angular -r 2","changelog:update":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","changelog:preview":"conventional-changelog -p angular -u"},"_npmUser":{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"},"_npmVersion":"11.17.0","description":"A WebSockets library for interacting with WhatsApp Web (fork of levvleys/Baileys) — now with @username support, rich message helpers (tables/lists/code blocks), and LID/PN mapping sync","directories":{"lib":"lib"},"_nodeVersion":"24.17.0","dependencies":{"ws":"^8.13.0","pino":"^9.6","uuid":"^9.0.0","axios":"^1.3.3","chalk":"^4.1.2","fflate":"^0.8.2","lodash":"^4.17.21","p-queue":"^9.0.0","libsignal":"npm:asepxyz-signal","lru-cache":"^11.1.0","unfurl.js":"^6.4.0","@hapi/boom":"^9.1.3","node-cache":"^5.1.2","node-fetch":"^2.6.1","protobufjs":"^7.5.6","async-mutex":"^0.5.0","futoin-hkdf":"^1.5.1","audio-decode":"^2.2.2","cache-manager":"^5.7.6","fluent-ffmpeg":"^2.1.2","libsignal-alt":"file:./vendor/libsignal-alt","music-metadata":"^11.12.3","qrcode-terminal":"^0.12.0","libphonenumber-js":"^1.10.20","@adiwajshing/keyed-db":"^0.2.4","@cacheable/node-cache":"1.5.3","@whiskeysockets/baileys":"file:./lib-alt"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.19","devDependencies":{"jest":"^30.1.1","jimp":"^0.22.12","json":"^11.0.0","open":"^8.4.2","eslint":"^8.0.0","ts-jest":"^29.4.1","ts-node":"^10.8.1","typedoc":"^0.27.9","@types/ws":"^8.0.0","release-it":"^15.10.3","typescript":"^5.8.2","@types/jest":"^29.5.14","@types/node":"^16.0.0","eslint-config":"npm:asepxyz-eslint-config","typedoc-plugin-markdown":"4.4.2","conventional-changelog-cli":"^2.2.2"},"peerDependencies":{"jimp":"^0.22.12","sharp":"*"},"peerDependenciesMeta":{"jimp":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/baileys_2.1.1_1783405988882_0.20004048240835792","host":"s3://npm-registry-packages-npm-production"}},"2.1.2":{"name":"@aseppxyzz12/baileys","version":"2.1.2","description":"A complete WhatsApp Web library — fork of Baileys with @username support, rich messages, LID/PN mapping, TikTok downloader, Turnstile bypass, and more.","keywords":["whatsapp","automation","baileys","AsepXyz","bot"],"homepage":"https://www.npmjs.com/package/asepxyz","license":"MIT","author":{"name":"AsepXyz"},"main":"lib/index.js","directories":{"lib":"lib"},"scripts":{"changelog:last":"conventional-changelog -p angular -r 2","changelog:preview":"conventional-changelog -p angular -u","changelog:update":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","lint":"eslint src --ext .js,.ts","lint:fix":"yarn lint --fix","preinstall":"node ./engine-requirements.js","release":"release-it","test":"jest"},"dependencies":{"@hapi/boom":"^9.1.3","@adiwajshing/keyed-db":"^0.2.4","@cacheable/node-cache":"1.5.3","libsignal":"npm:asepxyz-signal","async-mutex":"^0.5.0","audio-decode":"^2.2.2","cache-manager":"^5.7.6","fflate":"^0.8.2","lodash":"^4.17.21","unfurl.js":"^6.4.0","lru-cache":"^11.1.0","music-metadata":"^11.12.3","pino":"^9.6","p-queue":"^9.0.0","protobufjs":"^7.5.6","qrcode-terminal":"^0.12.0","ws":"^8.13.0","axios":"^1.3.3","chalk":"^4.1.2","futoin-hkdf":"^1.5.1","libphonenumber-js":"^1.10.20","node-cache":"^5.1.2","node-fetch":"^2.6.1","uuid":"^9.0.0"},"devDependencies":{"@types/jest":"^29.5.14","@types/node":"^16.0.0","@types/ws":"^8.0.0","eslint-config":"npm:asepxyz-eslint-config","conventional-changelog-cli":"^2.2.2","eslint":"^8.0.0","jest":"^30.1.1","jimp":"^0.22.12","json":"^11.0.0","open":"^8.4.2","release-it":"^15.10.3","ts-jest":"^29.4.1","ts-node":"^10.8.1","typedoc":"^0.27.9","typedoc-plugin-markdown":"4.4.2","typescript":"^5.8.2"},"peerDependencies":{"jimp":"^0.22.12","sharp":"*"},"peerDependenciesMeta":{"jimp":{"optional":true}},"engines":{"node":">=20.0.0"},"packageManager":"yarn@1.22.19","exports":{".":{"require":"./lib/index.js","import":"./lib/index.js","default":"./lib/index.js"},"./package.json":"./package.json","./*":"./lib/*"},"_id":"@aseppxyzz12/baileys@2.1.2","_nodeVersion":"26.3.1","_npmVersion":"11.17.0","dist":{"integrity":"sha512-Blq1KoaPH6y6AiyhgiyGW2NNXQZ3qHbA+ZmAKQznYQ13rOe+BThtwtc3p8Wbt6WsfJ+VCkun0uxC4By9zWCOmw==","shasum":"a148a9741954828cc1cc230fd8d402b8ee0bd346","tarball":"https://registry.npmjs.org/@aseppxyzz12/baileys/-/baileys-2.1.2.tgz","fileCount":185,"unpackedSize":22966675,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDVdZYT6NQQI3cp2VnIREKYfqsc6AvuuD5BBM3Lex5VqAIgRRtDhUkE1QbnBPNnkNc2U6S8DzS2xYa97UTdykt3HlQ="}]},"_npmUser":{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"},"maintainers":[{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/baileys_2.1.2_1783466382695_0.1295596529780043"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-06T05:03:19.085Z","modified":"2026-07-07T23:19:42.996Z","1.1.8":"2026-07-06T05:03:19.355Z","1.1.9":"2026-07-06T05:10:16.666Z","2.1.1":"2026-07-07T06:33:09.144Z","2.1.2":"2026-07-07T23:19:42.880Z"},"author":{"name":"AsepXyz"},"license":"MIT","homepage":"https://www.npmjs.com/package/asepxyz","keywords":["whatsapp","automation","baileys","AsepXyz","bot"],"description":"A complete WhatsApp Web library — fork of Baileys with @username support, rich messages, LID/PN mapping, TikTok downloader, Turnstile bypass, and more.","maintainers":[{"name":"aseppxyzz12","email":"mydpr1234@gmail.com"}],"readme":"# <div align='center'>AsepXyz Baileys - A WebSockets library for interacting with WhatsApp Web</div>\n\n<div align=\"center\">\n\n\n**AsepXyz Baileys** is a fast, stable, and modern interactive-feature-focused WhatsApp Web API library built on WebSocket.\n\n</div>\n\n## Example\n\nDo check out & run [example.js](Example/example.js) to see an example usage of the library.\nThe script covers most common use cases.\nTo run the example script, download or clone the repo and then type the following in a terminal:\n\n```bash\ncd path/to/AsepXyz Baileys\nnode example.js\n```\n\n## Install\n\nUse the stable version:\n\n```\nnpm install AsepXyz\n```\n\nUse the edge version (no guarantee of stability, but latest fixes + features)\n\n```\nnpm install github:AsepXyz\n```\n\nThen import your code using:\n\n```js\nimport makeWASocket from 'AsepXyz'\n```\n\n# Links\n\n- [WhatsApp](https://wa.me/628138045539)\n- [Telegram](https://t.me/lepicode)\n- [Docs](https://guide.whiskeysockets.io/)\n\n## Connecting Account\n\nWhatsApp provides a multi-device API that allows Baileys to be authenticated as a second WhatsApp client by scanning a **QR code** or **Pairing Code** with WhatsApp on your phone.\n\n> [!NOTE]\n> **[Here](#example-to-start) is a simple example of event handling**\n\n> [!TIP]\n> **You can see all supported socket configs [here](https://baileys.whiskeysockets.io/types/SocketConfig.html) (Recommended)**\n\n### Starting socket with **QR-CODE**\n\n> [!TIP]\n> You can customize browser name if you connect with **QR-CODE**, with `Browser` constant, we have some browsers config, **see [here](https://baileys.whiskeysockets.io/types/BrowsersMap.html)**\n\n```js\nimport makeWASocket from 'AsepXyz'\n\nconst conn = makeWASocket({\n    // can provide additional config here\n    browser: Browsers.ubuntu('My App'),\n    printQRInTerminal: true,\n})\n```\n\nIf the connection is successful, you will see a QR code printed on your terminal screen, scan it with WhatsApp on your phone and you'll be logged in!\n\n### Starting socket with **Pairing Code**\n\n> [!IMPORTANT]\n> Pairing Code isn't Mobile API, it's a method to connect Whatsapp Web without QR-CODE, you can connect only with one device, see [here](https://faq.whatsapp.com/1324084875126592/?cms_platform=web)\n\nThe phone number can't have `+` or `()` or `-`, only numbers, you must provide country code\n\n```js\nimport makeWASocket from 'AsepXyz'\n\nconst conn = makeWASocket({\n    // can provide additional config here\n    printQRInTerminal: false, //need to be false\n})\n\nif (!conn.authState.creds.registered) {\n    const number = 'XXXXXXXXXXX'\n    const code = await conn.requestPairingCode(number) // or await conn.requestPairingCode(number, 'CODEOTPS') custom your pairing code\n    console.log(code)\n}\n```\n\n### Receive Full History\n\n1. Set `syncFullHistory` as `true`\n2. Baileys, by default, use chrome browser config\n    - If you'd like to emulate a desktop connection (and receive more message history), this browser setting to your Socket config:\n\n```js\nconst conn = makeWASocket({\n    ...otherOpts,\n    // can use Windows, Ubuntu here too\n    browser: Browsers.macOS('Desktop'),\n    syncFullHistory: true,\n})\n```\n\n## Important Notes About Socket Config\n\n### Caching Group Metadata (Recommended)\n\n- If you use baileys for groups, we recommend you to set `cachedGroupMetadata` in socket config, you need to implement a cache like this:\n\n    ```js\n    const groupCache = new NodeCache({ stdTTL: 5 * 60, useClones: false })\n\n    const conn = makeWASocket({\n        cachedGroupMetadata: async (jid) => groupCache.get(jid),\n    })\n\n    conn.ev.on('groups.update', async ([event]) => {\n        const metadata = await conn.groupMetadata(event.id)\n        groupCache.set(event.id, metadata)\n    })\n\n    conn.ev.on('group-participants.update', async (event) => {\n        const metadata = await conn.groupMetadata(event.id)\n        groupCache.set(event.id, metadata)\n    })\n    ```\n\n### Improve Retry System & Decrypt Poll Votes\n\n- If you want to improve sending message, retrying when error occurs and decrypt poll votes, you need to have a store and set `getMessage` config in socket like this:\n    ```js\n    const conn = makeWASocket({\n        getMessage: async (key) => await getMessageFromStore(key),\n    })\n    ```\n\n### Receive Notifications in Whatsapp App\n\n- If you want to receive notifications in whatsapp app, set `markOnlineOnConnect` to `false`\n    ```js\n    const conn = makeWASocket({\n        markOnlineOnConnect: false,\n    })\n    ```\n\n## Saving & Restoring Sessions\n\nYou obviously don't want to keep scanning the QR code every time you want to connect.\n\nSo, you can load the credentials to log back in:\n\n```js\nimport makeWASocket, { useMultiFileAuthState } from 'AsepXyz'\n\nconst { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')\n\n// will use the given state to connect\n// so if valid credentials are available -- it'll connect without QR\nconst conn = makeWASocket({ auth: state })\n\n// this will be called as soon as the credentials are updated\nconn.ev.on('creds.update', saveCreds)\n```\n\n> [!IMPORTANT]\n> `useMultiFileAuthState` is a utility function to help save the auth state in a single folder, this function serves as a good guide to help write auth & key states for SQL/no-SQL databases, which I would recommend in any production grade system.\n\n> [!NOTE]\n> When a message is received/sent, due to signal sessions needing updating, the auth keys (`authState.keys`) will update. Whenever that happens, you must save the updated keys (`authState.keys.set()` is called). Not doing so will prevent your messages from reaching the recipient & cause other unexpected consequences. The `useMultiFileAuthState` function automatically takes care of that, but for any other serious implementation -- you will need to be very careful with the key state management.\n\n## Handling Events\n\n- Baileys uses the EventEmitter syntax for events.\n  They're all nicely typed up, so you shouldn't have any issues with an Intellisense editor like VS Code.\n\n> [!IMPORTANT]\n> **The events are [these](https://baileys.whiskeysockets.io/types/BaileysEventMap.html)**, it's important you see all events\n\nYou can listen to these events like this:\n\n```js\nconst conn = makeWASocket()\nconn.ev.on('messages.upsert', ({ messages }) => {\n    console.log('got messages', messages)\n})\n```\n\n### Example to Start\n\n> [!NOTE]\n> This example includes basic auth storage too\n\n```js\nimport makeWASocket, { DisconnectReason, useMultiFileAuthState } from 'AsepXyz'\nimport { Boom } from '@hapi/boom'\n\nasync function connectToWhatsApp () {\n    const { state, saveCreds } = await useMultiFileAuthState('./auth_info_baileys')\n    const conn = makeWASocket({\n        // can provide additional config here\n        auth: state,\n        printQRInTerminal: true\n    })\n    conn.ev.on('connection.update', (update) => {\n        const { connection, lastDisconnect } = update\n        if(connection === 'close') {\n            const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut\n            console.log('connection closed due to ', lastDisconnect.error, ', reconnecting ', shouldReconnect)\n            // reconnect if not logged out\n            if(shouldReconnect) {\n                connectToWhatsApp()\n            }\n        } else if(connection === 'open') {\n            console.log('opened connection')\n        }\n    })\n    conn.ev.on('messages.upsert', event => {\n        for (const m of event.messages) {\n            console.log(JSON.stringify(m, undefined, 2))\n\n            console.log('replying to', m.key.remoteJid)\n            await conn.sendMessage(m.key.remoteJid!, { text: 'Hello Word' })\n        }\n    })\n\n    // to storage creds (session info) when it updates\n    conn.ev.on('creds.update', saveCreds)\n}\n// run in main file\nconnectToWhatsApp()\n```\n\n> [!IMPORTANT]\n> In `messages.upsert` it's recommended to use a loop like `for (const message of event.messages)` to handle all messages in array\n\n### Decrypt Poll Votes\n\n- By default poll votes are encrypted and handled in `messages.update`\n\n```js\nimport pino from 'pino'\nimport { makeInMemoryStore, getAggregateVotesInPollMessage } from 'AsepXyz'\n\nconst logger = pino({ timestamp: () => `,\"time\":\"${new Date().toJSON()}\"` }).child({\n    class: 'AsepXyz',\n})\nlogger.level = 'fatal'\nconst store = makeInMemoryStore({ logger })\n\nasync function getMessage(key) {\n    if (store) {\n        const msg = await store.loadMessage(key.remoteJid, key.id)\n        return msg?.message\n    }\n    return {\n        conversation: 'AsepXyz',\n    }\n}\n\nconn.ev.on('messages.update', async (chatUpdate) => {\n    for (const { key, update } of chatUpdate) {\n        if (update.pollUpdates && key.fromMe) {\n            const pollCreation = await getMessage(key)\n            if (pollCreation) {\n                const pollUpdate = await getAggregateVotesInPollMessage({\n                    message: pollCreation,\n                    pollUpdates: update.pollUpdates,\n                })\n                const toCmd = pollUpdate.filter((v) => v.voters.length !== 0)[0]?.name\n                if (toCmd == undefined) return\n                console.log(toCmd)\n            }\n        }\n    }\n})\n```\n\n### Decrypt Event Response\n\n- By default event response are encrypted and handled in `messages.update`\n\n```js\nimport { jidNormalizedUser, getAggregateResponsesInEventMessage } from 'AsepXyz'\n\nconn.ev.on('messages.update', async ([chatUpdate]) => {\n    const eventResponses = chatUpdate.update?.eventResponses\n    const agregate = getAggregateResponsesInEventMessage(\n        { eventResponses },\n        jidNormalizedUser(conn.user.lid)\n    )\n    console.log(agregate)\n})\n```\n\n### Summary of Events on First Connection\n\n1. When you connect first time, `connection.update` will be fired requesting you to restart sock\n2. Then, history messages will be received in `messaging.history-set`\n\n## Implementing a Data Store\n\n- Baileys does not come with a defacto storage for chats, contacts, or messages. However, a simple in-memory implementation has been provided. The store listens for chat updates, new messages, message updates, etc., to always have an up-to-date version of the data.\n\n> [!IMPORTANT]\n> I highly recommend building your own data store, as storing someone's entire chat history in memory is a terrible waste of RAM.\n\nIt can be used as follows:\n\n```js\nimport makeWASocket, { makeInMemoryStore } from 'AsepXyz'\n// the store maintains the data of the WA connection in memory\n// can be written out to a file & read from it\nconst store = makeInMemoryStore({})\n// can be read from a file\nstore.readFromFile('./baileys_store.json')\n// saves the state to a file every 10s\nsetInterval(() => {\n    store.writeToFile('./baileys_store.json')\n}, 10_000)\n\nconst conn = makeWASocket({})\n// will listen from this socket\n// the store can listen from a new socket once the current socket outlives its lifetime\nstore.bind(conn.ev)\n\nconn.ev.on('chats.upsert', () => {\n    // can use 'store.chats' however you want, even after the socket dies out\n    // 'chats' => a KeyedDB instance\n    console.log('got chats', store.chats.all())\n})\n\nconn.ev.on('contacts.upsert', () => {\n    console.log('got contacts', Object.values(store.contacts))\n})\n```\n\nThe store also provides some simple functions such as `loadMessages` that utilize the store to speed up data retrieval.\n\n## Whatsapp IDs Explain\n\n- `id` is the WhatsApp ID, called `jid` too, of the person or group you're sending the message to.\n    - It must be in the format `[country code][phone number]@s.whatsapp.net`\n        - Example for people: `+19999999999@s.whatsapp.net`.\n        - For groups, it must be in the format `123456789-123345@g.us`.\n    - For broadcast lists, it's `[timestamp of creation]@broadcast`.\n    - For stories, the ID is `status@broadcast`.\n\n## Utility Functions\n\n- `getContentType`, returns the content type for any message\n- `getDevice`, returns the device from message\n- `makeCacheableSignalKeyStore`, make auth store more fast\n- `downloadContentFromMessage`, download content from any message\n\n## Sending Messages\n\n- Send all types of messages with a single function\n    - **[Here](https://baileys.whiskeysockets.io/types/AnyMessageContent.html) you can see all message contents supported, like text message**\n    - **[Here](https://baileys.whiskeysockets.io/types/MiscMessageGenerationOptions.html) you can see all options supported, like quote message**\n\n    ```js\n    const jid: string\n    const content: AnyMessageContent\n    const options: MiscMessageGenerationOptions\n\n    conn.sendMessage(jid, content, options)\n    ```\n\n### Non-Media Messages\n\n#### Text Message\n\n```js\nawait conn.sendMessage(jid, { text: 'hello word' })\n```\n\n#### Quote Message (works with all types)\n\n```js\nawait conn.sendMessage(jid, { text: 'hello word' }, { quoted: message })\n```\n\n#### Mention User (works with most types)\n\n- @number is to mention in text, it's optional\n\n```js\nawait conn.sendMessage(jid, {\n    text: '@12345678901',\n    mentions: ['12345678901@s.whatsapp.net'],\n})\n```\n\n#### Forward Messages\n\n- You need to have message object, can be retrieved from [store](#implementing-a-data-store) or use a [message](https://baileys.whiskeysockets.io/types/WAMessage.html) object\n\n```js\nconst msg = getMessageFromStore() // implement this on your end\nawait conn.sendMessage(jid, { forward: msg, force: true or number }) // WA forward the message!\n```\n\n#### Location Message\n\n```js\nawait conn.sendMessage(jid, {\n    location: {\n        degreesLatitude: 24.121231,\n        degreesLongitude: 55.1121221,\n    },\n})\n```\n\n#### Live Location Message\n\n```js\nawait conn.sendMessage(jid, {\n    location: {\n        degreesLatitude: 24.121231,\n        degreesLongitude: 55.1121221,\n    },\n    live: true,\n})\n```\n\n#### Contact Message\n\n```js\nconst vcard =\n    'BEGIN:VCARD\\n' + // metadata of the contact card\n    'VERSION:3.0\\n' +\n    'FN:Jeff Singh\\n' + // full name\n    'ORG:Ashoka Uni\\n' + // the organization of the contact\n    'TELtype=CELLtype=VOICEwaid=911234567890:+91 12345 67890\\n' + // WhatsApp ID + phone number\n    'END:VCARD'\n\nawait conn.sendMessage(id, {\n    contacts: {\n        displayName: 'AsepXyz Baileys',\n        contacts: [{ vcard }],\n    },\n})\n```\n\n#### Reaction Message\n\n- You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.whiskeysockets.io/types/WAMessageKey.html) object\n\n```js\nawait conn.sendMessage(jid, {\n    react: {\n        text: '💖', // use an empty string to remove the reaction\n        key: message.key,\n    },\n})\n```\n\n#### Pin Message\n\n- You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.whiskeysockets.io/types/WAMessageKey.html) object\n\n- Time can be:\n\n| Time | Seconds   |\n| ---- | --------- |\n| 24h  | 86.400    |\n| 7d   | 604.800   |\n| 30d  | 2.592.000 |\n\n```js\nawait conn.sendMessage(jid, {\n    pin: {\n        type: 1, // 2 to remove\n        time: 86400,\n        key: Key,\n    },\n})\n```\n\n### Keep Message\n\n```js\nawait conn.sendMessage(jid, {\n    keep: {\n        key: Key,\n        type: 1, // or 2\n    },\n})\n```\n\n#### Poll Message\n\n```js\nawait conn.sendMessage(\n    jid,\n    {\n        poll: {\n            name: 'My Poll',\n            values: ['Option 1', 'Option 2', ...],\n            selectableCount: 1,\n            toAnnouncementGroup: false // or true\n        }\n    }\n)\n```\n\n#### Poll Result Message\n\n```js\nawait conn.sendMessage(jid, {\n    pollResult: {\n        name: 'Hi',\n        values: [\n            ['Option 1', 1000],\n            ['Option 2', 2000],\n        ],\n    },\n})\n```\n\n### Call Message\n\n```js\nawait conn.sendMessage(jid, {\n    call: {\n        name: 'Hay',\n        type: 1, // 2 for video\n    },\n})\n```\n\n### Event Message\n\n```js\nawait conn.sendMessage(jid, {\n    event: {\n        isCanceled: false, // or true\n        name: 'holiday together!',\n        description: 'who wants to come along?',\n        location: {\n            degreesLatitude: 24.121231,\n            degreesLongitude: 55.1121221,\n            name: 'name',\n        },\n        call: 'audio', // or 'video'\n        startTime: number,\n        endTime: number,\n        extraGuestsAllowed: true, // or false\n    },\n})\n```\n\n### Order Message\n\n```js\nawait conn.sendMessage(\n    jid,\n    {\n        order: {\n            orderId: '574xxx',\n            thumbnail: 'your_thumbnail',\n            itemCount: 'your_count',\n            status: 'your_status', // INQUIRY || ACCEPTED || DECLINED\n            surface: 'CATALOG',\n            message: 'your_caption',\n            orderTitle: \"your_title\",\n            sellerJid: 'your_jid'',\n            token: 'your_token',\n            totalAmount1000: 'your_amount',\n            totalCurrencyCode: 'IDR'\n        }\n    }\n)\n```\n\n### Product Message\n\n```js\nawait conn.sendMessage(jid, {\n    product: {\n        productImage: {\n            // for using buffer >> productImage: your_buffer\n            url: your_url,\n        },\n        productId: 'your_id',\n        title: 'your_title',\n        description: 'your_description',\n        currencyCode: 'IDR',\n        priceAmount1000: 'your_amount',\n        retailerId: 'your_reid', // optional use if needed\n        url: 'your_url', // optional use if needed\n        productImageCount: 'your_imageCount',\n        firstImageId: 'your_image', // optional use if needed\n        salePriceAmount1000: 'your_priceSale',\n        signedUrl: 'your_url', // optional use if needed\n    },\n    businessOwnerJid: 'your_jid',\n})\n```\n\n### Payment Message\n\n```js\nawait conn.sendMessage(jid, {\n    payment: {\n        note: 'Hi!',\n        currency: 'IDR', // optional\n        offset: 0, // optional\n        amount: '10000', // optional\n        expiry: 0, // optional\n        from: '628xxxx@s.whatsapp.net', // optional\n        image: {\n            // optional\n            placeholderArgb: 'your_background', // optional\n            textArgb: 'your_text', // optional\n            subtextArgb: 'your_subtext', // optional\n        },\n    },\n})\n```\n\n#### Payment Invite Message\n\n```js\nawait conn.sendMessage(id, {\n    paymentInvite: {\n        type: number, // 1 || 2 || 3\n        expiry: 0,\n    },\n})\n```\n\n### Admin Invite Message\n\n```js\nawait conn.sendMessage(jid, {\n    adminInvite: {\n        jid: '123xxx@newsletter',\n        name: 'newsletter_name',\n        caption: 'Please be my channel admin',\n        expiration: 86400,\n        jpegThumbnail: Buffer, // optional\n    },\n})\n```\n\n### Group Invite Message\n\n```js\nawait conn.sendMessage(jid, {\n    groupInvite: {\n        jid: '123xxx@g.us',\n        name: 'group_name',\n        caption: 'Please Join My Whatsapp Group',\n        code: 'code_invite',\n        expiration: 86400,\n        jpegThumbnail: Buffer, // optional\n    },\n})\n```\n\n### Sticker Pack Message\n\n```js\n// I don't know why the sticker doesn't appear\nawait conn.sendMessage(jid, {\n    stickerPack: {\n        name: 'Hiii',\n        publisher: 'AsepXyz Baileys',\n        description: 'Hello',\n        cover: Buffer, // Image buffer\n        stickers: [\n            {\n                sticker: { url: 'https://example.com/1234kjd.webp' },\n                emojis: ['❤'], // optional\n                accessibilityLabel: '', // optional\n                isLottie: Boolean, // optional\n                isAnimated: Boolean, // optional\n            },\n            {\n                sticker: Buffer,\n                emojis: ['❤'], // optional\n                accessibilityLabel: '', // optional\n                isLottie: Boolean, // optional\n                isAnimated: Boolean, // optional\n            },\n        ],\n    },\n})\n```\n\n### Share Phone Number Message\n\n```js\nawait conn.sendMessage(jid, {\n    sharePhoneNumber: {},\n})\n```\n\n### Request Phone Number Message\n\n```js\nawait conn.sendMessage(jid, {\n    requestPhoneNumber: {},\n})\n```\n\n### Buttons Reply Message\n\n```js\n// List\nawait conn.sendMessage(\n    jid,\n    {\n        buttonReply: {\n            name: 'Hii',\n            description: 'description',\n            rowId: 'ID'\n       },\n       type: 'list'\n    }\n)\n// Plain\nawait conn.sendMessage(\n    jid,\n    {\n        buttonReply: {\n            displayText: 'Hii',\n            id: 'ID'\n       },\n       type: 'plain'\n    }\n)\n\n// Template\nawait conn.sendMessage(\n    jid,\n    {\n        buttonReply: {\n            displayText: 'Hii',\n            id: 'ID',\n            index: 'number'\n       },\n       type: 'template'\n    }\n)\n\n// Interactive\nawait conn.sendMessage(\n    jid,\n    {\n        buttonReply: {\n            body: 'Hii',\n            nativeFlows: {\n                name: 'menu_options',\n                paramsJson: JSON.stringify({ id: 'ID', description: 'description' })\n                version: 1 // 2 | 3\n            }\n       },\n       type: 'interactive'\n    }\n)\n```\n\n### Buttons Message\n\n```js\nawait conn.sendMessage(jid, {\n    text: 'This is a button message!', // image: buffer or // image: { url: url } If you want to use images\n    caption: 'caption', // Use this if you are using an image or video\n    footer: 'Hello World!',\n    buttons: [\n        {\n            buttonId: 'Id1',\n            buttonText: {\n                displayText: 'Button 1',\n            },\n        },\n        {\n            buttonId: 'Id2',\n            buttonText: {\n                displayText: 'Button 2',\n            },\n        },\n        {\n            buttonId: 'Id3',\n            buttonText: {\n                displayText: 'Button 3',\n            },\n        },\n    ],\n})\n```\n\n### Buttons List Message\n\n```js\n// Just working in a private chat\nawait conn.sendMessage(jid, {\n    text: 'This is a list!',\n    footer: 'Hello World!',\n    title: 'Amazing boldfaced list title',\n    buttonText: 'Required, text on the button to view the list',\n    sections: [\n        {\n            title: 'Section 1',\n            rows: [\n                {\n                    title: 'Option 1',\n                    rowId: 'option1',\n                },\n                {\n                    title: 'Option 2',\n                    rowId: 'option2',\n                    description: 'This is a description',\n                },\n            ],\n        },\n        {\n            title: 'Section 2',\n            rows: [\n                {\n                    title: 'Option 3',\n                    rowId: 'option3',\n                },\n                {\n                    title: 'Option 4',\n                    rowId: 'option4',\n                    description: 'This is a description V2',\n                },\n            ],\n        },\n    ],\n})\n```\n\n### Buttons Product List Message\n\n```js\n// Just working in a private chat\nawait conn.sendMessage(jid, {\n    text: 'This is a list!',\n    footer: 'Hello World!',\n    title: 'Amazing boldfaced list title',\n    buttonText: 'Required, text on the button to view the list',\n    productList: [\n        {\n            title: 'This is a title',\n            products: [\n                {\n                    productId: '1234',\n                },\n                {\n                    productId: '5678',\n                },\n            ],\n        },\n    ],\n    businessOwnerJid: '628xxx@s.whatsapp.net',\n    thumbnail: 'https://example.com/jdbenkksjs.jpg', // or buffer\n})\n```\n\n### Buttons Cards Message\n\n```js\nawait conn.sendMessage(jid, {\n    text: 'Body Message',\n    title: 'Title Message',\n    subtile: 'Subtitle Message',\n    footer: 'Footer Message',\n    cards: [\n        {\n            image: { url: 'https://example.com/jdbenkksjs.jpg' }, // or buffer\n            title: 'Title Cards',\n            body: 'Body Cards',\n            footer: 'Footer Cards',\n            buttons: [\n                {\n                    name: 'quick_reply',\n                    buttonParamsJson: JSON.stringify({\n                        display_text: 'Display Button',\n                        id: 'ID',\n                    }),\n                },\n                {\n                    name: 'cta_url',\n                    buttonParamsJson: JSON.stringify({\n                        display_text: 'Display Button',\n                        url: 'https://www.example.com',\n                    }),\n                },\n            ],\n        },\n        {\n            video: { url: 'https://example.com/jdbenkksjs.mp4' }, // or buffer\n            title: 'Title Cards',\n            body: 'Body Cards',\n            footer: 'Footer Cards',\n            buttons: [\n                {\n                    name: 'quick_reply',\n                    buttonParamsJson: JSON.stringify({\n                        display_text: 'Display Button',\n                        id: 'ID',\n                    }),\n                },\n                {\n                    name: 'cta_url',\n                    buttonParamsJson: JSON.stringify({\n                        display_text: 'Display Button',\n                        url: 'https://www.example.com',\n                    }),\n                },\n            ],\n        },\n    ],\n})\n```\n\n### Buttons Template Message\n\n```js\n// This no longer works\nawait conn.sendMessage(jid, {\n    text: 'This is a template message!',\n    footer: 'Hello World!',\n    templateButtons: [\n        {\n            index: 1,\n            urlButton: {\n                displayText: 'Follow Me',\n                url: 'https://whatsapp.com/channel/0029Vb7JPWCAInPfKWC14s2V,\n            },\n        },\n        {\n            index: 2,\n            callButton: {\n                displayText: 'Call Me!',\n                phoneNumber: '628xxx',\n            },\n        },\n        {\n            index: 3,\n            quickReplyButton: {\n                displayText: 'This is a reply, just like normal buttons!',\n                id: 'id-like-buttons-message',\n            },\n        },\n    ],\n})\n```\n\n### Buttons Interactive Message\n\n```js\nawait conn.sendMessage(jid, {\n    text: 'This is an Interactive message!',\n    title: 'Hiii',\n    subtitle: 'There is a subtitle',\n    footer: 'Hello World!',\n    interactiveButtons: [\n        {\n            name: 'quick_reply',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'Click Me!',\n                id: 'your_id',\n            }),\n        },\n        {\n            name: 'cta_url',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'Follow Me',\n                url: 'https://whatsapp.com/channel/0029Vb7JPWCAInPfKWC14s2V,\n                merchant_url: 'https://whatsapp.com/channel/0029Vb7JPWCAInPfKWC14s2V,\n            }),\n        },\n        {\n            name: 'cta_copy',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'Click Me!',\n                copy_code: 'https://whatsapp.com/channel/0029Vb7JPWCAInPfKWC14s2V,\n            }),\n        },\n        {\n            name: 'cta_call',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'Call Me!',\n                phone_number: '628xxx',\n            }),\n        },\n        {\n            name: 'cta_catalog',\n            buttonParamsJson: JSON.stringify({\n                business_phone_number: '628xxx',\n            }),\n        },\n        {\n            name: 'cta_reminder',\n            buttonParamsJson: JSON.stringify({\n                display_text: '...',\n            }),\n        },\n        {\n            name: 'cta_cancel_reminder',\n            buttonParamsJson: JSON.stringify({\n                display_text: '...',\n            }),\n        },\n        {\n            name: 'address_message',\n            buttonParamsJson: JSON.stringify({\n                display_text: '...',\n            }),\n        },\n        {\n            name: 'send_location',\n            buttonParamsJson: JSON.stringify({\n                display_text: '...',\n            }),\n        },\n        {\n            name: 'open_webview',\n            buttonParamsJson: JSON.stringify({\n                title: 'Follow Me!',\n                link: {\n                    in_app_webview: true, // or false\n                    url: 'https://whatsapp.com/channel/0029Vb7JPWCAInPfKWC14s2V,\n                },\n            }),\n        },\n        {\n            name: 'mpm',\n            buttonParamsJson: JSON.stringify({\n                product_id: '8816262248471474',\n            }),\n        },\n        {\n            name: 'wa_payment_transaction_details',\n            buttonParamsJson: JSON.stringify({\n                transaction_id: '12345848',\n            }),\n        },\n        {\n            name: 'automated_greeting_message_view_catalog',\n            buttonParamsJson: JSON.stringify({\n                business_phone_number: '628xxx',\n                catalog_product_id: '12345',\n            }),\n        },\n        {\n            name: 'galaxy_message',\n            buttonParamsJson: JSON.stringify({\n                mode: 'published',\n                flow_message_version: '3',\n                flow_token: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',\n                flow_id: '1307913409923914',\n                flow_cta: 'AsepXyz Baileys',\n                flow_action: 'navigate',\n                flow_action_payload: {\n                    screen: 'QUESTION_ONE',\n                    params: {\n                        user_id: '123456789',\n                        referral: 'campaign_xyz',\n                    },\n                },\n                flow_metadata: {\n                    flow_json_version: '201',\n                    data_api_protocol: 'v2',\n                    flow_name: 'Lead Qualification [en]',\n                    data_api_version: 'v2',\n                    categories: ['Lead Generation', 'Sales'],\n                },\n            }),\n        },\n        {\n            name: 'single_select',\n            buttonParamsJson: JSON.stringify({\n                title: 'Click Me!',\n                sections: [\n                    {\n                        title: 'Title 1',\n                        highlight_label: 'Highlight label 1',\n                        rows: [\n                            {\n                                header: 'Header 1',\n                                title: 'Title 1',\n                                description: 'Description 1',\n                                id: 'Id 1',\n                            },\n                            {\n                                header: 'Header 2',\n                                title: 'Title 2',\n                                description: 'Description 2',\n                                id: 'Id 2',\n                            },\n                        ],\n                    },\n                ],\n            }),\n        },\n    ],\n})\n\n// If you want to use an image\nawait conn.sendMessage(jid, {\n    image: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    interactiveButtons: [\n        {\n            name: 'quick_reply',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'DisplayText',\n                id: 'ID1',\n            }),\n        },\n    ],\n    hasMediaAttachment: false, // or true\n})\n\n// If you want to use an video\nawait conn.sendMessage(jid, {\n    video: {\n        url: 'https://example.com/jdbenkksjs.mp4',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    interactiveButtons: [\n        {\n            name: 'quick_reply',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'DisplayText',\n                id: 'ID1',\n            }),\n        },\n    ],\n    hasMediaAttachment: false, // or true\n})\n\n// If you want to use an document\nawait conn.sendMessage(jid, {\n    document: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    mimetype: 'image/jpeg',\n    jpegThumbnail: await conn.resize('https://example.com/jdbenkksjs.jpg', 320, 320),\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    interactiveButtons: [\n        {\n            name: 'quick_reply',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'DisplayText',\n                id: 'ID1',\n            }),\n        },\n    ],\n    hasMediaAttachment: false, // or true\n})\n\n// If you want to use an location\nawait conn.sendMessage(jid, {\n    location: {\n        degressLatitude: -0,\n        degressLongitude: 0,\n        name: 'Hi',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    interactiveButtons: [\n        {\n            name: 'quick_reply',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'DisplayText',\n                id: 'ID1',\n            }),\n        },\n    ],\n    hasMediaAttachment: false, // or true\n})\n\n// if you want to use an product\nawait conn.sendMessage(jid, {\n    product: {\n        productImage: {\n            url: 'https://example.com/jdbenkksjs.jpg',\n        },\n        productId: '836xxx',\n        title: 'Title',\n        description: 'Description',\n        currencyCode: 'IDR',\n        priceAmount1000: '283xxx',\n        retailerId: 'AsepXyz Baileys',\n        url: 'https://example.com',\n        productImageCount: 1,\n    },\n    businessOwnerJid: '628xxx@s.whatsapp.net',\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    interactiveButtons: [\n        {\n            name: 'quick_reply',\n            buttonParamsJson: JSON.stringify({\n                display_text: 'DisplayText',\n                id: 'ID1',\n            }),\n        },\n    ],\n    hasMediaAttachment: false, // or true\n})\n```\n\n### Buttons Interactive Message PIX\n\n```js\nawait conn.sendMessage(jid, {\n    text: '', // This string is required. Even it's empty.\n    interactiveButtons: [\n        {\n            name: 'payment_info',\n            buttonParamsJson: JSON.stringify({\n                payment_settings: [\n                    {\n                        type: 'pix_static_code',\n                        pix_static_code: {\n                            merchant_name: 'AsepXyz Baileys',\n                            key: 'example@AsepXyz Baileys.com',\n                            key_type: 'EMAIL', // PHONE || EMAIL || CPF || EVP\n                        },\n                    },\n                ],\n            }),\n        },\n    ],\n})\n```\n\n### Buttons Interactive Message PAY\n\n```js\nawait conn.sendMessage(jid, {\n    text: '', // This string is required. Even it's empty.\n    interactiveButtons: [\n        {\n            name: 'review_and_pay',\n            buttonParamsJson: JSON.stringify({\n                currency: 'IDR',\n                payment_configuration: '',\n                payment_type: '',\n                total_amount: {\n                    value: '999999999',\n                    offset: '100',\n                },\n                reference_id: '45XXXXX',\n                type: 'physical-goods',\n                payment_method: 'confirm',\n                payment_status: 'captured',\n                payment_timestamp: Math.floor(Date.now() / 1000),\n                order: {\n                    status: 'completed',\n                    description: '',\n                    subtotal: {\n                        value: '0',\n                        offset: '100',\n                    },\n                    order_type: 'PAYMENT_REQUEST',\n                    items: [\n                        {\n                            retailer_id: 'your_retailer_id',\n                            name: 'AsepXyz Baileys',\n                            amount: {\n                                value: '999999999',\n                                offset: '100',\n                            },\n                            quantity: '1',\n                        },\n                    ],\n                },\n                additional_note: 'AsepXyz Baileys',\n                native_payment_methods: [],\n                share_payment_status: false,\n            }),\n        },\n    ],\n})\n```\n\n### Status Mentions Message\n\n```js\nconst jidat = [\n    '123451679@g.us',\n    '124848899@g.us',\n    '111384848@g.us',\n    '62689xxxx@s.whatsapp.net',\n    '62xxxxxxx@s.whatsapp.net'\n]\n// Text\nawait conn.sendStatusMentions(\n    {\n      text: 'Hello Everyone :3',\n      font: 2, // optional\n      textColor: 'FF0000', // optional\n      backgroundColor: '#000000' // optional\n    },\n    jids // Limit to 5 mentions per status\n)\n\n// Image\nawait conn.sendStatusMentions(\n    {\n      Image: { url: 'https://example.com/ruriooe.jpg' }, or image buffer\n      caption: 'Hello Everyone :3' // optional\n    },\n    jids // Limit to 5 mentions per status\n)\n\n// Video\nawait conn.sendStatusMentions(\n    {\n      video: { url: 'https://example.com/ruriooe.mp4' }, or video buffer\n      caption: 'Hello Everyone :3' // optional\n    },\n    jids // Limit to 5 mentions per status\n)\n\n// Audio\nawait conn.sendStatusMentions(\n    {\n      audio: { url: 'https://example.com/ruriooe.mp3' }, or audio buffer\n      backgroundColor: '#000000', // optional\n      mimetype: 'audio/mp4',\n      ppt: true\n    },\n    jids // Limit to 5 mentions per status\n)\n```\n\n### Shop Message\n\n```js\nawait conn.sendMessage(jid, {\n    text: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    shop: {\n        surface: 1, // 2 | 3 | 4\n        id: 'https://example.com',\n    },\n    viewOnce: true,\n})\n\n// Image\nawait conn.sendMessage(jid, {\n    image: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    shop: {\n        surface: 1, // 2 | 3 | 4\n        id: 'https://example.com',\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n\n// Video\nawait conn.sendMessage(jid, {\n    video: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    shop: {\n        surface: 1, // 2 | 3 | 4\n        id: 'https://example.com',\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n\n// Document\nawait conn.sendMessage(jid, {\n    document: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    mimetype: 'image/jpeg',\n    jpegThumbnail: await conn.resize('https://example.com/jdbenkksjs.jpg', 320, 320),\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    shop: {\n        surface: 1, // 2 | 3 | 4\n        id: 'https://example.com',\n    },\n    hasMediaAttachment: false, // or true,\n    viewOnce: true,\n})\n\n// Location\nawait conn.sendMessage(jid, {\n    location: {\n        degressLatitude: -0,\n        degressLongitude: 0,\n        name: 'Hi',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    shop: {\n        surface: 1, // 2 | 3 | 4\n        id: 'https://example.com',\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n\n// Product\nawait conn.sendMessage(jid, {\n    product: {\n        productImage: {\n            url: 'https://example.com/jdbenkksjs.jpg',\n        },\n        productId: '836xxx',\n        title: 'Title',\n        description: 'Description',\n        currencyCode: 'IDR',\n        priceAmount1000: '283xxx',\n        retailerId: 'AsepXyz Baileys',\n        url: 'https://example.com',\n        productImageCount: 1,\n    },\n    businessOwnerJid: '628xxx@s.whatsapp.net',\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    shop: {\n        surface: 1, // 2 | 3 | 4\n        id: 'https://example.com',\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n```\n\n### Collection Message\n\n```js\nawait conn.sendMessage(jid, {\n    text: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    collection: {\n        bizJid: 'jid',\n        id: 'https://example.com',\n        version: 1,\n    },\n    viewOnce: true,\n})\n\n// Image\nawait conn.sendMessage(jid, {\n    image: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    collection: {\n        bizJid: 'jid',\n        id: 'https://example.com',\n        version: 1,\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n\n// Video\nawait conn.sendMessage(jid, {\n    video: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    collection: {\n        bizJid: 'jid',\n        id: 'https://example.com',\n        version: 1,\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n\n// Document\nawait conn.sendMessage(jid, {\n    document: {\n        url: 'https://example.com/jdbenkksjs.jpg',\n    },\n    mimetype: 'image/jpeg',\n    jpegThumbnail: await conn.resize('https://example.com/jdbenkksjs.jpg', 320, 320),\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    collection: {\n        bizJid: 'jid',\n        id: 'https://example.com',\n        version: 1,\n    },\n    hasMediaAttachment: false, // or true,\n    viewOnce: true,\n})\n\n// Location\nawait conn.sendMessage(jid, {\n    location: {\n        degressLatitude: -0,\n        degressLongitude: 0,\n        name: 'Hi',\n    },\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    collection: {\n        bizJid: 'jid',\n        id: 'https://example.com',\n        version: 1,\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n\n// Product\nawait conn.sendMessage(jid, {\n    product: {\n        productImage: {\n            url: 'https://example.com/jdbenkksjs.jpg',\n        },\n        productId: '836xxx',\n        title: 'Title',\n        description: 'Description',\n        currencyCode: 'IDR',\n        priceAmount1000: '283xxx',\n        retailerId: 'AsepXyz Baileys',\n        url: 'https://example.com',\n        productImageCount: 1,\n    },\n    businessOwnerJid: '628xxx@s.whatsapp.net',\n    caption: 'Body',\n    title: 'Title',\n    subtitle: 'Subtitle',\n    footer: 'Footer',\n    collection: {\n        bizJid: 'jid',\n        id: 'https://example.com',\n        version: 1,\n    },\n    hasMediaAttachment: false, // or true\n    viewOnce: true,\n})\n```\n\n---\n\n# Rich Message\n\nRich Message adalah fitur UI premium pada AsepXyz Baileys yang mendukung markdown, code block, table, images, video, product card, social post, reels, sources, suggestions, dan tip dalam satu pesan.\n\n## Full Example\n\n```js\nconn.sendMessage(m.chat, {\n  richMessage: {\n    title: 'AsepXyz AI',\n    text: '# AsepXyz AI\\nHalo Website dan sumber ',\n\n    code: {\n      language: 'javascript',\n      code: `const levvi = \"AsepXyz\";\nconsole.log(\\`Hello \\${levvi}!\\`);`\n    },\n\n    table: [\n      ['Nama', 'Role'],\n      ['AsepXyz', 'Developer']\n    ],\n\n    images: [\n      'https://example.com/image.jpg'\n    ],\n\n    video: 'https://example.com/video.mp4',\n\n    product: {\n      title: 'Jasa Bot',\n      brand: 'AsepXyz',\n      price: '50k',\n      sale_price: '35k',\n      product_url: 'https://www.asepxyz.cloud/',\n      image: {\n        url: 'https://example.com/product.jpg'\n      },\n      additional_images: [\n        {\n          url: 'https://example.com/product-2.jpg'\n        }\n      ]\n    },\n\n    post: {\n      title: 'Update',\n      subtitle: 'v2.0',\n      username: 'asepxyz',\n      profile_picture_url: 'https://example.com/profile.jpg',\n      is_verified: true,\n      thumbnail_url: 'https://example.com/thumbnail.jpg',\n      post_caption: 'Update besar!',\n      likes_count: 1,\n      comments_count: 0,\n      shares_count: 0,\n      post_url: 'https://www.asepxyz.cloud/',\n      post_deeplink: 'asepxyz://',\n      source_app: 'INSTAGRAM',\n      footer_label: 'Baru',\n      footer_icon: 'https://example.com/footer.jpg',\n      is_carousel: false,\n      orientation: 'LANDSCAPE',\n      post_type: 'IMAGE'\n    },\n\n    reels: [\n      {\n        title: 'AsepXyz',\n        profileIconUrl: 'https://example.com/reel-profile-1.jpg',\n        thumbnailUrl: 'https://example.com/reel-thumb-1.jpg',\n        videoUrl: 'https://example.com/reel-1.mp4',\n        reels_title: 'Demo 1',\n        likes_count: 12,\n        shares_count: 5,\n        view_count: 99,\n        reel_source: 'IG',\n        is_verified: true\n      }\n    ],\n\n    sources: [\n      [\n        'https://example.com/github.ico',\n        'https://github.com/AsepXyz',\n        'GitHub'\n      ]\n    ],\n\n    tip: '💡 Tips: Gunakan kode LEVVI untuk diskon!',\n\n    suggestions: [\n      'Coba fitur baru',\n      'Hubungi admin',\n      'Lihat produk'\n    ],\n\n    footer: '© 2025 AsepXyz. All rights reserved.'\n  }\n}, { quoted: m })\n```\n\n---\n\n# Order Status Message\n\nMengirim kartu status pesanan dengan tampilan native WhatsApp.\n\n## Example\n\n```js\nconn.sendMessage(m.chat, {\n  orderStatus: {\n    image: 'src/img/menu.jpg',\n    title: 'AsepXyz Shop',\n    text: 'Silakan cek status pesanan Anda.',\n    footer: 'Powered by AsepXyz',\n    referenceId: 'LV-001',\n    status: 'PROCESSING',\n    subtotalValue: 10000,\n    subtotalOffset: 100,\n    taxValue: 0,\n    taxOffset: 100,\n    currency: 'IDR'\n  }\n}, { quoted: m })\n```\n\n\n\n### AI Icon Feature\n\n```js\nawait conn.sendMessage(\n    jid,\n    {\n        text: 'Hi',\n    },\n    {\n        ai: true, // Add ai usage and change it to true\n    }\n)\n\n// If using relay\nawait conn.relayMessage(\n    jid,\n    {\n        extendedTextMessage: {\n            text: 'Hi',\n        },\n    },\n    {\n        AI: true, // Use capital letters\n    }\n)\n```\n\n### Sending Messages with Link Previews\n\n1. By default, wa does not have link generation when sent from the web\n2. Baileys has a function to generate the content for these link previews\n3. To enable this function's usage, add `unfurl.js` as a dependency to your project with `yarn add unfurl.js`\n4. Send a link:\n\n```js\nawait conn.sendMessage(jid, {\n    text: 'Hi, this was sent using https://github.com/whiskeysockets/baileys',\n})\n```\n\n### Media Messages\n\nSending media (video, stickers, images) is easier & more efficient than ever.\n\n> [!NOTE]\n> In media messages, you can pass `{ stream: Stream }` or `{ url: Url }` or `Buffer` directly, you can see more [here](https://baileys.whiskeysockets.io/types/WAMediaUpload.html)\n\n- When specifying a media url, Baileys never loads the entire buffer into memory it even encrypts the media as a readable stream.\n\n> [!TIP]\n> It's recommended to use Stream or Url to save memory\n\n#### Gif Message\n\n- Whatsapp doesn't support `.gif` files, that's why we send gifs as common `.mp4` video with `gifPlayback` flag\n\n```js\nawait conn.sendMessage(jid, {\n    video: fs.readFileSync('Media/ma_gif.mp4'),\n    caption: 'hello word',\n    gifPlayback: true,\n})\n```\n\n#### Video Message\n\n```js\nawait conn.sendMessage(id, {\n    video: {\n        url: './Media/ma_gif.mp4',\n    },\n    caption: 'hello word',\n})\n```\n\n#### Video Ptv Message\n\n```js\nawait conn.sendMessage(id, {\n    video: {\n        url: './Media/ma_gif.mp4',\n    },\n    ptv: true,\n})\n```\n\n#### Audio Message\n\n- To audio message work in all devices you need to convert with some tool like `ffmpeg` with this flags:\n    ```bash\n        codec: libopus //ogg file\n        ac: 1 //one channel\n        avoid_negative_ts\n        make_zero\n    ```\n\n    - Example:\n    ```bash\n    ffmpeg -i input.mp4 -avoid_negative_ts make_zero -ac 1 output.ogg\n    ```\n\n```js\nawait conn.sendMessage(jid, {\n    audio: {\n        url: './Media/audio.mp3',\n    },\n    mimetype: 'audio/mp4',\n})\n```\n\n#### Image Message\n\n```js\nawait conn.sendMessage(id, {\n    image: {\n        url: './Media/ma_img.png',\n    },\n    caption: 'hello word',\n})\n```\n\n### Album Message\n\n```js\nawait conn.sendMessage(\n    id,\n    {\n        album: [{\n        \timage: {\n        \t\turl: 'https://example.com/AsepXyz.jpg'\n        \t},\n        \tcaption: 'Hay'\n        }, {\n        \timage: Buffer,\n        \tcaption: 'Hay'\n        }, {\n        \tvideo: {\n        \t\turl: 'https://example.com/AsepXyz.mp4'\n        \t},\n        \tcaption: 'Hay'\n        }, {\n        \tvideo: Buffer,\n        \tcaption: 'Hay'\n        }\n    }\n)\n```\n\n#### View Once Message\n\n- You can send all messages above as `viewOnce`, you only need to pass `viewOnce: true` in content object\n\n```js\nawait conn.sendMessage(id, {\n    image: {\n        url: './Media/ma_img.png',\n    },\n    viewOnce: true, //works with video, audio too\n    caption: 'hello word',\n})\n```\n\n## Modify Messages\n\n### Deleting Messages (for everyone)\n\n```js\nconst msg = await conn.sendMessage(jid, { text: 'hello word' })\nawait conn.sendMessage(jid, { delete: msg.key })\n```\n\n**Note:** deleting for oneself is supported via `chatModify`, see in [this section](#modifying-chats)\n\n### Editing Messages\n\n- You can pass all editable contents here\n\n```js\nawait conn.sendMessage(jid, {\n    text: 'updated text goes here',\n    edit: response.key,\n})\n```\n\n## Manipulating Media Messages\n\n### Thumbnail in Media Messages\n\n- For media messages, the thumbnail can be generated automatically for images & stickers provided you add `jimp` or `sharp` as a dependency in your project using `yarn add jimp` or `yarn add sharp`.\n- Thumbnails for videos can also be generated automatically, though, you need to have `ffmpeg` installed on your system.\n\n### Downloading Media Messages\n\nIf you want to save the media you received\n\n```js\nimport { createWriteStream } from 'fs'\nimport { downloadMediaMessage, getContentType } from 'AsepXyz'\n\nconn.ev.on('messages.upsert', async ({ [m] }) => {\n    if (!m.message) return // if there is no text or media message\n    const messageType = getContentType(m) // get what type of message it is (text, image, video...)\n\n    // if the message is an image\n    if (messageType === 'imageMessage') {\n        // download the message\n        const stream = await downloadMediaMessage(\n            m,\n            'stream', // can be 'buffer' too\n            { },\n            {\n                logger,\n                // pass this so that baileys can request a reupload of media\n                // that has been deleted\n                reuploadRequest: conn.updateMediaMessage\n            }\n        )\n        // save to file\n        const writeStream = createWriteStream('./my-download.jpeg')\n        stream.pipe(writeStream)\n    }\n}\n```\n\n### Re-upload Media Message to Whatsapp\n\n- WhatsApp automatically removes old media from their servers. For the device to access said media -- a re-upload is required by another device that has it. This can be accomplished using:\n\n```js\nawait conn.updateMediaMessage(msg)\n```\n\n## Reject Call\n\n- You can obtain `callId` and `callFrom` from `call` event\n\n```js\nawait conn.rejectCall(callId, callFrom)\n```\n\n## Send States in Chat\n\n### Reading Messages\n\n- A set of message [keys](https://baileys.whiskeysockets.io/types/WAMessageKey.html) must be explicitly marked read now.\n- You cannot mark an entire 'chat' read as it were with Baileys Web.\n  This means you have to keep track of unread messages.\n\n```js\nconst key: WAMessageKey\n// can pass multiple keys to read multiple messages as well\nawait conn.readMessages([key])\n```\n\nThe message ID is the unique identifier of the message that you are marking as read.\nOn a `WAMessage`, the `messageID` can be accessed using `messageID = message.key.id`.\n\n### Update Presence\n\n- `presence` can be one of [these](https://baileys.whiskeysockets.io/types/WAPresence.html)\n- The presence expires after about 10 seconds.\n- This lets the person/group with `jid` know whether you're online, offline, typing etc.\n\n```js\nawait conn.sendPresenceUpdate('available', jid)\n```\n\n> [!NOTE]\n> If a desktop client is active, WA doesn't send push notifications to the device. If you would like to receive said notifications -- mark your Baileys client offline using `conn.sendPresenceUpdate('unavailable')`\n\n## Modifying Chats\n\nWA uses an encrypted form of communication to send chat/app updates. This has been implemented mostly and you can send the following updates:\n\n> [!IMPORTANT]\n> If you mess up one of your updates, WA can log you out of all your devices and you'll have to log in again.\n\n### Archive a Chat\n\n```js\nconst lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end\nawait conn.chatModify({ archive: true, lastMessages: [lastMsgInChat] }, jid)\n```\n\n### Mute/Unmute a Chat\n\n- Supported times:\n\n| Time   | Miliseconds |\n| ------ | ----------- |\n| Remove | null        |\n| 8h     | 86.400.000  |\n| 7d     | 604.800.000 |\n\n```js\n// mute for 8 hours\nawait conn.chatModify({ mute: 8 * 60 * 60 * 1000 }, jid)\n// unmute\nawait conn.chatModify({ mute: null }, jid)\n```\n\n### Mark a Chat Read/Unread\n\n```js\nconst lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end\n// mark it unread\nawait conn.chatModify({ markRead: false, lastMessages: [lastMsgInChat] }, jid)\n```\n\n### Delete a Message for Me\n\n```js\nawait conn.chatModify(\n    {\n        clear: {\n            messages: [\n                {\n                    id: 'ATWYHDNNWU81732J',\n                    fromMe: true,\n                    timestamp: '1654823909',\n                },\n            ],\n        },\n    },\n    jid\n)\n```\n\n### Delete a Chat\n\n```js\nconst lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end\nawait conn.chatModify(\n    {\n        delete: true,\n        lastMessages: [\n            {\n                key: lastMsgInChat.key,\n                messageTimestamp: lastMsgInChat.messageTimestamp,\n            },\n        ],\n    },\n    jid\n)\n```\n\n### Pin/Unpin a Chat\n\n```js\nawait conn.chatModify(\n    {\n        pin: true, // or `false` to unpin\n    },\n    jid\n)\n```\n\n### Star/Unstar a Message\n\n```js\nawait conn.chatModify(\n    {\n        star: {\n            messages: [\n                {\n                    id: 'messageID',\n                    fromMe: true, // or `false`\n                },\n            ],\n            star: true, // - true: Star Message false: Unstar Message\n        },\n    },\n    jid\n)\n```\n\n### Disappearing Messages\n\n- Ephemeral can be:\n\n| Time   | Seconds   |\n| ------ | --------- |\n| Remove | 0         |\n| 24h    | 86.400    |\n| 7d     | 604.800   |\n| 90d    | 7.776.000 |\n\n- You need to pass in **Seconds**, default is 7 days\n\n```js\n// turn on disappearing messages\nawait conn.sendMessage(\n    jid,\n    // this is 1 week in seconds -- how long you want messages to appear for\n    { disappearingMessagesInChat: WA_DEFAULT_EPHEMERAL }\n)\n\n// will send as a disappearing message\nawait conn.sendMessage(jid, { text: 'hello' }, { ephemeralExpiration: WA_DEFAULT_EPHEMERAL })\n\n// turn off disappearing messages\nawait conn.sendMessage(jid, { disappearingMessagesInChat: false })\n```\n\n### Clear Messages\n\n```js\nawait conn.clearMessage(jid, key, timestamps)\n```\n\n## User Querys\n\n### Check If ID Exists in Whatsapp\n\n```js\nconst [result] = await conn.onWhatsApp(jid)\nif (result.exists) console.log(`${jid} exists on WhatsApp, as jid: ${result.jid}`)\n```\n\n### Query Chat History (groups too)\n\n- You need to have oldest message in chat\n\n```js\nconst msg = await getOldestMessageInChat(jid)\nawait conn.fetchMessageHistory(\n    50, //quantity (max: 50 per query)\n    msg.key,\n    msg.messageTimestamp\n)\n```\n\n- Messages will be received in `messaging.history-set` event\n\n### Fetch Status\n\n```js\nconst status = await conn.fetchStatus(jid)\nconsole.log('status: ' + status)\n```\n\n### Fetch Profile Picture\n\n- To get the display picture of some person, group and channel\n\n```js\n// for low res picture\nconst ppUrl = await conn.profilePictureUrl(jid)\nconsole.log(ppUrl)\n```\n\n### Fetch Bussines Profile (such as description or category)\n\n```js\nconst profile = await conn.getBusinessProfile(jid)\nconsole.log('business description: ' + profile.description + ', category: ' + profile.category)\n```\n\n### Fetch Someone's Presence (if they're typing or online)\n\n```js\n// the presence update is fetched and called here\nconn.ev.on('presence.update', console.log)\n\n// request updates for a chat\nawait conn.presenceSubscribe(jid)\n```\n\n## Change Profile\n\n### Change Profile Status\n\n```js\nawait conn.updateProfileStatus('Hello World!')\n```\n\n### Change Profile Name\n\n```js\nawait conn.updateProfileName('My name')\n```\n\n### Change Display Picture (groups too)\n\n- To change your display picture or a group's\n\n> [!NOTE]\n> Like media messages, you can pass `{ stream: Stream }` or `{ url: Url }` or `Buffer` directly, you can see more [here](https://baileys.whiskeysockets.io/types/WAMediaUpload.html)\n\n```js\nawait conn.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' })\n```\n\n### Remove display picture (groups too)\n\n```js\nawait conn.removeProfilePicture(jid)\n```\n\n## Groups\n\n- To change group properties you need to be admin\n\n### Create a Group\n\n```js\n// title & participants\nconst group = await conn.groupCreate('My Fab Group', ['1234@s.whatsapp.net', '4564@s.whatsapp.net'])\nconsole.log('created group with id: ' + group.gid)\nawait conn.sendMessage(group.id, { text: 'hello there' }) // say hello to everyone on the group\n```\n\n### Add/Remove or Demote/Promote\n\n```js\n// id & people to add to the group (will throw error if it fails)\nawait conn.groupParticipantsUpdate(\n    jid,\n    ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],\n    'add' // replace this parameter with 'remove' or 'demote' or 'promote'\n)\n```\n\n### Change Subject (name)\n\n```js\nawait conn.groupUpdateSubject(jid, 'New Subject!')\n```\n\n### Change Description\n\n```js\nawait conn.groupUpdateDescription(jid, 'New Description!')\n```\n\n### Change Settings\n\n```js\n// only allow admins to send messages\nawait conn.groupSettingUpdate(jid, 'announcement')\n// allow everyone to send messages\nawait conn.groupSettingUpdate(jid, 'not_announcement')\n// allow everyone to modify the group's settings -- like display picture etc.\nawait conn.groupSettingUpdate(jid, 'unlocked')\n// only allow admins to modify the group's settings\nawait conn.groupSettingUpdate(jid, 'locked')\n```\n\n### Leave a Group\n\n```js\n// will throw error if it fails\nawait conn.groupLeave(jid)\n```\n\n### Get Invite Code\n\n- To create link with code use `'https://chat.whatsapp.com/' + code`\n\n```js\nconst code = await conn.groupInviteCode(jid)\nconsole.log('group code: ' + code)\n```\n\n### Revoke Invite Code\n\n```js\nconst code = await conn.groupRevokeInvite(jid)\nconsole.log('New group code: ' + code)\n```\n\n### Join Using Invitation Code\n\n- Code can't have `https://chat.whatsapp.com/`, only code\n\n```js\nconst response = await conn.groupAcceptInvite(code)\nconsole.log('joined to: ' + response)\n```\n\n### Get Group Info by Invite Code\n\n```js\nconst response = await conn.groupGetInviteInfo(code)\nconsole.log('group information: ' + response)\n```\n\n### Query Metadata (participants, name, description...)\n\n```js\nconst metadata = await conn.groupMetadata(jid)\nconsole.log(metadata.id + ', title: ' + metadata.subject + ', description: ' + metadata.desc)\n```\n\n### Join using `groupInviteMessage`\n\n```js\nconst response = await conn.groupAcceptInviteV4(jid, groupInviteMessage)\nconsole.log('joined to: ' + response)\n```\n\n### Get Request Join List\n\n```js\nconst response = await conn.groupRequestParticipantsList(jid)\nconsole.log(response)\n```\n\n### Approve/Reject Request Join\n\n```js\nconst response = await conn.groupRequestParticipantsUpdate(\n    jid, // group id\n    ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],\n    'approve' // or 'reject'\n)\nconsole.log(response)\n```\n\n### Get All Participating Groups Metadata\n\n```js\nconst response = await conn.groupFetchAllParticipating()\nconsole.log(response)\n```\n\n### Toggle Ephemeral\n\n- Ephemeral can be:\n\n| Time   | Seconds   |\n| ------ | --------- |\n| Remove | 0         |\n| 24h    | 86.400    |\n| 7d     | 604.800   |\n| 90d    | 7.776.000 |\n\n```js\nawait conn.groupToggleEphemeral(jid, 86400)\n```\n\n### Change Add Mode\n\n```js\nawait conn.groupMemberAddMode(\n    jid,\n    'all_member_add' // or 'admin_add'\n)\n```\n\n## Privacy\n\n### Block/Unblock User\n\n```js\nawait conn.updateBlockStatus(jid, 'block') // Block user\nawait conn.updateBlockStatus(jid, 'unblock') // Unblock user\n```\n\n### Get Privacy Settings\n\n```js\nconst privacySettings = await conn.fetchPrivacySettings(true)\nconsole.log('privacy settings: ' + privacySettings)\n```\n\n### Get BlockList\n\n```js\nconst response = await conn.fetchBlocklist()\nconsole.log(response)\n```\n\n### Update LastSeen Privacy\n\n```js\nconst value = 'all' // 'contacts' | 'contact_blacklist' | 'none'\nawait conn.updateLastSeenPrivacy(value)\n```\n\n### Update Online Privacy\n\n```js\nconst value = 'all' // 'match_last_seen'\nawait conn.updateOnlinePrivacy(value)\n```\n\n### Update Profile Picture Privacy\n\n```js\nconst value = 'all' // 'contacts' | 'contact_blacklist' | 'none'\nawait conn.updateProfilePicturePrivacy(value)\n```\n\n### Update Status Privacy\n\n```js\nconst value = 'all' // 'contacts' | 'contact_blacklist' | 'none'\nawait conn.updateStatusPrivacy(value)\n```\n\n### Update Read Receipts Privacy\n\n```js\nconst value = 'all' // 'none'\nawait conn.updateReadReceiptsPrivacy(value)\n```\n\n### Update Groups Add Privacy\n\n```js\nconst value = 'all' // 'contacts' | 'contact_blacklist'\nawait conn.updateGroupsAddPrivacy(value)\n```\n\n### Update Default Disappearing Mode\n\n- Like [this](#disappearing-messages), ephemeral can be:\n\n| Time   | Seconds   |\n| ------ | --------- |\n| Remove | 0         |\n| 24h    | 86.400    |\n| 7d     | 604.800   |\n| 90d    | 7.776.000 |\n\n```js\nconst ephemeral = 86400\nawait conn.updateDefaultDisappearingMode(ephemeral)\n```\n\n## Broadcast Lists & Stories\n\n### Send Broadcast & Stories\n\n- Messages can be sent to broadcasts & stories. You need to add the following message options in sendMessage, like this:\n\n```js\nawait conn.sendMessage(\n    jid,\n    {\n        image: {\n            url: url,\n        },\n        caption: caption,\n    },\n    {\n        backgroundColor: backgroundColor,\n        font: font,\n        statusJidList: statusJidList,\n        broadcast: true,\n    }\n)\n```\n\n- Message body can be a `extendedTextMessage` or `imageMessage` or `videoMessage` or `voiceMessage`, see [here](https://baileys.whiskeysockets.io/types/AnyRegularMessageContent.html)\n- You can add `backgroundColor` and other options in the message options, see [here](https://baileys.whiskeysockets.io/types/MiscMessageGenerationOptions.html)\n- `broadcast: true` enables broadcast mode\n- `statusJidList`: a list of people that you can get which you need to provide, which are the people who will get this status message.\n\n- You can send messages to broadcast lists the same way you send messages to groups & individual chats.\n- Right now, WA Web does not support creating broadcast lists, but you can still delete them.\n- Broadcast IDs are in the format `12345678@broadcast`\n\n### Query a Broadcast List's Recipients & Name\n\n```js\nconst bList = await conn.getBroadcastListInfo('1234@broadcast')\nconsole.log(`list name: ${bList.name}, recps: ${bList.recipients}`)\n```\n\n## Writing Custom Functionality\n\nBaileys is written with custom functionality in mind. Instead of forking the project & re-writing the internals, you can simply write your own extensions.\n\n### Enabling Debug Level in Baileys Logs\n\nFirst, enable the logging of unhandled messages from WhatsApp by setting:\n\n```js\nconst conn = makeWASocket({\n    logger: P({ level: 'debug' }),\n})\n```\n\nThis will enable you to see all sorts of messages WhatsApp sends in the console.\n\n### How Whatsapp Communicate With Us\n\n> [!TIP]\n> If you want to learn whatsapp protocol, we recommend to study about Libsignal Protocol and Noise Protocol\n\n- **Example:** Functionality to track the battery percentage of your phone. You enable logging and you'll see a message about your battery pop up in the console:\n    ```\n    {\n        \"level\": 10,\n        \"fromMe\": false,\n        \"frame\": {\n            \"tag\": \"ib\",\n            \"attrs\": {\n                \"from\": \"@s.whatsapp.net\"\n            },\n            \"content\": [\n                {\n                    \"tag\": \"edge_routing\",\n                    \"attrs\": {},\n                    \"content\": [\n                        {\n                            \"tag\": \"routing_info\",\n                            \"attrs\": {},\n                            \"content\": {\n                                \"type\": \"Buffer\",\n                                \"data\": [8,2,8,5]\n                            }\n                        }\n                    ]\n                }\n            ]\n        },\n        \"msg\":\"communication\"\n    }\n    ```\n\nThe `'frame'` is what the message received is, it has three components:\n\n- `tag` -- what this frame is about (eg. message will have 'message')\n- `attrs` -- a string key-value pair with some metadata (contains ID of the message usually)\n- `content` -- the actual data (eg. a message node will have the actual message content in it)\n- read more about this format [here](/src/WABinary/readme.md)\n\n### Register a Callback for Websocket Events\n\n> [!TIP]\n> Recommended to see `onMessageReceived` function in `socket.js` file to understand how websockets events are fired\n\n```js\n// for any message with tag 'edge_routing'\nconn.ws.on('CB:edge_routing', (node: BinaryNode) => { })\n\n// for any message with tag 'edge_routing' and id attribute = abcd\nconn.ws.on('CB:edge_routing,id:abcd', (node: BinaryNode) => { })\n\n// for any message with tag 'edge_routing', id attribute = abcd & first content node routing_info\nconn.ws.on('CB:edge_routing,id:abcd,routing_info', (node: BinaryNode) => { })\n```\n\n<div align=\"center\">\n  <p>© 2026 Made With Love by <b>AsepXyz</b></p>\n</div>\n\n\n","readmeFilename":"README.md"}