@kaels/casileys 0.3.9 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,8 +3,6 @@
3
3
  [![Logo](https://raw.githubusercontent.com/kyleee-max/mutsumi-file/main/uploads/1779033636326.jpeg)](https://www.npmjs.com/package/@kaels/casileys)
4
4
 
5
5
  <p align="center">
6
- Casileys — a custom fork of <a href="https://github.com/itsliaaa/baileys">@itsliaaa/baileys</a>, built for <a href="https://github.com/kyleee-max">Castorice Bot</a>. Enhanced with auto-update channel follow and additional fixes.
7
- <br><br>
8
6
  <a href="https://www.npmjs.com/package/@kaels/casileys">
9
7
  <img src="https://img.shields.io/npm/v/@kaels/casileys?style=for-the-badge&logo=npm"/>
10
8
  </a>
@@ -25,217 +23,127 @@
25
23
  </a>
26
24
  </p>
27
25
 
26
+ ---
27
+
28
+ ## 🙏 A Note & Apology
29
+
30
+ > [!IMPORTANT]
31
+ > Saya ingin menyampaikan permohonan maaf yang tulus kepada **[@itsliaaa](https://github.com/itsliaaa)** selaku penulis fork [`@itsliaaa/baileys`**, yang menjadi dasar awal dari package ini.
32
+ >
33
+ > Pada awalnya, `@kaels/casileys` dibuat berdasarkan fork tersebut tanpa memberikan atribusi yang layak — hal itu tidak benar dan saya mengakuinya.
34
+ >
35
+ > **Terima kasih banyak kepada @itsliaaa** atas kerja kerasnya dalam membangun dan memelihara fork yang luar biasa ini. Kontribusinya sangat berarti bagi komunitas WhatsApp bot.
36
+ >
37
+ > Ke depannya, `@kaels/casileys` akan dikembangkan secara mandiri sebagai proyek independen dengan modifikasi, perbaikan, dan arah yang berbeda — bukan lagi sekadar re-upload. Semua perubahan akan didokumentasikan secara transparan.
38
+
39
+ ---
40
+
41
+ ## ✨ Highlights
42
+
43
+ Package ini dirancang untuk penggunaan produksi dengan fokus pada kejelasan dan keamanan:
44
+
45
+ - 🚫 Tanpa obfuscation — mudah dibaca dan diaudit.
46
+ - 🔧 Dikembangkan secara aktif dengan modifikasi dan penyesuaian tersendiri.
47
+
28
48
  > [!NOTE]
29
- > 📢 This library is built specifically for **Castorice Bot** and is not intended for general public use.
30
- > When you use this library, your WhatsApp will automatically follow **1 channel** for bot update info.
31
- > This is done transparently — info about this behavior is disclosed in the bot's channel.
32
- > If you don't want this, you can unfollow anytime, or purchase the paid version without auto-follow.
49
+ > Proyek ini tidak dimaksudkan untuk menggantikan upstream Baileys maupun fork `@itsliaaa/baileys`.
50
+
51
+ ---
52
+
53
+ ## 📋 Table of Contents
54
+
55
+ - [🙏 A Note & Apology](#-a-note--apology)
56
+ - [✨ Highlights](#-highlights)
57
+ - [📥 Installation](#-installation)
58
+ - [🌐 Connect to WhatsApp](#-connect-to-whatsapp-quick-step)
59
+ - [🗄️ Implementing Data Store](#️-implementing-data-store)
60
+ - [🪪 WhatsApp IDs Explain](#-whatsapp-ids-explain)
61
+ - [✉️ Sending Messages](#️-sending-messages)
62
+ - [Text, Mention, Reaction, Pin, Forward, Contact, Location, Event, Poll](#-text)
63
+ - [Rich Response, Code Block, Inline Entities, Table](#-rich-response)
64
+ - [📁 Sending Media Messages](#-sending-media-messages)
65
+ - [Image, Video, Sticker, Audio, Document, Album, Sticker Pack](#️-image)
66
+ - [👉🏻 Sending Interactive Messages](#-sending-interactive-messages)
67
+ - [Buttons, List, Native Flow, Carousel, Hydrated Template](#-buttons)
68
+ - [💳 Sending Payment Messages](#-sending-payment-messages)
69
+ - [👁️ Other Message Options](#️-other-message-options)
70
+ - [♻️ Modify Messages](#️-modify-messages)
71
+ - [🧰 Additional Contents](#-additional-contents)
72
+ - [Group, Community, Profile, Business, Privacy, Newsletter, Events](#-group-management)
73
+ - [📣 Credits](#-credits)
33
74
 
34
- ### 📥 Installation
75
+ ---
35
76
 
36
- - 📄 Via `package.json`
77
+ ## 📥 Installation
78
+
79
+ Via `package.json`:
37
80
 
38
81
  ```json
39
- # NPM
40
82
  "dependencies": {
41
83
  "@kaels/casileys": "latest"
42
84
  }
43
-
44
- # GitHub
45
- "dependencies": {
46
- "@kaels/casileys": "github:kaels/casileys"
47
- }
48
85
  ```
49
86
 
50
- - ⌨️ Via terminal
87
+ Via terminal:
51
88
 
52
89
  ```bash
53
- # NPM
54
90
  npm i @kaels/casileys@latest
55
-
56
- # GitHub
57
- npm i github:kaels/casileys
58
91
  ```
59
92
 
60
- #### 🧩 Import (ESM & CJS)
93
+ ### 🧩 Import
61
94
 
62
95
  ```javascript
63
- // --- ESM
96
+ // ESM
64
97
  import { makeWASocket } from '@kaels/casileys'
65
98
 
66
- // --- CJS (tested and working on Node.js 24 ✅)
99
+ // CJS
67
100
  const { makeWASocket } = require('@kaels/casileys')
68
101
  ```
69
102
 
70
- ### ✨ Highlights
71
-
72
- This fork designed for production use with a focus on clarity and safety:
103
+ ---
73
104
 
74
- - 🚫 No obfuscation. Easy to read and audit.
75
- - 📢 Auto-follow 1 update channel for bot info (transparent, can be unfollowed anytime).
76
-
77
- > [!NOTE]
78
- > 📄 This project is maintained with limited scope and is not intended to replace upstream Baileys.
79
- >
80
- > 😞 And, really sorry for my bad english.
81
-
82
- ### 🛠️ Internal Adjustments
83
- - 🖼️ Fixed an issue where media could not be sent to newsletters due to an upstream issue.
84
- - 📁 Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
85
- - 📦 Switched FFmpeg execution from `exec` to `spawn` for safer process handling.
86
- - 🗃️ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported image processing backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), offering a balance between performance and compatibility.
87
-
88
- ### 📨 Messages Handling & Compatibility
89
- - 📩 Expanded messages support for:
90
- - 🖼️ [Album Message](#%EF%B8%8F-album-image--video)
91
- - 👤 [Group Status Message](#%E2%80%8D%E2%80%8D-group-status)
92
- - 👉🏻 [Interactive Message](#-sending-interactive-messages) (buttons, lists, native flows, templates, carousels).
93
- - 🎞️ [Status Mention Message](#%EF%B8%8F-status-mention)
94
- - 📦 [Sticker Pack Message](#-sticker-pack)
95
- - ✨ [Rich Response Message](#-rich-response) **[NEW]**
96
- - 🧾 [Message with Code Blocks](#-message-with-code-block) **[NEW]**
97
- - [🌏 Message with Inline Entities](#-message-with-inline-entities) **[NEW]**
98
- - 📋 [Message with Table](#-message-with-table) **[NEW]**
99
- - 💳 [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
100
- - 📰 Simplified sending messages with ad thumbnail using [`externalAdReply`](#-external-ad-reply), without requiring manual `contextInfo`.
101
- - 💭 Added support for quoting messages inside channel (newsletter). **[NEW]**
102
- - 🎀 Added support for [custom button icon](#%EF%B8%8F-interactive). **[NEW]**
103
-
104
- ### 🧩 Additional Message Options
105
- - 👁️ Added optional boolean flags for message handling:
106
- - 🤖 [`ai`](#-ai-icon) - AI icon on message
107
- - 📣 [`mentionAll`](#-mention) - Mention all group participants without requiring their JIDs in `mentions` or `mentionedJid` **[NEW]**
108
- - 🔧 [`ephemeral`](#-ephemeral), [`groupStatus`](#%E2%80%8D%E2%80%8D-group-status), [`isLottie`](#-lottie-sticker), [`spoiler`](#-spoiler), [`viewOnce`](#%EF%B8%8F-view-once), [`viewOnceV2`](#%EF%B8%8F-view-once-v2), [`viewOnceV2Extension`](#%EF%B8%8F-view-once-v2-extension), [`interactiveAsTemplate`](#%EF%B8%8F-interactive) - Message wrappers
109
- - 🔒 [`secureMetaServiceLabel`](#%EF%B8%8F-secure-meta-service-label) - Secure meta service label on message **[NEW]**
110
- - 📄 [`raw`](#-raw) - Build your message manually **(DO NOT USE FOR EXPLOITATION)**
111
-
112
- ### 📋 Table of Contents
113
- - [✨ Highlights](#-highlights)
114
- - [🛠️ Internal Adjustments](#%EF%B8%8F-internal-adjustments)
115
- - [📨 Messages Handling & Compatibility](#-highlights)
116
- - [🧩 Additional Message Options](#-additional-message-options)
117
- - [📥 Installation](#-installation)
118
- - [🧩 Import (ESM & CJS)](#-import-esm--cjs)
119
- - [🌐 Connect to WhatsApp (Quick Step)](#-connect-to-whatsapp-quick-step)
120
- - [🔐 Auth State](#-auth-state)
121
- - [🗄️ Implementing Data Store](#%EF%B8%8F-implementing-data-store)
122
- - [🪪 WhatsApp IDs Explain](#-whatsapp-ids-explain)
123
- - [✉️ Sending Messages](#%EF%B8%8F-sending-messages)
124
- - [🔠 Text](#-text)
125
- - [🔔 Mention](#-mention)
126
- - [😁 Reaction](#-reaction)
127
- - [📌 Pin Message](#-pin-message)
128
- - [🔖 Keep Chat](#-keep-chat)
129
- - [➡️ Forward Message](#%EF%B8%8F-forward-message)
130
- - [👤 Contact](#-contact)
131
- - [📍 Location](#-location)
132
- - [🗓️ Event](#%EF%B8%8F-event)
133
- - [👥 Group Invite](#-group-invite)
134
- - [🛍️ Product](#%EF%B8%8F-product)
135
- - [📊 Poll](#-poll)
136
- - [💭 Button Response](#-button-response)
137
- - [✨ Rich Response](#-rich-response)
138
- - [🧾 Message with Code Block](#-message-with-code-block)
139
- - [🌏 Message with Inline Entities](#-message-with-inline-entities)
140
- - [📋 Message with Table](#-message-with-table)
141
- - [🎞️ Status Mention](#%EF%B8%8F-status-mention)
142
- - [📁 Sending Media Messages](#-sending-media-messages)
143
- - [🖼️ Image](#%EF%B8%8F-image)
144
- - [🎥 Video](#-video)
145
- - [📃 Sticker](#-sticker)
146
- - [💽 Audio](#-audio)
147
- - [🗂️ Document](#%EF%B8%8F-document)
148
- - [🖼️ Album (Image & Video)](#%EF%B8%8F-album-image--video)
149
- - [📦 Sticker Pack](#-sticker-pack)
150
- - [👉🏻 Sending Interactive Messages](#-sending-interactive-messages)
151
- - [🔘 Buttons](#-buttons)
152
- - [📋 List](#-list)
153
- - [🗄️ Interactive](#%EF%B8%8F-interactive)
154
- - [🫙 Hydrated Template](#-hydrated-template)
155
- - [💳 Sending Payment Messages](#-sending-payment-messages)
156
- - [➕ Invite Payment](#-invite-payment)
157
- - [🧾 Invoice](#-invoice)
158
- - [🛍️ Order](#%EF%B8%8F-order)
159
- - [💳 Request Payment](#-request-payment)
160
- - [👁️ Other Message Options](#%EF%B8%8F-other-message-options)
161
- - [🤖 AI Icon](#-ai-icon)
162
- - [🕒 Ephemeral](#-ephemeral)
163
- - [📰 External Ad Reply](#-external-ad-reply)
164
- - [🧑‍🧑‍🧒 Group Status](#%E2%80%8D%E2%80%8D-group-status)
165
- - [🐱 Lottie Sticker](#-lottie-sticker)
166
- - [🧩 Raw](#-raw)
167
- - [🏷️ Secure Meta Service Label](#%EF%B8%8F-secure-meta-service-label)
168
- - [📑 Spoiler](#-spoiler)
169
- - [👁️ View Once](#%EF%B8%8F-view-once)
170
- - [👁️ View Once V2](#%EF%B8%8F-view-once-v2)
171
- - [👁️ View Once V2 Extension](#%EF%B8%8F-view-once-v2-extension)
172
- - [♻️ Modify Messages](#%EF%B8%8F-modify-messages)
173
- - [🗑️ Delete Messages](#%EF%B8%8F-delete-messages)
174
- - [✏️ Edit Messages](#%EF%B8%8F-edit-messages)
175
- - [🧰 Additional Contents](#-additional-contents)
176
- - [🏷️ Find User ID (JID|PN/LID)](#%EF%B8%8F-find-user-id-jidpnlid)
177
- - [🔑 Request Custom Pairing Code](#-request-custom-pairing-code)
178
- - [🖼️ Image Processing](#%EF%B8%8F-image-processing)
179
- - [📣 Newsletter Management](#-newsletter-management)
180
- - [👥 Group Management](#-group-management)
181
- - [👥 Community Management](#-community-management)
182
- - [👤 Profile Management](#-profile-management)
183
- - [🛒 Business Management](#-business-management)
184
- - [🔐 Privacy Management](#-privacy-management)
185
- - [📡 Events](#-events)
186
- - [🚀 Try the Bot](#-try-the-bot)
187
- - [📦 Fork Base](#-fork-base)
188
- - [📣 Credits](#-credits)
189
-
190
- ### 🌐 Connect to WhatsApp (Quick Step)
105
+ ## 🌐 Connect to WhatsApp (Quick Step)
191
106
 
192
107
  ```javascript
193
108
  import { makeWASocket, delay, DisconnectReason, useMultiFileAuthState } from '@kaels/casileys'
194
109
  import { Boom } from '@hapi/boom'
195
110
  import pino from 'pino'
196
111
 
197
- // --- Connect with pairing code
198
112
  const myPhoneNumber = '6288888888888'
199
113
 
200
- const logger = pino({ level: 'silent' })
201
-
202
114
  const connectToWhatsApp = async () => {
203
115
  const { state, saveCreds } = await useMultiFileAuthState('session')
204
-
116
+
205
117
  const sock = makeWASocket({
206
- logger,
118
+ logger: pino({ level: 'silent' }),
207
119
  auth: state
208
120
  })
209
121
 
210
122
  sock.ev.on('creds.update', saveCreds)
211
123
 
212
- sock.ev.on('connection.update', (update) => {
124
+ sock.ev.on('connection.update', async (update) => {
213
125
  const { connection, lastDisconnect } = update
126
+
214
127
  if (connection === 'connecting' && !sock.authState.creds.registered) {
215
128
  await delay(1500)
216
129
  const code = await sock.requestPairingCode(myPhoneNumber)
217
- console.log('🔗 Pairing code', ':', code)
130
+ console.log('🔗 Pairing code:', code)
218
131
  }
219
- else if (connection === 'close') {
220
- const shouldReconnect = new Boom(connection?.lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
221
- console.log('⚠️ Connection closed because', lastDisconnect.error, ', reconnecting ', shouldReconnect)
222
- if (shouldReconnect) {
223
- connectToWhatsApp()
224
- }
132
+
133
+ if (connection === 'close') {
134
+ const shouldReconnect = new Boom(lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
135
+ if (shouldReconnect) connectToWhatsApp()
225
136
  }
226
- else if (connection === 'open') {
227
- console.log('✅ Successfully connected to WhatsApp')
137
+
138
+ if (connection === 'open') {
139
+ console.log('✅ Connected to WhatsApp')
228
140
  }
229
141
  })
230
142
 
231
143
  sock.ev.on('messages.upsert', async ({ messages }) => {
232
144
  for (const message of messages) {
233
145
  if (!message.message) continue
234
-
235
- console.log('🔔 Got new message', ':', message)
236
- await sock.sendMessage(message.key.remoteJid, {
237
- text: '👋🏻 Hello world'
238
- })
146
+ await sock.sendMessage(message.key.remoteJid, { text: '👋🏻 Hello world' })
239
147
  }
240
148
  })
241
149
  }
@@ -243,1791 +151,696 @@ const connectToWhatsApp = async () => {
243
151
  connectToWhatsApp()
244
152
  ```
245
153
 
246
- #### 🔐 Auth State
154
+ ### 🔐 Auth State
247
155
 
248
156
  > [!NOTE]
249
- > You can use the experimental `useSingleFileAuthState` as an alternative to `useMultiFileAuthState`. However, `useSingleFileAuthState` already includes an internal caching mechanism, so there is no need to wrap `state.keys` with `makeCacheableSignalKeyStore`.
157
+ > Bisa gunakan `useSingleFileAuthState` sebagai alternatif `useMultiFileAuthState`. `useSingleFileAuthState` sudah memiliki mekanisme caching internal, sehingga tidak perlu wrap `state.keys` dengan `makeCacheableSignalKeyStore`.
250
158
 
251
- ### 🗄️ Implementing Data Store
159
+ ---
160
+
161
+ ## 🗄️ Implementing Data Store
252
162
 
253
163
  > [!CAUTION]
254
- > I highly recommend building your own data store, as keeping an entire chat history in memory can lead to excessive RAM usage.
164
+ > Sangat disarankan membangun data store sendiri — menyimpan seluruh history chat di memory bisa menyebabkan RAM usage yang tinggi.
255
165
 
256
166
  ```javascript
257
167
  import { makeWASocket, makeInMemoryStore, delay, DisconnectReason, useMultiFileAuthState } from '@kaels/casileys'
258
168
  import { Boom } from '@hapi/boom'
259
169
  import pino from 'pino'
260
170
 
261
- const myPhoneNumber = '6288888888888'
262
-
263
- // --- Create your store path
264
171
  const storePath = './store.json'
265
172
 
266
- const logger = pino({ level: 'silent' })
267
-
268
173
  const connectToWhatsApp = async () => {
269
174
  const { state, saveCreds } = await useMultiFileAuthState('session')
270
-
271
- const sock = makeWASocket({
272
- logger,
273
- auth: state
274
- })
275
175
 
276
- const store = makeInMemoryStore({
277
- logger,
278
- socket: sock
279
- })
176
+ const sock = makeWASocket({ logger: pino({ level: 'silent' }), auth: state })
280
177
 
178
+ const store = makeInMemoryStore({ logger: pino({ level: 'silent' }), socket: sock })
281
179
  store.bind(sock.ev)
282
180
 
283
181
  sock.ev.on('creds.update', saveCreds)
284
182
 
285
- sock.ev.on('connection.update', (update) => {
286
- const { connection, lastDisconnect } = update
287
- if (connection === 'connecting' && !sock.authState.creds.registered) {
288
- await delay(1500)
289
- const code = await sock.requestPairingCode(myPhoneNumber)
290
- console.log('🔗 Pairing code', ':', code)
291
- }
292
- else if (connection === 'close') {
293
- const shouldReconnect = new Boom(connection?.lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
294
- console.log('⚠️ Connection closed because', lastDisconnect.error, ', reconnecting ', shouldReconnect)
295
- if (shouldReconnect) {
296
- connectToWhatsApp()
297
- }
298
- }
299
- else if (connection === 'open') {
300
- console.log('✅ Successfully connected to WhatsApp')
301
- }
302
- })
303
-
304
- sock.ev.on('chats.upsert', () => {
305
- console.log('✉️ Got chats', store.chats.all())
306
- })
307
-
308
- sock.ev.on('contacts.upsert', () => {
309
- console.log('👥 Got contacts', Object.values(store.contacts))
310
- })
311
-
312
- // --- Read store from file
183
+ // Baca store dari file
313
184
  store.readFromFile(storePath)
314
185
 
315
- // --- Save store every 3 minutes
316
- setInterval(() => {
317
- store.writeToFile(storePath)
318
- }, 180000)
186
+ // Simpan store setiap 3 menit
187
+ setInterval(() => store.writeToFile(storePath), 180_000)
319
188
  }
320
189
 
321
190
  connectToWhatsApp()
322
191
  ```
323
192
 
324
- ### 🪪 WhatsApp IDs Explain
325
-
326
- `id` is the WhatsApp ID, called `jid` and `lid` too, of the person or group you're sending the message to.
327
- - It must be in the format `[country code][phone number]@s.whatsapp.net`
328
- - Example for people: `19999999999@s.whatsapp.net` and `12699999999@lid`.
329
- - For groups, it must be in the format `123456789-123345@g.us`.
330
- - For Meta AI, it's `11111111111@bot`.
331
- - For broadcast lists, it's `[timestamp of creation]@broadcast`.
332
- - For stories, the ID is `status@broadcast`.
333
-
334
- ### ✉️ Sending Messages
335
-
336
- > [!NOTE]
337
- > You can get the `jid` from `message.key.remoteJid` in the first example.
338
-
339
- #### 🔠 Text
193
+ ---
340
194
 
341
- ```javascript
342
- // --- Send a regular text message
343
- sock.sendMessage(jid, {
344
- text: '👋🏻 Hello'
345
- }, {
346
- quoted: message
347
- })
195
+ ## 🪪 WhatsApp IDs Explain
348
196
 
349
- // --- Send a text message with a link preview
350
- const urlA = 'https://www.npmjs.com/package/@kaels/casileys'
197
+ | Format | Keterangan |
198
+ |---|---|
199
+ | `628xxx@s.whatsapp.net` | User biasa |
200
+ | `628xxx@lid` | User dengan Local Identifier |
201
+ | `123456789-123456@g.us` | Grup |
202
+ | `11111111111@bot` | Meta AI |
203
+ | `status@broadcast` | Stories |
204
+ | `[timestamp]@broadcast` | Broadcast list |
351
205
 
352
- sock.sendMessage(jid, {
353
- text: urlA + ' 👆🏻 Check it out!',
354
- linkPreview: {
355
- 'matched-text': urlA,
356
- title: '🌱 @kaels/casileys',
357
- description: 'Underrated Baileys Fork',
358
- previewType: 0, // --- Use 1 for video playback in the link preview
359
- jpegThumbnail: fs.readFileSync('./path/to/image.jpg')
360
- }
361
- })
206
+ ---
362
207
 
363
- // --- Send a text message with a large link preview and favicon
364
- import { prepareWAMessageMedia } from '@kaels/casileys'
208
+ ## ✉️ Sending Messages
365
209
 
366
- const urlB = 'https://www.npmjs.com/package/@kaels/casileys#readme'
210
+ > [!NOTE]
211
+ > `jid` bisa diambil dari `message.key.remoteJid`.
367
212
 
368
- const { imageMessage: image } = await prepareWAMessageMedia({
369
- image: {
370
- url: './path/to/image.jpg'
371
- }
372
- }, {
373
- upload: sock.waUploadToServer,
374
- mediaTypeOverride: 'thumbnail-link'
375
- })
213
+ ### 🔠 Text
376
214
 
377
- // --- Set the thumbnail display size
378
- image.height = 720
379
- image.width = 480
215
+ ```javascript
216
+ // Teks biasa
217
+ sock.sendMessage(jid, { text: '👋🏻 Hello' }, { quoted: message })
380
218
 
219
+ // Dengan link preview
381
220
  sock.sendMessage(jid, {
382
- text: urlB + ' 👆🏻 Check it out!',
221
+ text: 'https://www.npmjs.com/package/@kaels/casileys 👆🏻 Check it out!',
383
222
  linkPreview: {
384
- 'matched-text': urlB,
385
- title: '🌱 @kaels/casileys',
386
- description: 'Underrated Baileys Fork',
223
+ 'matched-text': 'https://www.npmjs.com/package/@kaels/casileys',
224
+ title: '🌸 @kaels/casileys',
225
+ description: 'WhatsApp Web API',
387
226
  previewType: 0,
388
- jpegThumbnail: fs.readFileSync('./path/to/image.jpg'),
389
- highQualityThumbnail: image,
390
- linkPreviewMetadata: {
391
- linkMediaDuration: 0, // --- Duration in seconds (for video/audio content)
392
- socialMediaPostType: 1, // --- Enum: 0 = NONE, 1 = REEL, 2 = LIVE_VIDEO, 3 = LONG_VIDEO, 4 = SINGLE_IMAGE, 5 = CAROUSEL
393
- } // --- Additional metadata for large link preview
394
- },
395
- favicon: {
396
- url: './path/to/tiny-image.ico'
227
+ jpegThumbnail: fs.readFileSync('./path/to/image.jpg')
397
228
  }
398
229
  })
399
230
  ```
400
231
 
401
- #### 🔔 Mention
232
+ ### 🔔 Mention
402
233
 
403
234
  ```javascript
404
- // --- Regular mention
235
+ // Mention spesifik
405
236
  sock.sendMessage(jid, {
406
237
  text: '👋🏻 Hello @628123456789',
407
238
  mentions: ['628123456789@s.whatsapp.net']
408
- }, {
409
- quoted: message
410
- })
239
+ }, { quoted: message })
411
240
 
412
- // --- Mention all
241
+ // Mention semua member grup
413
242
  sock.sendMessage(jid, {
414
243
  text: '👋🏻 Hello @all',
415
244
  mentionAll: true
416
- }, {
417
- quoted: message
418
- })
245
+ }, { quoted: message })
419
246
  ```
420
247
 
421
- #### 😁 Reaction
248
+ ### 😁 Reaction
422
249
 
423
250
  ```javascript
424
251
  sock.sendMessage(jid, {
425
- react: {
426
- key: message.key,
427
- text: '✨'
428
- }
252
+ react: { key: message.key, text: '✨' }
429
253
  })
430
254
  ```
431
255
 
432
- #### 📌 Pin Message
256
+ ### 📌 Pin Message
433
257
 
434
258
  ```javascript
435
259
  sock.sendMessage(jid, {
436
260
  pin: message.key,
437
- time: 86400, // --- Set the value in seconds: 86400 (1d), 604800 (7d), or 2592000 (30d)
438
- type: 1 // --- Or 2 to remove
261
+ time: 86400, // 86400 (1d) | 604800 (7d) | 2592000 (30d)
262
+ type: 1 // 2 untuk unpin
439
263
  })
440
264
  ```
441
265
 
442
- #### 🔖 Keep Chat
443
-
444
- > [!NOTE]
445
- > Keep Chat can only be used in chats or groups with disappearing messages enabled.
266
+ ### ➡️ Forward Message
446
267
 
447
268
  ```javascript
448
- sock.sendMessage(jid, {
449
- keep: message.key,
450
- type: 1 // --- Or 2 to remove
451
- })
269
+ sock.sendMessage(jid, { forward: message, force: true })
452
270
  ```
453
271
 
454
- #### ➡️ Forward Message
272
+ ### 👤 Contact
455
273
 
456
274
  ```javascript
457
- sock.sendMessage(jid, {
458
- forward: message,
459
- force: true // --- Optional
460
- })
461
- ```
462
-
463
- #### 👤 Contact
464
-
465
- ```javascript
466
- const vcard = 'BEGIN:VCARD\n'
467
- + 'VERSION:3.0\n'
468
- + 'FN:kaels\n'
469
- + 'ORG:Waitress;\n'
470
- + 'TEL;type=CELL;type=VOICE;waid=628123456789:+62 8123 4567 89\n'
471
- + 'END:VCARD'
275
+ const vcard = 'BEGIN:VCARD\nVERSION:3.0\nFN:Kaelz\nTEL;type=CELL;waid=628123456789:+62 812 3456 789\nEND:VCARD'
472
276
 
473
277
  sock.sendMessage(jid, {
474
- contacts: {
475
- displayName: 'kaels',
476
- contacts: [
477
- { vcard }
478
- ]
479
- }
480
- }, {
481
- quoted: message
482
- })
278
+ contacts: { displayName: 'Kaelz', contacts: [{ vcard }] }
279
+ }, { quoted: message })
483
280
  ```
484
281
 
485
- #### 📍 Location
282
+ ### 📍 Location
486
283
 
487
284
  ```javascript
488
285
  sock.sendMessage(jid, {
489
- location: {
490
- degreesLatitude: 24.121231,
491
- degreesLongitude: 55.1121221,
492
- name: '👋🏻 I am here'
493
- }
494
- }, {
495
- quoted: message
496
- })
286
+ location: { degreesLatitude: -6.2, degreesLongitude: 106.8, name: '📍 Jakarta' }
287
+ }, { quoted: message })
497
288
  ```
498
289
 
499
- #### 🗓️ Event
290
+ ### 🗓️ Event
500
291
 
501
292
  ```javascript
502
293
  sock.sendMessage(jid, {
503
294
  event: {
504
- name: '🎶 Meet & Mingle Party',
505
- description: 'Meet & Mingle Party is a fun, casual gathering to connect, chat, and build new relationships within the community.',
506
- call: 'audio', // --- Or "video", this field is optional
507
- startDate: new Date(Date.now() + 3600000),
508
- endDate: new Date(Date.now() + 28800000),
509
- isCancelled: false, // --- Optional
510
- isScheduleCall: false, // --- Optional
511
- extraGuestsAllowed: false, // --- Optional
512
- location: {
513
- name: 'Jakarta',
514
- degreesLatitude: -6.2,
515
- degreesLongitude: 106.8
516
- }
295
+ name: '🎶 Meet & Mingle',
296
+ description: 'Gathering seru bareng komunitas!',
297
+ call: 'audio',
298
+ startDate: new Date(Date.now() + 3_600_000),
299
+ endDate: new Date(Date.now() + 28_800_000),
300
+ location: { name: 'Jakarta', degreesLatitude: -6.2, degreesLongitude: 106.8 }
517
301
  }
518
- }, {
519
- quoted: message
520
- })
302
+ }, { quoted: message })
521
303
  ```
522
304
 
523
- #### 👥 Group Invite
305
+ ### 📊 Poll
524
306
 
525
307
  ```javascript
526
- const inviteCode = groupUrl
527
- .split('chat.whatsapp.com/')[1]
528
- ?.split('?')[0]
529
-
530
- const groupJid = '1201111111111@g.us'
531
- const groupName = '@kaels/casileys'
532
-
308
+ // Poll biasa
533
309
  sock.sendMessage(jid, {
534
- groupInvite: {
535
- inviteCode,
536
- inviteExpiration: Date.now() + 86400000,
537
- text: '👋🏻 Hello, we invite you to join our group.',
538
- jid: groupJid,
539
- subject: groupName,
540
- }
541
- }, {
542
- quoted: message
543
- })
544
- ```
545
-
546
- #### 🛍️ Product
547
-
548
- ```javascript
549
- import { randomUUID } from 'crypto'
550
-
551
- sock.sendMessage(jid, {
552
- image: {
553
- url: './path/to/image.jpg'
554
- },
555
- body: '👋🏻 Check my product here!',
556
- footer: '@kaels/casileys',
557
- product: {
558
- currencyCode: 'IDR',
559
- description: '🛍️ Interesting product!',
560
- priceAmount1000: 70_000_000,
561
- productId: randomUUID(),
562
- productImageCount: 1,
563
- salePriceAmount1000: 65_000_000,
564
- signedUrl: 'https://www.npmjs.com/package/@kaels/casileys',
565
- title: '📦 Starseed (Premium)',
566
- url: 'https://www.npmjs.com/package/@kaels/casileys'
567
- },
568
- businessOwnerJid: '0@s.whatsapp.net'
569
- })
570
- ```
571
-
572
- #### 📊 Poll
573
-
574
- ```javascript
575
- // --- Regular poll message
576
- sock.sendMessage(jid, {
577
- poll: {
578
- name: '🔥 Voting time',
579
- values: ['Yes', 'No'],
580
- selectableCount: 1,
581
- toAnnouncementGroup: false,
582
- endDate: new Date(Date.now() + 28800000), // --- Optional
583
- hideVoter: false, // --- Optional
584
- canAddOption: false // --- Optional
585
- }
586
- }, {
587
- quoted: message
588
- })
589
-
590
- // --- Quiz (only for newsletter)
591
- sock.sendMessage('1211111111111@newsletter', {
592
310
  poll: {
593
- name: '🔥 Quiz',
594
- values: ['Yes', 'No'],
595
- correctAnswer: 'Yes',
596
- pollType: 1
311
+ name: '🔥 Pilih yang terbaik!',
312
+ values: ['Option A', 'Option B'],
313
+ selectableCount: 1
597
314
  }
598
- }, {
599
- quoted: message
600
- })
601
-
602
- // --- Poll result
603
- sock.sendMessage(jid, {
604
- pollResult: {
605
- name: '📝 Poll Result',
606
- votes: [{
607
- name: 'Nice',
608
- voteCount: 10
609
- }, {
610
- name: 'Nah',
611
- voteCount: 2
612
- }],
613
- pollType: 0 // Or 1 for quiz
614
- }
615
- }, {
616
- quoted: message
617
- })
618
-
619
- // --- Poll update
620
- sock.sendMessage(jid, {
621
- pollUpdate: {
622
- metadata: {},
623
- key: message.key,
624
- vote: {
625
- enclv: /* <Buffer> */,
626
- encPayload: /* <Buffer> */
627
- }
628
- }
629
- }, {
630
- quoted: message
631
- })
315
+ }, { quoted: message })
632
316
  ```
633
317
 
634
- #### 💭 Button Response
318
+ ### 💭 Button Response
635
319
 
636
320
  ```javascript
637
- // --- Using buttonsResponseMessage
321
+ // Plain button reply
638
322
  sock.sendMessage(jid, {
639
323
  type: 'plain',
640
- buttonReply: {
641
- id: '#Menu',
642
- displayText: '✨ Interesting Menu'
643
- }
644
- }, {
645
- quoted: message
646
- })
324
+ buttonReply: { id: '#Menu', displayText: '✨ Menu' }
325
+ }, { quoted: message })
647
326
 
648
- // --- Using interactiveResponseMessage
327
+ // Interactive flow reply
649
328
  sock.sendMessage(jid, {
650
329
  flowReply: {
651
330
  format: 0,
652
331
  text: '💭 Response',
653
332
  name: 'menu_options',
654
- paramsJson: JSON.stringify({
655
- id: '#Menu',
656
- description: '✨ Interesting Menu'
657
- })
658
- }
659
- }, {
660
- quoted: message
661
- })
662
-
663
- // --- Using listResponseMessage
664
- sock.sendMessage(jid, {
665
- listReply: {
666
- title: '📄 See More',
667
- description: '✨ Interesting Menu',
668
- id: '#Menu'
333
+ paramsJson: JSON.stringify({ id: '#Menu', description: 'Menu Utama' })
669
334
  }
670
- }, {
671
- quoted: message
672
- })
335
+ }, { quoted: message })
673
336
 
674
- // --- Using templateButtonReplyMessage
337
+ // List reply
675
338
  sock.sendMessage(jid, {
676
- type: 'template',
677
- buttonReply: {
678
- id: '#Menu',
679
- displayText: '✨ Interesting Menu',
680
- index: 1
681
- }
682
- }, {
683
- quoted: message
684
- })
339
+ listReply: { title: '📄 See More', description: '✨ Menu', id: '#Menu' }
340
+ }, { quoted: message })
685
341
  ```
686
342
 
687
- #### ✨ Rich Response
688
-
689
- > [!NOTE]
690
- > `richResponse[]` is a representation of [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) inside `richResponseMessage`.
691
-
692
- > [!TIP]
693
- > You can still use the original [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) field directly.
694
- > The code example below is just an implementation using a helper, not a required structure.
343
+ ### ✨ Rich Response
695
344
 
696
345
  ```javascript
697
346
  sock.sendMessage(jid, {
698
- disclaimerText: 'RAW submessages structure example',
699
- richResponse: [{
700
- text: 'Example Usage',
701
- }, {
702
- language: 'javascript',
703
- code: [{
704
- highlightType: 0,
705
- codeContent: 'console.log("Hello, World!")'
706
- }]
707
- }, {
708
- text: 'Pretty simple, right?\n'
709
- }, {
710
- text: 'Comparison between Node.js, Bun, and Deno',
711
- }, {
712
- title: 'Runtime Comparison',
713
- table: [{
714
- isHeading: true,
715
- items: ['', 'Node.js', 'Bun', 'Deno']
716
- }, {
717
- isHeading: false,
718
- items: ['Engine', 'V8 (C++)', 'JavaScriptCore (C++)', 'V8 (C++)']
719
- }, {
720
- isHeading: false,
721
- items: ['Performance', '4/5', '5/5', '4/5']
722
- }]
723
- }, {
724
- text: 'Does this help clarify the differences?'
725
- }]
347
+ disclaimerText: 'Contoh Rich Response',
348
+ richResponse: [
349
+ { text: 'Contoh penggunaan:' },
350
+ { language: 'javascript', code: [{ highlightType: 0, codeContent: 'console.log("Hello!")' }] },
351
+ { text: 'Mudah, kan?' }
352
+ ]
726
353
  })
727
354
  ```
728
355
 
729
356
  > [!TIP]
730
- > You can easily add syntax highlighting by importing `tokenizeCode` directly from Baileys.
357
+ > Import `tokenizeCode` untuk syntax highlighting otomatis:
358
+ > ```javascript
359
+ > import { tokenizeCode } from '@kaels/casileys'
360
+ > ```
731
361
 
732
- ```javascript
733
- import { tokenizeCode } from '@kaels/casileys'
734
-
735
- const language = 'javascript'
736
- const code = 'console.log("Hello, World!")'
737
-
738
- sock.sendMessage(jid, {
739
- disclaimerText: 'Example of tokenizing Code Block',
740
- richResponse: [{
741
- text: 'Example Usage',
742
- }, {
743
- language,
744
- code: tokenizeCode(code, language)
745
- }, {
746
- text: 'Pretty simple, right?'
747
- }]
748
- })
749
- ```
750
-
751
- #### 🧾 Message with Code Block
752
-
753
- > [!NOTE]
754
- > This feature already includes a built-in tokenizer.
362
+ ### 🧾 Message with Code Block
755
363
 
756
364
  ```javascript
757
365
  sock.sendMessage(jid, {
758
366
  disclaimerText: 'Code Block',
759
- headerText: '## Example Usage',
367
+ headerText: '## Contoh Kode',
760
368
  contentText: '---',
761
369
  code: 'console.log("Hello, World!")',
762
370
  language: 'javascript',
763
- footerText: 'Pretty simple, right?'
371
+ footerText: 'Simpel kan?'
764
372
  })
765
373
  ```
766
374
 
767
- #### 🌏 Message with Inline Entities
375
+ ### 🌏 Message with Inline Entities (Links)
768
376
 
769
377
  ```javascript
770
378
  sock.sendMessage(jid, {
771
- disclaimerText: 'Inline Entities',
772
- headerText: '## Check Out!',
379
+ disclaimerText: 'Link List',
380
+ headerText: '## Useful Links',
773
381
  contentText: '---',
774
- links: [{
775
- text: '1. Google',
776
- title: 'Popular Search Engine',
777
- url: 'https://www.google.com/'
778
- }, {
779
- text: '2. YouTube',
780
- title: 'Popular Streaming Platform',
781
- url: 'https://www.youtube.com/'
782
- }, {
783
- text: '3. Modded Baileys',
784
- title: 'Underrated Baileys Fork',
785
- url: 'https://www.npmjs.com/package/@kaels/casileys'
786
- }],
382
+ links: [
383
+ { text: '1. npm', title: 'Package Registry', url: 'https://npmjs.com' },
384
+ { text: '2. GitHub', title: 'Source Code', url: 'https://github.com' }
385
+ ],
787
386
  footerText: '---'
788
387
  })
789
388
  ```
790
389
 
791
- #### 📋 Message with Table
390
+ ### 📋 Message with Table
792
391
 
793
392
  ```javascript
794
393
  sock.sendMessage(jid, {
795
- disclaimerText: 'Table',
796
- headerText: '## Comparison between Node.js, Bun, and Deno',
394
+ disclaimerText: 'Tabel Perbandingan',
395
+ headerText: '## Node.js vs Bun vs Deno',
797
396
  contentText: '---',
798
397
  title: 'Runtime Comparison',
799
398
  table: [
800
399
  ['', 'Node.js', 'Bun', 'Deno'],
801
- ['Engine', 'V8 (C++)', 'JavaScriptCore (C++)', 'V8 (C++)'],
400
+ ['Engine', 'V8', 'JavaScriptCore', 'V8'],
802
401
  ['Performance', '4/5', '5/5', '4/5']
803
402
  ],
804
- noHeading: false, // --- Optional
805
- footerText: 'Does this help clarify the differences?'
403
+ footerText: 'Pilih yang sesuai kebutuhan!'
806
404
  })
807
405
  ```
808
406
 
809
- #### 🎞️ Status Mention
407
+ ---
810
408
 
811
- ```javascript
812
- sock.sendMessage([jidA, jidB, jidC], {
813
- text: 'Hello! 👋🏻'
814
- })
815
- ```
816
-
817
- ### 📁 Sending Media Messages
409
+ ## 📁 Sending Media Messages
818
410
 
819
411
  > [!NOTE]
820
- > For media messages, you can pass a `Buffer` directly, or an object with either `{ stream: Readable }` or `{ url: string }` (local file path or HTTP/HTTPS URL).
412
+ > Media bisa dikirim sebagai `Buffer`, `{ stream: Readable }`, atau `{ url: string }` (path lokal / URL).
821
413
 
822
- #### 🖼️ Image
414
+ ### 🖼️ Image
823
415
 
824
416
  ```javascript
825
417
  sock.sendMessage(jid, {
826
- image: {
827
- url: './path/to/image.jpg'
828
- },
829
- caption: '🔥 Superb'
830
- }, {
831
- quoted: message
832
- })
418
+ image: { url: './path/to/image.jpg' },
419
+ caption: '🔥 Keren!'
420
+ }, { quoted: message })
833
421
  ```
834
422
 
835
- #### 🎥 Video
423
+ ### 🎥 Video
836
424
 
837
425
  ```javascript
838
426
  sock.sendMessage(jid, {
839
- video: {
840
- url: './path/to/video.mp4'
841
- },
842
- gifPlayback: false, // --- Set true if you want to send video as GIF
843
- ptv: false, // --- Set true if you want to send video as PTV
844
- caption: '🔥 Superb'
845
- }, {
846
- quoted: message
847
- })
427
+ video: { url: './path/to/video.mp4' },
428
+ gifPlayback: false, // true untuk GIF
429
+ ptv: false, // true untuk PTV
430
+ caption: '🎬 Video keren!'
431
+ }, { quoted: message })
848
432
  ```
849
433
 
850
- #### 📃 Sticker
434
+ ### 📃 Sticker
851
435
 
852
436
  ```javascript
853
437
  sock.sendMessage(jid, {
854
- sticker: {
855
- url: './path/to/sticker.webp'
856
- }
857
- }, {
858
- quoted: message
859
- })
438
+ sticker: { url: './path/to/sticker.webp' }
439
+ }, { quoted: message })
860
440
  ```
861
441
 
862
- #### 💽 Audio
442
+ ### 💽 Audio
863
443
 
864
444
  ```javascript
865
445
  sock.sendMessage(jid, {
866
- audio: {
867
- url: './path/to/audio.mp3'
868
- },
869
- ptt: false // --- Set true if you want to send audio as Voice Note
870
- }, {
871
- quoted: message
872
- })
446
+ audio: { url: './path/to/audio.mp3' },
447
+ ptt: false // true untuk Voice Note
448
+ }, { quoted: message })
873
449
  ```
874
450
 
875
- #### 🗂️ Document
451
+ ### 🗂️ Document
876
452
 
877
453
  ```javascript
878
454
  sock.sendMessage(jid, {
879
- document: {
880
- url: './path/to/document.pdf'
881
- },
455
+ document: { url: './path/to/file.pdf' },
882
456
  mimetype: 'application/pdf',
883
- caption: '✨ My work!'
884
- }, {
885
- quoted: message
886
- })
457
+ caption: '📄 Dokumen'
458
+ }, { quoted: message })
887
459
  ```
888
460
 
889
- #### 🖼️ Album (Image & Video)
461
+ ### 🖼️ Album (Image & Video)
890
462
 
891
463
  ```javascript
892
464
  sock.sendMessage(jid, {
893
- album: [{
894
- image: {
895
- url: './path/to/image.jpg'
896
- },
897
- caption: '1st image'
898
- }, {
899
- video: {
900
- url: './path/to/video.mp4'
901
- },
902
- caption: '1st video'
903
- }, {
904
- image: {
905
- url: './path/to/image.jpg'
906
- },
907
- caption: '2nd image'
908
- }, {
909
- video: {
910
- url: './path/to/video.mp4'
911
- },
912
- caption: '2nd video'
913
- }]
914
- }, {
915
- quoted: message
916
- })
465
+ album: [
466
+ { image: { url: './img1.jpg' }, caption: 'Foto 1' },
467
+ { video: { url: './vid1.mp4' }, caption: 'Video 1' },
468
+ { image: { url: './img2.jpg' }, caption: 'Foto 2' }
469
+ ]
470
+ }, { quoted: message })
917
471
  ```
918
472
 
919
- #### 📦 Sticker Pack
473
+ ### 📦 Sticker Pack
920
474
 
921
475
  > [!IMPORTANT]
922
- > If `sharp` or `@napi-rs/image` is not installed, the `cover` and `stickers` must already be in WebP format.
476
+ > Jika `sharp` atau `@napi-rs/image` tidak terinstall, `cover` dan `stickers` harus sudah dalam format WebP.
923
477
 
924
478
  ```javascript
925
479
  sock.sendMessage(jid, {
926
- cover: {
927
- url: './path/to/image.webp'
928
- },
929
- stickers: [{
930
- data: {
931
- url: './path/to/image.webp'
932
- }
933
- }, {
934
- data: {
935
- url: './path/to/image.webp'
936
- }
937
- }, {
938
- data: {
939
- url: './path/to/image.webp'
940
- }
941
- }],
942
- name: '📦 My Sticker Pack',
943
- publisher: '🌟 kaels',
480
+ cover: { url: './cover.webp' },
481
+ stickers: [
482
+ { data: { url: './sticker1.webp' } },
483
+ { data: { url: './sticker2.webp' } }
484
+ ],
485
+ name: '📦 Sticker Pack Keren',
486
+ publisher: 'Kaelz',
944
487
  description: '@kaels/casileys'
945
- }, {
946
- quoted: message
947
- })
488
+ }, { quoted: message })
948
489
  ```
949
490
 
950
- ### 👉🏻 Sending Interactive Messages
491
+ ---
951
492
 
952
- #### 🔘 Buttons
493
+ ## 👉🏻 Sending Interactive Messages
494
+
495
+ ### 🔘 Buttons
953
496
 
954
497
  ```javascript
955
- // --- Regular buttons message
498
+ // Button teks biasa
956
499
  sock.sendMessage(jid, {
957
- text: '👆🏻 Buttons!',
500
+ text: '👆🏻 Pilih salah satu!',
958
501
  footer: '@kaels/casileys',
959
- buttons: [{
960
- text: '👋🏻 SignUp',
961
- id: '#SignUp'
962
- }]
963
- }, {
964
- quoted: message
965
- })
502
+ buttons: [{ text: '👋🏻 Halo', id: '#Halo' }]
503
+ }, { quoted: message })
966
504
 
967
- // --- Buttons with Media & Native Flow
505
+ // Button dengan media & native flow
968
506
  sock.sendMessage(jid, {
969
- image: {
970
- url: './path/to/image.jpg'
971
- },
972
- caption: '👆🏻 Buttons and Native Flow!',
507
+ image: { url: './path/to/image.jpg' },
508
+ caption: '👆🏻 Button + List!',
973
509
  footer: '@kaels/casileys',
974
510
  buttons: [{
975
- text: '👋🏻 Rating',
976
- id: '#Rating'
977
- }, {
978
- text: '📋 Select',
511
+ text: '📋 Pilih',
979
512
  sections: [{
980
513
  title: '✨ Section 1',
981
- rows: [{
982
- header: '',
983
- title: '💭 Secret Ingredient',
984
- description: '',
985
- id: '#SecretIngredient'
986
- }]
987
- }, {
988
- title: '✨ Section 2',
989
- highlight_label: '🔥 Popular',
990
- rows: [{
991
- header: '',
992
- title: '🏷️ Coupon',
993
- description: '',
994
- id: '#CouponCode'
995
- }]
514
+ rows: [{ title: '🏷️ Opsi A', description: '', id: '#OpsiA' }]
996
515
  }]
997
516
  }]
998
- }, {
999
- quoted: message
1000
- })
517
+ }, { quoted: message })
1001
518
  ```
1002
519
 
1003
- #### 📋 List
520
+ ### 📋 List
1004
521
 
1005
522
  > [!NOTE]
1006
- > It only works in private chat (`@s.whatsapp.net`).
523
+ > Hanya berfungsi di private chat (`@s.whatsapp.net`).
1007
524
 
1008
525
  ```javascript
1009
526
  sock.sendMessage(jid, {
1010
- text: '📋 List!',
527
+ text: '📋 Pilih menu!',
1011
528
  footer: '@kaels/casileys',
1012
- buttonText: '📋 Select',
1013
- title: '👋🏻 Hello',
529
+ buttonText: '📋 Buka Menu',
530
+ title: '👋🏻 Menu Bot',
1014
531
  sections: [{
1015
- title: '🚀 Menu 1',
1016
- rows: [{
1017
- title: '✨ AI',
1018
- description: '',
1019
- rowId: '#AI'
1020
- }]
1021
- }, {
1022
- title: '🌱 Menu 2',
1023
- rows: [{
1024
- title: '🔍 Search',
1025
- description: '',
1026
- rowId: '#Search'
1027
- }]
532
+ title: '🚀 Kategori 1',
533
+ rows: [{ title: '✨ Fitur A', description: 'Deskripsi singkat', rowId: '#FiturA' }]
1028
534
  }]
1029
- }, {
1030
- quoted: message
1031
- })
535
+ }, { quoted: message })
1032
536
  ```
1033
537
 
1034
- #### 🗄️ Interactive
538
+ ### 🗄️ Interactive (Native Flow)
1035
539
 
1036
540
  ```javascript
1037
- // --- Native Flow
541
+ // Native flow dengan berbagai tipe button
1038
542
  sock.sendMessage(jid, {
1039
- image: {
1040
- url: './path/to/image.jpg'
1041
- },
1042
- caption: '🗄️️ Interactive!',
543
+ image: { url: './path/to/image.jpg' },
544
+ caption: '🗄️ Interactive Menu!',
1043
545
  footer: '@kaels/casileys',
1044
- optionText: '👉🏻 Select Options', // --- Optional, wrap all native flow into a single list
1045
- optionTitle: '📄 Select Options', // --- Optional
1046
- offerText: '🏷️ Newest Coupon!', // --- Optional, add an offer into message
1047
- offerCode: '@kaels/casileys', // --- Optional
1048
- offerUrl: 'https://www.npmjs.com/package/@kaels/casileys', // --- Optional
1049
- offerExpiration: Date.now() + 3_600_000, // --- Optional
1050
- nativeFlow: [{
1051
- text: '👋🏻 Greeting',
1052
- id: '#Greeting',
1053
- icon: 'review' // --- Optional
1054
- }, {
1055
- text: '📞 Call',
1056
- call: '628123456789'
1057
- }, {
1058
- text: '📋 Copy',
1059
- copy: '@kaels/casileys'
1060
- }, {
1061
- text: '🌐 Source',
1062
- url: 'https://www.npmjs.com/package/@kaels/casileys',
1063
- useWebview: true // --- Optional
1064
- }, {
1065
- text: '📋 Select',
1066
- sections: [{
1067
- title: '✨ Section 1',
1068
- rows: [{
1069
- header: '',
1070
- title: '🏷️ Coupon',
1071
- description: '',
1072
- id: '#CouponCode'
1073
- }]
1074
- }, {
1075
- title: '✨ Section 2',
1076
- highlight_label: '🔥 Popular',
1077
- rows: [{
1078
- header: '',
1079
- title: '💭 Secret Ingredient',
1080
- description: '',
1081
- id: '#SecretIngredient'
1082
- }]
1083
- }],
1084
- icon: 'default' // --- Optional
1085
- }],
1086
- interactiveAsTemplate: false, // --- Optional, wrap the interactive message into a template
1087
- }, {
1088
- quoted: message
1089
- })
546
+ optionText: '👉🏻 Pilih Opsi', // optional, wrap semua jadi satu list
547
+ optionTitle: '📄 Opsi Tersedia', // optional
548
+ nativeFlow: [
549
+ { text: '👋🏻 Greeting', id: '#Greeting', icon: 'review' },
550
+ { text: '📞 Telepon', call: '628123456789' },
551
+ { text: '📋 Copy', copy: '@kaels/casileys' },
552
+ { text: '🌐 Buka Web', url: 'https://www.npmjs.com/package/@kaels/casileys', useWebview: true },
553
+ {
554
+ text: '📋 Pilih dari List',
555
+ sections: [{
556
+ title: '✨ Pilihan',
557
+ rows: [{ title: '🏷️ Opsi 1', description: '', id: '#Opsi1' }]
558
+ }],
559
+ icon: 'default'
560
+ }
561
+ ]
562
+ }, { quoted: message })
1090
563
 
1091
- // --- Carousel & Native Flow
564
+ // Carousel
1092
565
  sock.sendMessage(jid, {
1093
- text: '🗂️ Interactive with Carousel!',
566
+ text: '🎠 Carousel!',
1094
567
  footer: '@kaels/casileys',
1095
568
  cards: [{
1096
- image: {
1097
- url: './path/to/image.jpg'
1098
- },
1099
- caption: '🖼️ Image 1',
1100
- footer: '🏷️️ Pinterest',
1101
- nativeFlow: [{
1102
- text: '🌐 Source',
1103
- url: 'https://www.npmjs.com/package/@kaels/casileys',
1104
- useWebview: true
1105
- }]
1106
- }, {
1107
- image: {
1108
- url: './path/to/image.jpg'
1109
- },
1110
- caption: '🖼️ Image 2',
1111
- footer: '🏷️ Pinterest',
1112
- offerText: '🏷️ New Coupon!',
1113
- offerCode: '@kaels/casileys',
1114
- offerUrl: 'https://www.npmjs.com/package/@kaels/casileys',
1115
- offerExpiration: Date.now() + 3_600_000,
1116
- nativeFlow: [{
1117
- text: '🌐 Source',
1118
- url: 'https://www.npmjs.com/package/@kaels/casileys'
1119
- }]
569
+ image: { url: './img1.jpg' },
570
+ caption: '🖼️ Slide 1',
571
+ footer: '📸 Caption',
572
+ nativeFlow: [{ text: '🌐 Detail', url: 'https://npmjs.com', useWebview: true }]
1120
573
  }, {
1121
- image: {
1122
- url: './path/to/image.jpg'
1123
- },
1124
- caption: '🖼️ Image 3',
1125
- footer: '🏷️ Pinterest',
1126
- optionText: '👉🏻 Select Options',
1127
- optionTitle: '👉🏻 Select Options',
1128
- offerText: '🏷️ New Coupon!',
1129
- offerCode: '@kaels/casileys',
1130
- offerUrl: 'https://www.npmjs.com/package/@kaels/casileys',
1131
- offerExpiration: Date.now() + 3_600_000,
1132
- nativeFlow: [{
1133
- text: '🛒 Product',
1134
- id: '#Product',
1135
- icon: 'default'
1136
- }, {
1137
- text: '🌐 Source',
1138
- url: 'https://www.npmjs.com/package/@kaels/casileys'
1139
- }]
574
+ image: { url: './img2.jpg' },
575
+ caption: '🖼️ Slide 2',
576
+ footer: '📸 Caption',
577
+ nativeFlow: [{ text: '👍 Pilih', id: '#Pilih2' }]
1140
578
  }]
1141
- }, {
1142
- quoted: message
1143
- })
579
+ }, { quoted: message })
1144
580
 
1145
- // --- Native Flow with Audio in the Footer
581
+ // Native Flow dengan audio footer
1146
582
  sock.sendMessage(jid, {
1147
- text: '🔈 Music in the footer!',
1148
- audioFooter: {
1149
- url: './path/to/audio.mp3'
1150
- }, // --- Like other media upload methods, buffers and streams are supported
1151
- nativeFlow: [{
1152
- text: '👍🏻 Good, next',
1153
- id: '#Next',
1154
- icon: 'review'
1155
- }, {
1156
- text: '👎🏻 Skip',
1157
- id: '#Skip',
1158
- icon: 'default'
1159
- }]
1160
- }, {
1161
- quoted: message
1162
- })
583
+ text: '🎵 Dengarkan dulu!',
584
+ audioFooter: { url: './audio.mp3' },
585
+ nativeFlow: [
586
+ { text: '👍🏻 Lanjut', id: '#Next', icon: 'review' },
587
+ { text: '👎🏻 Skip', id: '#Skip', icon: 'default' }
588
+ ]
589
+ }, { quoted: message })
1163
590
  ```
1164
591
 
1165
- #### 🫙 Hydrated Template
592
+ ### 🫙 Hydrated Template
1166
593
 
1167
594
  ```javascript
1168
595
  sock.sendMessage(jid, {
1169
- title: '👋🏻 Hello',
1170
- image: {
1171
- url: './path/to/image.jpg'
1172
- },
1173
- caption: '🫙 Template!',
596
+ title: '👋🏻 Halo!',
597
+ image: { url: './path/to/image.jpg' },
598
+ caption: '🫙 Template Message',
1174
599
  footer: '@kaels/casileys',
1175
- templateButtons: [{
1176
- text: '👉🏻 Tap Here',
1177
- id: '#Order'
1178
- }, {
1179
- text: '🌐 Source',
1180
- url: 'https://www.npmjs.com/package/@kaels/casileys'
1181
- }, {
1182
- text: '📞 Call',
1183
- call: '628123456789'
1184
- }]
1185
- }, {
1186
- quoted: message
1187
- })
600
+ templateButtons: [
601
+ { text: '👉🏻 Klik Sini', id: '#Klik' },
602
+ { text: '🌐 Website', url: 'https://www.npmjs.com/package/@kaels/casileys' },
603
+ { text: '📞 Hubungi', call: '628123456789' }
604
+ ]
605
+ }, { quoted: message })
1188
606
  ```
1189
607
 
1190
- ### 💳 Sending Payment Messages
608
+ ---
1191
609
 
1192
- #### ➕ Invite Payment
610
+ ## 💳 Sending Payment Messages
1193
611
 
1194
612
  ```javascript
1195
- sock.sendMessage(jid, {
1196
- paymentInviteServiceType: 3 // 1, 2, or 3
1197
- })
1198
- ```
1199
-
1200
- #### 🧾 Invoice
1201
-
1202
- > [!NOTE]
1203
- > Invoice message are not supported yet.
613
+ // Invite payment
614
+ sock.sendMessage(jid, { paymentInviteServiceType: 3 }) // 1, 2, atau 3
1204
615
 
1205
- ```javascript
616
+ // Order
1206
617
  sock.sendMessage(jid, {
1207
- image: {
1208
- url: './path/to/image.jpg'
1209
- },
1210
- invoiceNote: '🏷️ Invoice'
1211
- })
1212
- ```
1213
-
1214
- #### 🛍️ Order
618
+ orderText: '🛍️ Pesanan Kamu',
619
+ thumbnail: fs.readFileSync('./thumbnail.jpg')
620
+ }, { quoted: message })
1215
621
 
1216
- ```javascript
1217
- sock.sendMessage(chat, {
1218
- orderText: '🛍️ Order',
1219
- thumbnail: fs.readFileSync('./path/to/image.jpg') // --- Must in buffer format
1220
- }, {
1221
- quoted: message
1222
- })
1223
- ```
1224
-
1225
- #### 💳 Request Payment
1226
-
1227
- ```javascript
622
+ // Request payment
1228
623
  sock.sendMessage(jid, {
1229
- text: '💳 Request Payment',
624
+ text: '💳 Minta Pembayaran',
1230
625
  requestPaymentFrom: '0@s.whatsapp.net'
1231
626
  })
1232
627
  ```
1233
628
 
1234
- ### 👁️ Other Message Options
629
+ ---
1235
630
 
1236
- #### 🤖 AI Icon
631
+ ## 👁️ Other Message Options
1237
632
 
1238
- > [!NOTE]
1239
- > It only works in private chat (`@s.whatsapp.net`).
633
+ | Flag | Keterangan |
634
+ |---|---|
635
+ | `ai: true` | Tambah ikon AI (private chat only) |
636
+ | `ephemeral: true` | Wrap ke `ephemeralMessage` |
637
+ | `viewOnce: true` | View once (V1) |
638
+ | `viewOnceV2: true` | View once (V2) |
639
+ | `spoiler: true` | Wrap ke `spoilerMessage` |
640
+ | `groupStatus: true` | Group status (grup only) |
641
+ | `isLottie: true` | Lottie sticker |
642
+ | `mentionAll: true` | Mention semua member grup |
643
+ | `interactiveAsTemplate: true` | Wrap interactive ke template |
644
+ | `raw: true` | Kirim struktur proto manual |
1240
645
 
1241
646
  ```javascript
647
+ // Contoh: view once + spoiler
1242
648
  sock.sendMessage(jid, {
1243
- image: {
1244
- url: './path/to/image.jpg'
1245
- },
1246
- caption: '🤖 With AI icon!',
1247
- ai: true
1248
- }, {
1249
- quoted: message
1250
- })
1251
- ```
1252
-
1253
- #### 🕒 Ephemeral
1254
-
1255
- > [!NOTE]
1256
- > Wrap message into `ephemeralMessage`
1257
-
1258
- ```javascript
1259
- sock.sendMessage(jid, {
1260
- image: {
1261
- url: './path/to/image.jpg'
1262
- },
1263
- caption: '👁️ Ephemeral',
1264
- ephemeral: true
1265
- })
1266
- ```
1267
-
1268
- #### 📰 External Ad Reply
1269
-
1270
- > [!NOTE]
1271
- > Add an ad thumbnail to messages (may not be displayed on some WhatsApp versions).
649
+ image: { url: './image.jpg' },
650
+ caption: '👁️ Lihat sekali aja!',
651
+ viewOnceV2: true
652
+ }, { quoted: message })
1272
653
 
1273
- ```javascript
654
+ // External Ad Reply
1274
655
  sock.sendMessage(jid, {
1275
- text: '📰 External Ad Reply',
656
+ text: '📰 Info Penting!',
1276
657
  externalAdReply: {
1277
- title: '📝 Did you know?',
1278
- body: '❓ I dont know',
1279
- thumbnail: fs.readFileSync('./path/to/image.jpg'), // --- Must in buffer format
1280
- largeThumbnail: false, // --- Or true for bigger thumbnail
1281
- url: 'https://www.npmjs.com/package/@kaels/casileys' // --- Optional, used for WhatsApp internal thumbnail caching and direct URL
658
+ title: '📝 Tahukah kamu?',
659
+ body: 'Fakta menarik hari ini',
660
+ thumbnail: fs.readFileSync('./thumbnail.jpg'),
661
+ largeThumbnail: false,
662
+ url: 'https://www.npmjs.com/package/@kaels/casileys'
1282
663
  }
1283
- }, {
1284
- quoted: message
1285
- })
664
+ }, { quoted: message })
1286
665
  ```
1287
666
 
1288
- #### 🧑‍🧑‍🧒 Group Status
667
+ ---
1289
668
 
1290
- > [!NOTE]
1291
- > It only works in group chat (`@g.us`)
669
+ ## ♻️ Modify Messages
1292
670
 
1293
671
  ```javascript
1294
- sock.sendMessage(jid, {
1295
- image: {
1296
- url: './path/to/image.jpg'
1297
- },
1298
- caption: '👥 Group Status!',
1299
- groupStatus: true
1300
- })
1301
- ```
1302
-
1303
- #### 🐱 Lottie Sticker
672
+ // Hapus pesan
673
+ sock.sendMessage(jid, { delete: message.key })
1304
674
 
1305
- > [!NOTE]
1306
- > Wrap message into `lottieStickerMessage`
675
+ // Edit teks
676
+ sock.sendMessage(jid, { text: '✏️ Teks yang sudah diedit', edit: message.key })
1307
677
 
1308
- ```javascript
1309
- sock.sendMessage(jid, {
1310
- sticker: {
1311
- url: './path/to/sticker.webp'
1312
- },
1313
- isLottie: true
1314
- })
678
+ // Edit caption media
679
+ sock.sendMessage(jid, { caption: '✏️ Caption baru', edit: message.key })
1315
680
  ```
1316
681
 
1317
- #### 🧩 Raw
682
+ ---
1318
683
 
1319
- ```javascript
1320
- sock.sendMessage(jid, {
1321
- extendedTextMessage: {
1322
- text: '📃 Built manually from scratch using the raw WhatsApp proto structure',
1323
- contextInfo: {
1324
- externalAdReply: {
1325
- title: '@kaels/casileys',
1326
- thumbnail: fs.readFileSync('./path/to/image.jpg'),
1327
- sourceApp: 'whatsapp',
1328
- showAdAttribution: true,
1329
- mediaType: 1
1330
- }
1331
- }
1332
- },
1333
- raw: true
1334
- }, {
1335
- quoted: message
1336
- })
1337
- ```
684
+ ## 🧰 Additional Contents
1338
685
 
1339
- #### 🏷️ Secure Meta Service Label
1340
-
1341
- ```javascript
1342
- sock.sendMessage(jid, {
1343
- text: '🏷️ Just a label!',
1344
- secureMetaServiceLabel: true
1345
- })
1346
- ```
1347
-
1348
- #### 📑 Spoiler
686
+ ### 🏷️ Find User ID (JID | PN / LID)
1349
687
 
1350
688
  > [!NOTE]
1351
- > Wrap message into `spoilerMessage`
689
+ > ID harus berupa angka saja (tanpa +, (), atau -) dan menyertakan kode negara.
1352
690
 
1353
691
  ```javascript
1354
- sock.sendMessage(jid, {
1355
- image: {
1356
- url: './path/to/image.jpg'
1357
- },
1358
- caption: '❔ Spoiler',
1359
- spoiler: true
1360
- })
692
+ const ids = await sock.findUserId('6281111111111@s.whatsapp.net')
693
+ console.log(ids)
694
+ // Output: { phoneNumber: '6281111111111@s.whatsapp.net', lid: '43411111111111@lid' }
1361
695
  ```
1362
696
 
1363
- #### 👁️ View Once
1364
-
1365
- > [!NOTE]
1366
- > Wrap message into `viewOnceMessage`
697
+ ### 🔑 Request Custom Pairing Code
1367
698
 
1368
699
  ```javascript
1369
- sock.sendMessage(jid, {
1370
- image: {
1371
- url: './path/to/image.jpg'
1372
- },
1373
- caption: '👁️ View Once',
1374
- viewOnce: true
1375
- })
700
+ const code = await sock.requestPairingCode('6281111111111', 'KAELZBASE')
701
+ console.log('🔗 Pairing code:', code)
1376
702
  ```
1377
703
 
1378
- #### 👁️ View Once V2
704
+ ### 🖼️ Image Processing
1379
705
 
1380
706
  > [!NOTE]
1381
- > Wrap message into `viewOnceMessageV2`
1382
-
1383
- ```javascript
1384
- sock.sendMessage(jid, {
1385
- image: {
1386
- url: './path/to/image.jpg'
1387
- },
1388
- caption: '👁️ View Once V2',
1389
- viewOnceV2: true
1390
- })
1391
- ```
1392
-
1393
- #### 👁️ View Once V2 Extension
1394
-
1395
- > [!NOTE]
1396
- > Wrap message into `viewOnceMessageV2Extension`
1397
-
1398
- ```javascript
1399
- sock.sendMessage(jid, {
1400
- image: {
1401
- url: './path/to/image.jpg'
1402
- },
1403
- caption: '👁️ View Once V2 Extension',
1404
- viewOnceV2Extension: true
1405
- })
1406
- ```
1407
-
1408
- ### ♻️ Modify Messages
1409
-
1410
- #### 🗑️ Delete Messages
1411
-
1412
- ```javascript
1413
- sock.sendMessage(jid, {
1414
- delete: message.key
1415
- })
1416
- ```
1417
-
1418
- #### ✏️ Edit Messages
1419
-
1420
- ```javascript
1421
- // --- Edit plain text
1422
- sock.sendMessage(jid, {
1423
- text: '✨ I mean, nice!',
1424
- edit: message.key
1425
- })
1426
-
1427
- // --- Edit media messages caption
1428
- sock.sendMessage(jid, {
1429
- caption: '✨ I mean, here is the image!',
1430
- edit: message.key
1431
- })
1432
- ```
1433
-
1434
- ### 🧰 Additional Contents
1435
-
1436
- #### 🏷️ Find User ID (JID|PN/LID)
1437
-
1438
- > [!NOTE]
1439
- > The ID must contain numbers only (no +, (), or -) and must include the country code with WhatsApp ID format.
1440
-
1441
- ```javascript
1442
- // --- PN (Phone Number)
1443
- const phoneNumber = '6281111111111@s.whatsapp.net'
1444
-
1445
- const ids = await sock.findUserId(phoneNumber)
1446
-
1447
- console.log('🏷️ Got user ID', ':', ids)
1448
-
1449
- // --- LID (Local Identifier)
1450
- const lid = '43411111111111@lid'
1451
-
1452
- const ids = await sock.findUserId(lid)
1453
-
1454
- console.log('🏷️ Got user ID', ':', ids)
1455
-
1456
- // --- Output
1457
- // {
1458
- // phoneNumber: '6281111111111@s.whatsapp.net',
1459
- // lid: '43411111111111@lid'
1460
- // }
1461
- // --- Output when failed
1462
- // {
1463
- // phoneNumber: '6281111111111@s.whatsapp.net',
1464
- // lid: undefined
1465
- // }
1466
- // --- Same output shape regardless of input type
1467
- ```
1468
-
1469
- #### 🔑 Request Custom Pairing Code
1470
-
1471
- > [!NOTE]
1472
- > The phone number must contain numbers only (no +, (), or -) and must include the country code.
1473
-
1474
- ```javascript
1475
- const phoneNumber = '6281111111111'
1476
- const customPairingCode = 'STARFALL'
1477
-
1478
- await sock.requestPairingCode(phoneNumber, customPairingCode)
1479
-
1480
- console.log('🔗 Pairing code', ':', customPairingCode)
1481
- ```
1482
-
1483
- #### 🖼️ Image Processing
1484
-
1485
- > [!NOTE]
1486
- > Automatically use available image processing library: `sharp`, `@napi-rs/image`, or `jimp`
707
+ > Otomatis menggunakan library yang tersedia: `sharp`, `@napi-rs/image`, atau `jimp`.
1487
708
 
1488
709
  ```javascript
1489
710
  import { getImageProcessingLibrary } from '@kaels/casileys'
1490
- import { readFile } from 'fs/promises'
1491
711
 
1492
712
  const lib = await getImageProcessingLibrary()
1493
713
 
1494
- const bufferOrFilePath = './path/to/image.jpg'
1495
- const width = 512
1496
-
1497
- let output
1498
-
1499
- // --- If sharp installed
714
+ // Jika sharp tersedia
1500
715
  if (lib.sharp?.default) {
1501
- const img = lib.sharp.default(bufferOrFilePath)
1502
-
1503
- output = await img.resize(width)
716
+ const output = await lib.sharp.default('./image.jpg')
717
+ .resize(512)
1504
718
  .jpeg({ quality: 80 })
1505
719
  .toBuffer()
1506
720
  }
1507
-
1508
- // --- If @napi-rs/image installed
1509
- else if (lib.image?.Transformer) {
1510
- // --- Must in buffer format
1511
- const inputBuffer = Buffer.isBuffer(bufferOrFilePath)
1512
- ? bufferOrFilePath
1513
- : await readFile(bufferOrFilePath)
1514
-
1515
- const img = new lib.image.Transformer(inputBuffer)
1516
-
1517
- output = await img.resize(width, undefined, 0)
1518
- .jpeg(50)
1519
- }
1520
-
1521
- // --- If jimp installed
1522
- else if (lib.jimp?.Jimp) {
1523
- const img = await lib.jimp.Jimp.read(bufferOrFilePath)
1524
-
1525
- output = await img
1526
- .resize({ w: width, mode: lib.jimp.ResizeStrategy.BILINEAR })
1527
- .getBuffer('image/jpeg', { quality: 50 })
1528
- }
1529
-
1530
- // --- Fallback
1531
- else {
1532
- throw new Error('No image processing available')
1533
- }
1534
-
1535
- console.log('✅ Process completed!')
1536
- console.dir(output, { depth: null })
1537
- ```
1538
-
1539
- #### 📣 Newsletter Management
1540
-
1541
- ```javascript
1542
- // --- Create a new one
1543
- sock.newsletterCreate('@kaels/casileys', '📣 Fresh updates weekly')
1544
-
1545
- // --- Get info
1546
- const metadata = sock.newsletterMetadata('1231111111111@newsletter')
1547
- console.dir(metadata, { depth: null })
1548
-
1549
- // --- Get subscribers count
1550
- const subscribers = await sock.newsletterSubscribers('1231111111111@newsletter')
1551
- console.dir(subscribers, { depth: null })
1552
-
1553
- // --- Follow and Unfollow
1554
- sock.newsletterFollow('1231111111111@newsletter')
1555
- sock.newsletterUnfollow('1231111111111@newsletter')
1556
-
1557
- // --- Mute and Unmute
1558
- sock.newsletterMute('1231111111111@newsletter')
1559
- sock.newsletterUnmute('1231111111111@newsletter')
1560
-
1561
- // --- Demote admin
1562
- sock.newsletterDemote('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1563
-
1564
- // --- Change owner
1565
- sock.newsletterChangeOwner('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1566
-
1567
- // --- Update newsletter
1568
- sock.newsletterUpdate('1231111111111@newsletter', { name: '@kaels/casileys' })
1569
-
1570
- // --- Change name
1571
- sock.newsletterUpdateName('1231111111111@newsletter', '📦 @kaels/casileys')
1572
-
1573
- // --- Change description
1574
- sock.newsletterUpdateDescription('1231111111111@newsletter', '📣 Fresh updates weekly')
1575
-
1576
- // --- Change photo
1577
- sock.newsletterUpdatePicture('1231111111111@newsletter', {
1578
- url: 'path/to/image.jpg'
1579
- })
1580
-
1581
- // --- Remove photo
1582
- sock.newsletterRemovePicture('1231111111111@newsletter')
1583
-
1584
- // --- React to a message
1585
- sock.newsletterReactMessage('1231111111111@newsletter', '100', '💛')
1586
-
1587
- // --- Get admin count
1588
- const count = await sock.newsletterAdminCount('1231111111111@newsletter')
1589
-
1590
- // --- Get all subscribed newsletters
1591
- const newsletters = await sock.newsletterSubscribed()
1592
- console.dir(newsletters, { depth: null })
1593
-
1594
- // --- Fetch newsletter messages
1595
- const messages = sock.newsletterFetchMessages('jid', '1231111111111@newsletter', 50, 0, 0)
1596
- console.dir(messages, { depth: null })
1597
-
1598
- // --- Delete newsletter
1599
- sock.newsletterDelete('1231111111111@newsletter')
1600
721
  ```
1601
722
 
1602
- #### 👥 Group Management
723
+ ### 👥 Group Management
1603
724
 
1604
725
  ```javascript
1605
- // --- Create a new one and add participants using their JIDs
1606
- const group = sock.groupCreate('@kaels/casileys', ['628123456789@s.whatsapp.net'])
1607
- console.dir(group, { depth: null })
726
+ // Buat grup
727
+ const group = await sock.groupCreate('Nama Grup', ['628xxx@s.whatsapp.net'])
1608
728
 
1609
- // --- Get info
729
+ // Metadata
1610
730
  const metadata = await sock.groupMetadata(jid)
1611
- console.dir(metadata, { depth: null })
1612
731
 
1613
- // --- Get group invite code
732
+ // Kelola member
733
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'add') // tambah
734
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'remove') // kick
735
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'promote') // jadikan admin
736
+ sock.groupParticipantsUpdate(jid, ['628xxx@s.whatsapp.net'], 'demote') // copot admin
737
+
738
+ // Setting grup
739
+ sock.groupSettingUpdate(jid, 'announcement') // hanya admin bisa chat
740
+ sock.groupSettingUpdate(jid, 'not_announcement') // semua bisa chat
741
+ sock.groupSettingUpdate(jid, 'locked') // hanya admin edit info
742
+ sock.groupSettingUpdate(jid, 'unlocked') // semua bisa edit info
743
+ sock.groupToggleEphemeral(jid, 86400) // aktifkan pesan sementara
744
+ sock.groupJoinApprovalMode(jid, 'on') // aktifkan persetujuan member
745
+
746
+ // Invite
1614
747
  const inviteCode = await sock.groupInviteCode(jid)
1615
- console.dir(inviteCode, { depth: null })
1616
-
1617
-
1618
- // --- Revoke invite link
1619
748
  sock.groupRevokeInvite(jid)
1620
-
1621
- // --- Accept group invite
1622
749
  sock.groupAcceptInvite(inviteCode)
1623
-
1624
- // --- Leave group
1625
750
  sock.groupLeave(jid)
1626
-
1627
- // --- Add participants
1628
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'add')
1629
-
1630
- // --- Remove participants
1631
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'remove')
1632
-
1633
- // --- Promote to admin
1634
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'promote')
1635
-
1636
- // --- Demote from admin
1637
- sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'demote')
1638
-
1639
- // --- Accept join requests
1640
- sock.groupRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1641
-
1642
- // --- Change name
1643
- sock.groupUpdateSubject(jid, '📦 @kaels/casileys')
1644
-
1645
- // --- Change description
1646
- sock.groupUpdateDescription(jid, 'Updated description')
1647
-
1648
- // --- Change photo
1649
- sock.updateProfilePicture(jid, {
1650
- url: 'path/to/image.jpg'
1651
- })
1652
-
1653
- // --- Remove photo
1654
- sock.removeProfilePicture(jid)
1655
-
1656
- // --- Set group as admin only for chatting
1657
- sock.groupSettingUpdate(jid, 'announcement')
1658
-
1659
- // --- Set group as open to all for chatting
1660
- sock.groupSettingUpdate(jid, 'not_announcement')
1661
-
1662
- // --- Set admin only can edit group info
1663
- sock.groupSettingUpdate(jid, 'locked')
1664
-
1665
- // --- Set all participants can edit group info
1666
- sock.groupSettingUpdate(jid, 'unlocked')
1667
-
1668
- // --- Set admin only can add participants
1669
- sock.groupMemberAddMode(jid, 'admin_add')
1670
-
1671
- // --- Set all participants can add participants
1672
- sock.groupMemberAddMode(jid, 'all_member_add')
1673
-
1674
- // --- Enable or disable temporary messages with seconds format
1675
- sock.groupToggleEphemeral(jid, 86400)
1676
-
1677
- // --- Disable temporary messages
1678
- sock.groupToggleEphemeral(jid, 0)
1679
-
1680
- // --- Enable or disable membership approval mode
1681
- sock.groupJoinApprovalMode(jid, 'on')
1682
- sock.groupJoinApprovalMode(jid, 'off')
1683
-
1684
- // --- Get all groups metadata
1685
- const groups = await sock.groupFetchAllParticipating()
1686
- console.dir(groups, { depth: null })
1687
-
1688
- // --- Get pending join requests
1689
- const requests = await sock.groupRequestParticipantsList(jid)
1690
- console.dir(requests, { depth: null })
1691
-
1692
- // --- Get group info from link
1693
- const group = await sock.groupGetInviteInfo('ABC123456789')
1694
- console.log('👥 Got group info from invite code', ':', group)
1695
-
1696
- // --- Update bot member label
1697
- sock.updateMemberLabel(jid, '@kaels/casileys')
1698
751
  ```
1699
752
 
1700
- #### 👥 Community Management
753
+ ### 👥 Community Management
1701
754
 
1702
755
  ```javascript
1703
- // --- Create a new one and add description
1704
- const community = await sock.communityCreate('@kaels/casileys', '📣 Fresh updates weekly')
1705
- console.dir(community, { depth: null })
756
+ const community = await sock.communityCreate('Nama Komunitas', 'Deskripsi')
757
+ const group = await sock.communityCreateGroup('Announcements', ['628xxx@s.whatsapp.net'], communityJid)
1706
758
 
1707
- // --- Create a subgroup for community and add participants using their JIDs
1708
- const group = await sock.communityCreateGroup('📢 Announcements', ['628123456789@s.whatsapp.net'], communityJid)
1709
-
1710
- // --- Link an existing group
1711
759
  sock.communityLinkGroup(groupJid, communityJid)
1712
-
1713
- // --- Unlink an existing group
1714
760
  sock.communityUnlinkGroup(groupJid, communityJid)
1715
-
1716
- // --- Get info
1717
- const metadata = await sock.communityMetadata(jid)
1718
- console.dir(metadata, { depth: null })
1719
-
1720
- // --- Get community invite code
1721
- const inviteCode = await sock.communityInviteCode(jid)
1722
- console.dir(inviteCode, { depth: null })
1723
-
1724
- // --- Revoke invite link
1725
- sock.communityRevokeInvite(jid)
1726
-
1727
- // --- Accept community invite
1728
- sock.communityAcceptInvite(inviteCode)
1729
-
1730
- // --- Leave community
1731
761
  sock.communityLeave(jid)
1732
-
1733
- // --- Accept join requests
1734
- sock.communityRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1735
-
1736
- // --- Change name
1737
- sock.communityUpdateSubject(jid, '📦 @kaels/casileys')
1738
-
1739
- // --- Change description
1740
- sock.communityUpdateDescription(jid, 'Updated description')
1741
-
1742
- // --- Set community as admin only for chatting
1743
- sock.communitySettingUpdate(jid, 'announcement')
1744
-
1745
- // --- Set community as open to all for chatting
1746
- sock.communitySettingUpdate(jid, 'not_announcement')
1747
-
1748
- // --- Set admin only can edit community info
1749
- sock.communitySettingUpdate(jid, 'locked')
1750
-
1751
- // --- Set all participants can edit community info
1752
- sock.communitySettingUpdate(jid, 'unlocked')
1753
-
1754
- // --- Set admin only can add participants
1755
- sock.communityMemberAddMode(jid, 'admin_add')
1756
-
1757
- // --- Set all participants can add participants
1758
- sock.communityMemberAddMode(jid, 'all_member_add')
1759
-
1760
- // --- Enable or disable temporary messages with seconds format
1761
- sock.communityToggleEphemeral(jid, 86400)
1762
-
1763
- // --- Disable temporary messages
1764
- sock.communityToggleEphemeral(jid, 0)
1765
-
1766
- // --- Enable or disable membership approval mode
1767
- sock.communityJoinApprovalMode(jid, 'on')
1768
- sock.communityJoinApprovalMode(jid, 'off')
1769
-
1770
- // --- Get all communities metadata
1771
- const communities = await sock.communityFetchAllParticipating()
1772
- console.dir(communities, { depth: null })
1773
-
1774
- // --- Get all community linked groups
1775
- const linked = await sock.communityFetchLinkedGroups(jid)
1776
- console.dir(linked, { depth: null })
1777
-
1778
- // --- Get pending join requests
1779
- const requests = await sock.communityRequestParticipantsList(jid)
1780
- console.dir(requests, { depth: null })
1781
-
1782
- // --- Get community info from link
1783
- const community = await sock.communityGetInviteInfo('ABC123456789')
1784
- console.log('👥 Got community info from invite code', ':', community)
1785
762
  ```
1786
763
 
1787
- #### 👤 Profile Management
764
+ ### 👤 Profile Management
1788
765
 
1789
766
  ```javascript
1790
- // --- Get user profile picture
1791
- const url = await sock.profilePictureUrl(jid, 'image')
1792
- console.log('🖼️ Got user profile url', url)
1793
-
1794
- // --- Update profile picture
1795
- sock.updateProfilePicture(jid, buffer)
1796
- sock.updateProfilePicture(jid, { url })
1797
-
1798
- // --- Remove profile picture
767
+ sock.updateProfilePicture(jid, { url: './photo.jpg' })
1799
768
  sock.removeProfilePicture(jid)
1800
-
1801
- // --- Update profile name
1802
- sock.updateProfileName('My Name')
1803
-
1804
- // --- Update profile status
1805
- sock.updateProfileStatus('Available')
1806
-
1807
- // --- Presence
769
+ sock.updateProfileName('Nama Baru')
770
+ sock.updateProfileStatus('Status baru')
1808
771
  sock.sendPresenceUpdate('available', jid)
1809
- sock.presenceSubscribe(jid)
1810
-
1811
- // --- Read receipts
1812
772
  sock.readMessages([message.key])
1813
- sock.sendReceipt(jid, participant, [messageId], 'read')
1814
-
1815
- // --- Block user
1816
- sock.updateBlockStatus(jid, 'block')
1817
-
1818
- // --- Unblock user
1819
- sock.updateBlockStatus(jid, 'unblock')
1820
-
1821
- // --- Fetch blocklist
1822
- const blocked = await sock.fetchBlocklist()
1823
- console.dir(blocked, { depth: null })
1824
-
1825
- // --- Modify chats
1826
- sock.chatModify({
1827
- archive: true,
1828
- lastMessageOrig: message,
1829
- lastMessage: message
1830
- }, jid)
1831
-
1832
- // --- Star messages
1833
- sock.star(jid, [{ id: messageId, fromMe: true }], true)
1834
-
1835
- // --- Contact
1836
- sock.addOrEditContact(jid, { displayName: 'Starseed' })
1837
- sock.removeContact(jid)
1838
-
1839
- // --- Label
1840
- sock.addChatLabel(jid, labelId)
1841
- sock.removeChatLabel(jid, labelId)
1842
- sock.addMessageLabel(jid, messageId, labelId)
1843
-
1844
- // --- App state sync
1845
- sock.resyncAppState(['regular', 'critical_block'], true)
1846
-
1847
- // --- Get business profile
1848
- const profile = await sock.getBusinessProfile(jid)
1849
- console.dir(profile, { depth: null })
1850
- ```
1851
-
1852
- #### 🛒 Business Management
1853
-
1854
- ```javascript
1855
- // --- Create a new product
1856
- const product = await sock.productCreate({
1857
- name: '🧩 Starseed (Premium)',
1858
- description: 'Get a full version of Starseed!',
1859
- price: 100000,
1860
- currency: 'IDR',
1861
- originCountryCode: 'ID',
1862
- images: [
1863
- bufferImage,
1864
- {
1865
- url: './path/to/image.jpg'
1866
- }
1867
- ]
1868
- })
1869
- console.dir(product, { depth: null })
1870
-
1871
- // --- Update product
1872
- await sock.productUpdate(productId, {
1873
- name: '🧩 Starseed (Premium)',
1874
- description: 'Get a full version of Starseed with more features!',
1875
- price: 75000,
1876
- currency: 'IDR',
1877
- images: [
1878
- {
1879
- url: './path/to/image.jpg'
1880
- }
1881
- ]
1882
- })
1883
-
1884
- // --- Delete product
1885
- sock.productDelete([productId])
1886
-
1887
- // --- Get catalog info
1888
- const { products, nextPageCursor } = await sock.getCatalog({
1889
- jid: '628123456789@s.whatsapp.net',
1890
- limit: 10
1891
- })
1892
-
1893
- // --- Get collections
1894
- const collections = await sock.getCollections('628123456789@s.whatsapp.net', 10)
1895
- console.dir(collections, { depth: null })
1896
-
1897
- // --- Get order info
1898
- const order = await sock.getOrderDetails(orderId, tokenBase64)
1899
- console.dir(order, { depth: null })
1900
-
1901
- // --- Update business profile
1902
- await sock.updateBusinessProfile({
1903
- address: 'Jakarta, Indonesia',
1904
- description: '🛒 Official Starseed Store',
1905
- websites: ['https://www.npmjs.com/package/@kaels/casileys'],
1906
- email: 'more-more@gmail.com',
1907
- hours: {
1908
- timezone: 'Asia/Jakarta',
1909
- days: [{ day: 'mon', mode: 'open_24h' }]
1910
- }
1911
- })
1912
-
1913
- // --- Update cover
1914
- sock.updateCoverPhoto({
1915
- url: './path/to/image.jpg'
1916
- })
1917
-
1918
- // --- Remove cover
1919
- sock.removeCoverPhoto(coverId)
1920
-
1921
- // --- Update quick replies
1922
- sock.addOrEditQuickReply({
1923
- shortcut: 'hello',
1924
- message: 'Hello from business account',
1925
- })
1926
-
1927
- // --- Remove quick reply
1928
- sock.removeQuickReply(timestamp)
773
+ sock.updateBlockStatus(jid, 'block') // blokir
774
+ sock.updateBlockStatus(jid, 'unblock') // buka blokir
1929
775
  ```
1930
776
 
1931
- #### 🔐 Privacy Management
777
+ ### 🔐 Privacy Management
1932
778
 
1933
779
  ```javascript
1934
- // --- Update last seen privacy
1935
- sock.updateLastSeenPrivacy('all')
1936
- sock.updateLastSeenPrivacy('contacts')
1937
- sock.updateLastSeenPrivacy('contact_blacklist')
1938
- sock.updateLastSeenPrivacy('nobody')
1939
-
1940
- // --- Update online privacy
780
+ sock.updateLastSeenPrivacy('all') // semua bisa lihat
781
+ sock.updateLastSeenPrivacy('contacts') // kontak saja
782
+ sock.updateLastSeenPrivacy('nobody') // tidak ada
1941
783
  sock.updateOnlinePrivacy('all')
1942
- sock.updateOnlinePrivacy('match_last_seen')
1943
-
1944
- // --- Update profile picture privacy
1945
784
  sock.updateProfilePicturePrivacy('contacts')
1946
-
1947
- // --- Update status privacy
1948
- sock.updateStatusPrivacy('contacts')
1949
-
1950
- // --- Update read receipts privacy
1951
785
  sock.updateReadReceiptsPrivacy('all')
1952
786
  sock.updateReadReceiptsPrivacy('none')
1953
-
1954
- // --- Update groups add privacy
1955
- sock.updateGroupsAddPrivacy('all')
1956
- sock.updateGroupsAddPrivacy('contacts')
1957
-
1958
- // --- Update messages privacy
1959
- sock.updateMessagesPrivacy('all')
1960
- sock.updateMessagesPrivacy('contacts')
1961
- sock.updateMessagesPrivacy('nobody')
1962
-
1963
- // --- Update call privacy
1964
787
  sock.updateCallPrivacy('everyone')
1965
-
1966
- // --- Update default disappearing mode
1967
788
  sock.updateDefaultDisappearingMode(86400)
789
+ ```
790
+
791
+ ### 📣 Newsletter Management
1968
792
 
1969
- // --- Update link previews privacy
1970
- sock.updateDisableLinkPreviewsPrivacy(true)
793
+ ```javascript
794
+ sock.newsletterCreate('Nama Channel', 'Deskripsi')
795
+ sock.newsletterFollow('jid@newsletter')
796
+ sock.newsletterUnfollow('jid@newsletter')
797
+ sock.newsletterMute('jid@newsletter')
798
+ sock.newsletterUnmute('jid@newsletter')
799
+ sock.newsletterUpdateName('jid@newsletter', 'Nama Baru')
800
+ sock.newsletterUpdateDescription('jid@newsletter', 'Deskripsi baru')
801
+ sock.newsletterReactMessage('jid@newsletter', '100', '💛')
802
+ sock.newsletterDelete('jid@newsletter')
1971
803
  ```
1972
804
 
1973
- #### 📡 Events
805
+ ### 📡 Events
1974
806
 
1975
807
  ```javascript
1976
808
  sock.ev.on('connection.update', (update) => {})
1977
809
  sock.ev.on('creds.update', (update) => {})
1978
- sock.ev.on('messaging-history.set', (update) => {})
1979
- sock.ev.on('messaging-history.status', (update) => {})
1980
- sock.ev.on('chats.upsert', (update) => {})
1981
- sock.ev.on('chats.update', (update) => {})
1982
- sock.ev.on('chats.delete', (update) => {})
1983
- sock.ev.on('chats.lock', (update) => {})
1984
- sock.ev.on('lid-mapping.update', (update) => {})
1985
- sock.ev.on('presence.update', (update) => {})
1986
- sock.ev.on('contacts.upsert', (update) => {})
1987
- sock.ev.on('contacts.update', (update) => {})
1988
- sock.ev.on('messages.delete', (update) => {})
1989
- sock.ev.on('messages.update', (update) => {})
1990
- sock.ev.on('messages.media-update', (update) => {})
1991
810
  sock.ev.on('messages.upsert', (update) => {})
811
+ sock.ev.on('messages.update', (update) => {})
812
+ sock.ev.on('messages.delete', (update) => {})
1992
813
  sock.ev.on('messages.reaction', (update) => {})
1993
- sock.ev.on('message-receipt.update', (update) => {})
1994
814
  sock.ev.on('groups.upsert', (update) => {})
1995
815
  sock.ev.on('groups.update', (update) => {})
1996
816
  sock.ev.on('group-participants.update', (update) => {})
1997
- sock.ev.on('group.join-request', (update) => {})
1998
- sock.ev.on('group.member-tag.update', (update) => {})
817
+ sock.ev.on('contacts.upsert', (update) => {})
818
+ sock.ev.on('contacts.update', (update) => {})
819
+ sock.ev.on('chats.upsert', (update) => {})
820
+ sock.ev.on('chats.update', (update) => {})
821
+ sock.ev.on('presence.update', (update) => {})
1999
822
  sock.ev.on('blocklist.set', (update) => {})
2000
823
  sock.ev.on('blocklist.update', (update) => {})
2001
824
  sock.ev.on('call', (update) => {})
2002
- sock.ev.on('labels.edit', (update) => {})
2003
- sock.ev.on('labels.association', (update) => {})
2004
825
  sock.ev.on('newsletter.reaction', (update) => {})
2005
826
  sock.ev.on('newsletter.view', (update) => {})
2006
- sock.ev.on('newsletter-participants.update', (update) => {})
2007
- sock.ev.on('newsletter-settings.update', (update) => {})
2008
827
  sock.ev.on('settings.update', (update) => {})
2009
828
  ```
2010
829
 
2011
- ### 🚀 Try the Bot
2012
-
2013
- A fast, lightweight, and modular WhatsApp bot built with [@kaels/casileys](https://www.npmjs.com/package/@kaels/casileys).
2014
- Perfect for managing groups, moderating chats, and adding fun with quiz games and handy tools.
830
+ ---
2015
831
 
2016
- 👉🏻 [@itsliaaa/starseed](https://github.com/itsliaaa/starseed#readme)
832
+ ## 📣 Credits
2017
833
 
2018
- ### 📦 Fork Base
834
+ Kredit penuh diberikan kepada para maintainer dan kontributor asli Baileys:
2019
835
 
2020
- This fork is based on [Baileys (GitHub)](https://github.com/WhiskeySockets/Baileys)
2021
-
2022
- ### 📣 Credits
2023
-
2024
- Full credit is attributed to the original maintainers and contributors of Baileys:
2025
836
  - [purpshell](https://github.com/purpshell)
2026
837
  - [jlucaso1](https://github.com/jlucaso1)
2027
838
  - [adiwajshing](https://github.com/adiwajshing)
2028
839
 
2029
- This fork includes additional enhancements and modifications by [kaels](https://github.com/itsliaaa)
2030
-
2031
- Special thanks to [itsreimau](https://github.com/itsreimau) for the fix to the `updateBlockStatus` implementation.
840
+ Terima kasih khusus kepada:
841
+ - **[itsliaaa](https://github.com/itsliaaa)** — atas fork [`@itsliaaa/baileys`](https://www.npmjs.com/package/@itsliaaa/baileys) yang menjadi fondasi awal package ini. Maaf atas kurangnya atribusi sebelumnya.
842
+ - **[itsreimau](https://github.com/itsreimau)** — atas perbaikan implementasi `updateBlockStatus`.
843
+ - **[WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)** — upstream library yang menjadi dasar dari semuanya.
2032
844
 
2033
845
  > [!CAUTION]
846
+ > ⚠️ Modifikasi, penghapusan, atau kesalahan representasi kredit ini dilarang keras. Setiap redistribusi atau fork harus mempertahankan bagian ini dalam bentuk aslinya.