@fadzzz404/baileys 1.0.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/LICENSE +21 -0
- package/README.md +2185 -0
- package/WAProto/index.js +169661 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +53 -0
- package/lib/Defaults/index.js +147 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts +14 -0
- package/lib/Signal/Group/group-session-builder.js +64 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +96 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +57 -0
- package/lib/Signal/Group/keyhelper.d.ts +10 -0
- package/lib/Signal/Group/keyhelper.js +55 -0
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +34 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +69 -0
- package/lib/Signal/Group/sender-key-name.d.ts +17 -0
- package/lib/Signal/Group/sender-key-name.js +51 -0
- package/lib/Signal/Group/sender-key-record.d.ts +30 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-state.d.ts +38 -0
- package/lib/Signal/Group/sender-key-state.js +99 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +29 -0
- package/lib/Signal/libsignal.d.ts +3 -0
- package/lib/Signal/libsignal.js +174 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +17 -0
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +19 -0
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/web-socket-client.d.ts +12 -0
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/business.d.ts +171 -0
- package/lib/Socket/business.js +260 -0
- package/lib/Socket/chats.d.ts +267 -0
- package/lib/Socket/chats.js +983 -0
- package/lib/Socket/dugong.d.ts +254 -0
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/groups.d.ts +115 -0
- package/lib/Socket/groups.js +317 -0
- package/lib/Socket/index.d.ts +173 -0
- package/lib/Socket/index.js +11 -0
- package/lib/Socket/messages-recv.d.ts +161 -0
- package/lib/Socket/messages-recv.js +1110 -0
- package/lib/Socket/messages-send.d.ts +149 -0
- package/lib/Socket/messages-send.js +909 -0
- package/lib/Socket/newsletter.d.ts +134 -0
- package/lib/Socket/newsletter.js +325 -0
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +43 -0
- package/lib/Socket/socket.js +665 -0
- package/lib/Socket/usync.d.ts +36 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.d.ts +13 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +427 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.d.ts +110 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Call.d.ts +13 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.d.ts +102 -0
- package/lib/Types/Chat.js +4 -0
- package/lib/Types/Contact.d.ts +19 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.d.ts +157 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.d.ts +55 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.d.ts +35 -0
- package/lib/Types/Label.js +27 -0
- package/lib/Types/LabelAssociation.d.ts +29 -0
- package/lib/Types/LabelAssociation.js +9 -0
- package/lib/Types/Message.d.ts +273 -0
- package/lib/Types/Message.js +9 -0
- package/lib/Types/Newsletter.d.ts +103 -0
- package/lib/Types/Newsletter.js +38 -0
- package/lib/Types/Product.d.ts +78 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.d.ts +57 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.d.ts +111 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.d.ts +27 -0
- package/lib/Types/State.js +2 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +57 -0
- package/lib/Types/index.js +42 -0
- package/lib/Utils/auth-utils.d.ts +18 -0
- package/lib/Utils/auth-utils.js +206 -0
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.d.ts +22 -0
- package/lib/Utils/business.js +234 -0
- package/lib/Utils/chat-utils.d.ts +71 -0
- package/lib/Utils/chat-utils.js +729 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/crypto.js +151 -0
- package/lib/Utils/decode-wa-message.d.ts +19 -0
- package/lib/Utils/decode-wa-message.js +198 -0
- package/lib/Utils/event-buffer.d.ts +35 -0
- package/lib/Utils/event-buffer.js +514 -0
- package/lib/Utils/generics.d.ts +92 -0
- package/lib/Utils/generics.js +423 -0
- package/lib/Utils/history.d.ts +15 -0
- package/lib/Utils/history.js +96 -0
- package/lib/Utils/index.d.ts +17 -0
- package/lib/Utils/index.js +33 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +93 -0
- package/lib/Utils/logger.d.ts +4 -0
- package/lib/Utils/logger.js +7 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +51 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.js +43 -0
- package/lib/Utils/messages-media.d.ts +116 -0
- package/lib/Utils/messages-media.js +819 -0
- package/lib/Utils/messages.d.ts +77 -0
- package/lib/Utils/messages.js +784 -0
- package/lib/Utils/noise-handler.d.ts +21 -0
- package/lib/Utils/noise-handler.js +155 -0
- package/lib/Utils/process-message.d.ts +41 -0
- package/lib/Utils/process-message.js +321 -0
- package/lib/Utils/signal.d.ts +32 -0
- package/lib/Utils/signal.js +153 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.js +119 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +229 -0
- package/lib/WABinary/constants.d.ts +30 -0
- package/lib/WABinary/constants.js +40 -0
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.js +252 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.js +265 -0
- package/lib/WABinary/generic-utils.d.ts +17 -0
- package/lib/WABinary/generic-utils.js +198 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +21 -0
- package/lib/WABinary/jid-utils.d.ts +31 -0
- package/lib/WABinary/jid-utils.js +62 -0
- package/lib/WABinary/types.d.ts +18 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +17 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.d.ts +38 -0
- package/lib/WAM/constants.js +15350 -0
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.js +155 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.d.ts +28 -0
- package/lib/WAUSync/USyncQuery.js +89 -0
- package/lib/WAUSync/USyncUser.d.ts +12 -0
- package/lib/WAUSync/USyncUser.js +26 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +32 -0
- package/package.json +116 -0
package/README.md
ADDED
|
@@ -0,0 +1,2185 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://fadzzzcloud.gt.tc/files/file-1773932511.jpg.jpg" alt="WhatsApp Baileys" width="450"/>
|
|
3
|
+
|
|
4
|
+
<h1>WhatsApp Baileys</h1>
|
|
5
|
+
<p><strong>Lightweight, Full-Featured WhatsApp Web for Node.js</strong></p>
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://npmjs.com/package/@fadzzz404/baileys">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/@fadzzz404/baileys?color=blue&logo=npm" alt="npm version">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/fadzzz404/bail/blob/main/LICENSE">
|
|
12
|
+
<img src="https://img.shields.io/github/license/fadzzz404/bail?color=green" alt="license">
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/fadzzz404/bail/stargazers">
|
|
15
|
+
<img src="https://img.shields.io/github/stars/fadzzz404/bail?color=yellow&logo=github" alt="github stars">
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<br>
|
|
21
|
+
|
|
22
|
+
## 📚 Table of Contents
|
|
23
|
+
- [Features](#-features)
|
|
24
|
+
- [Installation](#-installation)
|
|
25
|
+
- [Quick Start](#-quick-start)
|
|
26
|
+
- [Documentation](#-documentation)
|
|
27
|
+
- [Connecting Account](#-connecting-account)
|
|
28
|
+
- [Handling Events](#-handling-events)
|
|
29
|
+
- [Sending Messages](#-sending-messages)
|
|
30
|
+
- [Groups](#-groups)
|
|
31
|
+
- [Privacy](#-privacy)
|
|
32
|
+
- [Advanced](#-advanced)
|
|
33
|
+
- [Disclaimer](#-disclaimer)
|
|
34
|
+
|
|
35
|
+
<br>
|
|
36
|
+
|
|
37
|
+
## 🌟 Features
|
|
38
|
+
- ✅ **Multi-Device Support**
|
|
39
|
+
- 🔄 **Real-Time Messaging** (text, media, polls, buttons)
|
|
40
|
+
- 🛠️ **Group & Channel Management** (create, modify, invite)
|
|
41
|
+
- 🔒 **End-to-End Encryption**
|
|
42
|
+
- 📦 **Session Persistence**
|
|
43
|
+
|
|
44
|
+
<br>
|
|
45
|
+
|
|
46
|
+
## 🔥 Updated New (19 November 2025)
|
|
47
|
+
- 🚀 Fixed Pairing
|
|
48
|
+
|
|
49
|
+
<br>
|
|
50
|
+
|
|
51
|
+
## 🌱 Important Note
|
|
52
|
+
|
|
53
|
+
The original repository was initially removed by its creator and subsequently taken over by [WhiskeySockets](https://github.com/WhiskeySockets). Building upon this foundation, I have implemented several enhancements and introduced new features that were not present in the original repository. These improvements aim to elevate functionality and provide a more robust and versatile experience.
|
|
54
|
+
<br>
|
|
55
|
+
|
|
56
|
+
## ⚡ Contact Admin
|
|
57
|
+
- [Telegram](https://t.me/cs_fadzzzdigital)
|
|
58
|
+
- [Channel](https://www.whatsapp.com/channel/0029VaxYWls5q08hTLgqKp3K)
|
|
59
|
+
- [Website Anime](https://fanime.web.id)
|
|
60
|
+
- [API Mutasi OrderKuota](https://fapayment.ct.ws)
|
|
61
|
+
|
|
62
|
+
<br>
|
|
63
|
+
|
|
64
|
+
## 📜 License
|
|
65
|
+
- This project is licensed for **personal and non-commercial use only**.
|
|
66
|
+
- Redistribution, modification, or renaming for personal purposes is allowed.
|
|
67
|
+
- **Commercial use, resale, or name-hunting is strictly prohibited.**
|
|
68
|
+
|
|
69
|
+
<br>
|
|
70
|
+
|
|
71
|
+
## 🤝 Contribution Guidelines
|
|
72
|
+
We welcome contributions to improve this project. To contribute:
|
|
73
|
+
1. Fork the repository
|
|
74
|
+
2. Create a new branch for your feature or fix
|
|
75
|
+
3. Submit a pull request with a clear explanation of the changes
|
|
76
|
+
|
|
77
|
+
All contributions will be reviewed before merging.
|
|
78
|
+
|
|
79
|
+
<br>
|
|
80
|
+
|
|
81
|
+
## 📥 Installation
|
|
82
|
+
```bash
|
|
83
|
+
npm install @fadzzz404/baileys
|
|
84
|
+
# or
|
|
85
|
+
yarn add @fadzzz404/baileys
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<br>
|
|
89
|
+
|
|
90
|
+
## 🚀 Quick Start
|
|
91
|
+
```javascript
|
|
92
|
+
const {
|
|
93
|
+
default: makeWASocket,
|
|
94
|
+
useMultiFileAuthState,
|
|
95
|
+
} = require('@fadzzz404/baileys');
|
|
96
|
+
|
|
97
|
+
const {
|
|
98
|
+
state,
|
|
99
|
+
saveCreds
|
|
100
|
+
} = await useMultiFileAuthState("./path/to/sessions/folder")
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* const sock = makeWASocket({ printQRInTerminal: true });
|
|
104
|
+
* code to get WhatsApp web connection
|
|
105
|
+
* QR code or pairing code type available
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
109
|
+
console.log('New message:', messages[0].message);
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
<br>
|
|
114
|
+
|
|
115
|
+
## 📖 Documentation
|
|
116
|
+
|
|
117
|
+
### 🔌 Connecting Account
|
|
118
|
+
<details>
|
|
119
|
+
<summary><strong>🔗 Connect with QR Code</strong></summary>
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
const sock = makeWASocket({
|
|
123
|
+
printQRInTerminal: true, // true to display QR Code
|
|
124
|
+
auth: state
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
</details>
|
|
128
|
+
|
|
129
|
+
<details>
|
|
130
|
+
<summary><strong>🔢 Connect with Pairing Code</strong></summary>
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
const sock = makeWASocket({
|
|
134
|
+
printQRInTerminal: false, // false so that the pairing code is not disturbed
|
|
135
|
+
auth: state
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
if (!sock.authState.creds.registered) {
|
|
139
|
+
const number = "62xxxx"
|
|
140
|
+
|
|
141
|
+
// use default pairing code (default 1-8)
|
|
142
|
+
const code = await sock.requestPairingCode(number)
|
|
143
|
+
|
|
144
|
+
// use customer code pairing (8 digit)
|
|
145
|
+
const customCode = "F4DZ2D3V"
|
|
146
|
+
const code = await sock.requestPairingCode(number, customCode)
|
|
147
|
+
console.log(code)
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
<br>
|
|
153
|
+
|
|
154
|
+
### 📡 Handling Events
|
|
155
|
+
<details>
|
|
156
|
+
<summary><strong>📌 Example to Start</strong></summary>
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
160
|
+
console.log('New message:', messages[0].message);
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
</details>
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary><strong>🗳️ Decrypt Poll Votes</strong></summary>
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
sock.ev.on('messages.update', (m) => {
|
|
170
|
+
if (m.pollUpdates) console.log('Poll vote:', m.pollUpdates);
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
</details>
|
|
174
|
+
|
|
175
|
+
<br>
|
|
176
|
+
|
|
177
|
+
### 📨 Sending Messages
|
|
178
|
+
|
|
179
|
+
```javascript
|
|
180
|
+
/**
|
|
181
|
+
* Sends a message using the WhatsApp socket connection.
|
|
182
|
+
*
|
|
183
|
+
* @param {string} jid - The JID (Jabber ID) of the recipient/user.
|
|
184
|
+
* This is the unique identifier for the WhatsApp user/group.
|
|
185
|
+
* @param {Object} content - The message content to be sent. Can be any valid message type
|
|
186
|
+
* (text, image, video, document, etc.) with required parameters.
|
|
187
|
+
* @param {Object} [options] - Optional parameters for message generation and sending.
|
|
188
|
+
* Can include properties like:
|
|
189
|
+
* - quoted: Message to reply to
|
|
190
|
+
* - ephemeral: If message should disappear after viewing
|
|
191
|
+
* - mediaUpload: Media upload options
|
|
192
|
+
* - etc.
|
|
193
|
+
* @returns {Promise<Object>} A promise that resolves with the sent message info or
|
|
194
|
+
* rejects with an error if sending fails.
|
|
195
|
+
*/
|
|
196
|
+
const jid = ''; // Recipient's JID (WhatsApp ID) or LID
|
|
197
|
+
const content = {}; // Message content object
|
|
198
|
+
const options = {}; // Optional message options
|
|
199
|
+
|
|
200
|
+
// Send the message using the WhatsApp socket connection
|
|
201
|
+
sock.sendMessage(jid, content, options)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
<details>
|
|
205
|
+
<summary><strong>📝 Text Message</strong></summary>
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
208
|
+
// Simple Text
|
|
209
|
+
await sock.sendMessage(jid, { text: 'Hello!' });
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
// Text with link preview
|
|
214
|
+
await sock.sendMessage(jid, {
|
|
215
|
+
text: 'Visit https://example.com',
|
|
216
|
+
linkPreview: {
|
|
217
|
+
'canonical-url': 'https://example.com',
|
|
218
|
+
title: 'Example Domain',
|
|
219
|
+
description: 'A demo website',
|
|
220
|
+
jpegThumbnail: fs.readFileSync('preview.jpg')
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
```javascript
|
|
226
|
+
// With Quoted Reply
|
|
227
|
+
await sock.sendMessage(jid, { text: 'Hello!' }, { quoted: message });
|
|
228
|
+
```
|
|
229
|
+
</details>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
<details>
|
|
233
|
+
<summary><strong>🖼️ Image Message</strong></summary>
|
|
234
|
+
|
|
235
|
+
```javascript
|
|
236
|
+
// With local file buffer
|
|
237
|
+
await sock.sendMessage(jid, {
|
|
238
|
+
image: fs.readFileSync('image.jpg'),
|
|
239
|
+
caption: 'My cat!',
|
|
240
|
+
mentions: ['1234567890@s.whatsapp.net'] // Tag users
|
|
241
|
+
});
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
```javascript
|
|
245
|
+
// With URL
|
|
246
|
+
await sock.sendMessage(jid, {
|
|
247
|
+
image: { url: 'https://example.com/image.jpg' },
|
|
248
|
+
caption: 'Downloaded image'
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
</details>
|
|
252
|
+
|
|
253
|
+
<details>
|
|
254
|
+
<summary><strong>🎥 Video Message</strong></summary>
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
// With Local File
|
|
258
|
+
await sock.sendMessage(jid, {
|
|
259
|
+
video: fs.readFileSync('video.mp4'),
|
|
260
|
+
caption: 'Funny clip!'
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
// With URL File
|
|
266
|
+
await sock.sendMessage(jid, {
|
|
267
|
+
video: { url: 'https://example.com/video.mp4' },
|
|
268
|
+
caption: 'Streamed video'
|
|
269
|
+
});
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
```javascript
|
|
273
|
+
// View Once Message
|
|
274
|
+
await sock.sendMessage(jid, {
|
|
275
|
+
video: fs.readFileSync('secret.mp4'),
|
|
276
|
+
viewOnce: true // Disappears after viewing
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
</details>
|
|
280
|
+
|
|
281
|
+
<details>
|
|
282
|
+
<summary><strong>🎵 Audio/PTT Message</strong></summary>
|
|
283
|
+
|
|
284
|
+
```javascript
|
|
285
|
+
// Regular audio
|
|
286
|
+
await sock.sendMessage(jid, {
|
|
287
|
+
audio: fs.readFileSync('audio.mp3'),
|
|
288
|
+
ptt: false // For music
|
|
289
|
+
});
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
293
|
+
// Push-to-talk (PTT)
|
|
294
|
+
await sock.sendMessage(jid, {
|
|
295
|
+
audio: fs.readFileSync('voice.ogg'),
|
|
296
|
+
ptt: true, // WhatsApp voice note
|
|
297
|
+
waveform: [0, 1, 0, 1, 0] // Optional waveform
|
|
298
|
+
});
|
|
299
|
+
```
|
|
300
|
+
</details>
|
|
301
|
+
|
|
302
|
+
<details>
|
|
303
|
+
<summary><strong>👤 Contact Message</strong></summary>
|
|
304
|
+
|
|
305
|
+
```javascript
|
|
306
|
+
const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
|
|
307
|
+
+ 'VERSION:3.0\n'
|
|
308
|
+
+ 'FN:Jeff Singh\n' // full name
|
|
309
|
+
+ 'ORG:Ashoka Uni\n' // the organization of the contact
|
|
310
|
+
+ 'TELtype=CELLtype=VOICEwaid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
|
|
311
|
+
+ 'END:VCARD'
|
|
312
|
+
|
|
313
|
+
await sock.sendMessage(jid, {
|
|
314
|
+
contacts: {
|
|
315
|
+
displayName: 'Your Name',
|
|
316
|
+
contacts: [{ vcard }]
|
|
317
|
+
}
|
|
318
|
+
})
|
|
319
|
+
```
|
|
320
|
+
</details>
|
|
321
|
+
|
|
322
|
+
<details>
|
|
323
|
+
<summary><strong>💥 React Message</strong></summary>
|
|
324
|
+
|
|
325
|
+
```javascript
|
|
326
|
+
await sock.sendMessage(jid, {
|
|
327
|
+
react: {
|
|
328
|
+
text: '👍', // use an empty string to remove the reaction
|
|
329
|
+
key: message.key
|
|
330
|
+
}
|
|
331
|
+
})
|
|
332
|
+
```
|
|
333
|
+
</details>
|
|
334
|
+
|
|
335
|
+
<details>
|
|
336
|
+
<summary><strong>📌 Pin & Keep Message</strong></summary>
|
|
337
|
+
|
|
338
|
+
| Time | Seconds |
|
|
339
|
+
|-------|----------------|
|
|
340
|
+
| 24h | 86.400 |
|
|
341
|
+
| 7d | 604.800 |
|
|
342
|
+
| 30d | 2.592.000 |
|
|
343
|
+
|
|
344
|
+
```javascript
|
|
345
|
+
// Pin Message
|
|
346
|
+
await sock.sendMessage(jid, {
|
|
347
|
+
pin: {
|
|
348
|
+
type: 1, // 2 to remove
|
|
349
|
+
time: 86400,
|
|
350
|
+
key: message.key
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
```javascript
|
|
356
|
+
// Keep message
|
|
357
|
+
await sock.sendMessage(jid, {
|
|
358
|
+
keep: {
|
|
359
|
+
key: message.key,
|
|
360
|
+
type: 1 // or 2 to remove
|
|
361
|
+
}
|
|
362
|
+
})
|
|
363
|
+
```
|
|
364
|
+
</details>
|
|
365
|
+
|
|
366
|
+
<details>
|
|
367
|
+
<summary><strong>📍 Location Message</strong></summary>
|
|
368
|
+
|
|
369
|
+
```javascript
|
|
370
|
+
// Static location
|
|
371
|
+
await sock.sendMessage(jid, {
|
|
372
|
+
location: {
|
|
373
|
+
degreesLatitude: 37.422,
|
|
374
|
+
degreesLongitude: -122.084,
|
|
375
|
+
name: 'Google HQ'
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
```javascript
|
|
381
|
+
// Thumbnail location
|
|
382
|
+
await sock.sendMessage(jid, {
|
|
383
|
+
location: {
|
|
384
|
+
degreesLatitude: 37.422,
|
|
385
|
+
degreesLongitude: -122.084,
|
|
386
|
+
name: 'Google HQ',
|
|
387
|
+
jpegThumbnail: fs.readFileSync('preview.jpg')
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
```javascript
|
|
393
|
+
// Live location (updates in real-time)
|
|
394
|
+
await sock.sendMessage(jid, {
|
|
395
|
+
location: {
|
|
396
|
+
degreesLatitude: 37.422,
|
|
397
|
+
degreesLongitude: -122.084,
|
|
398
|
+
accuracyInMeters: 10
|
|
399
|
+
},
|
|
400
|
+
live: true, // Enable live tracking
|
|
401
|
+
caption: 'I’m here!'
|
|
402
|
+
});
|
|
403
|
+
```
|
|
404
|
+
</details>
|
|
405
|
+
|
|
406
|
+
<details>
|
|
407
|
+
<summary><strong>📞 Call Message</strong></summary>
|
|
408
|
+
|
|
409
|
+
```javascript
|
|
410
|
+
await sock.sendMessage(jid, {
|
|
411
|
+
call: {
|
|
412
|
+
name: 'Here is call message',
|
|
413
|
+
type: 1 // 2 for video
|
|
414
|
+
}
|
|
415
|
+
})
|
|
416
|
+
```
|
|
417
|
+
</details>
|
|
418
|
+
|
|
419
|
+
<details>
|
|
420
|
+
<summary><strong>🗓️ Event Message</strong></summary>
|
|
421
|
+
|
|
422
|
+
```javascript
|
|
423
|
+
await sock.sendMessage(jid, {
|
|
424
|
+
event: {
|
|
425
|
+
isCanceled: false, // or true
|
|
426
|
+
name: 'Here is name event',
|
|
427
|
+
description: 'Short description here',
|
|
428
|
+
location: {
|
|
429
|
+
degreesLatitude: 0,
|
|
430
|
+
degreesLongitude: 0,
|
|
431
|
+
name: 'Gedung Tikus Kantor'
|
|
432
|
+
},
|
|
433
|
+
startTime: 17..., // timestamp date
|
|
434
|
+
endTime: 17..., // timestamp date
|
|
435
|
+
extraGuestsAllowed: true // or false
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
```
|
|
439
|
+
</details>
|
|
440
|
+
|
|
441
|
+
<details>
|
|
442
|
+
<summary><strong>🛒 Order Message</strong></summary>
|
|
443
|
+
|
|
444
|
+
```javascript
|
|
445
|
+
await sock.sendMessage(jid, {
|
|
446
|
+
order: {
|
|
447
|
+
orderId: '123xxx',
|
|
448
|
+
thumbnail: fs.readFileSync('preview.jpg'),
|
|
449
|
+
itemCount: '123',
|
|
450
|
+
status: 'INQUIRY', // INQUIRY || ACCEPTED || DECLINED
|
|
451
|
+
surface: 'CATALOG',
|
|
452
|
+
message: 'Here is order message',
|
|
453
|
+
orderTitle: 'Here is title order',
|
|
454
|
+
sellerJid: '628xxx@s.whatsapp.net'',
|
|
455
|
+
token: 'token_here',
|
|
456
|
+
totalAmount1000: '300000',
|
|
457
|
+
totalCurrencyCode: 'IDR'
|
|
458
|
+
}
|
|
459
|
+
})
|
|
460
|
+
```
|
|
461
|
+
</details>
|
|
462
|
+
|
|
463
|
+
<details>
|
|
464
|
+
<summary><strong>📊 Poll Message</strong></summary>
|
|
465
|
+
|
|
466
|
+
```javascript
|
|
467
|
+
// Create a poll
|
|
468
|
+
await sock.sendMessage(jid, {
|
|
469
|
+
poll: {
|
|
470
|
+
name: 'Favorite color?',
|
|
471
|
+
values: ['Red', 'Blue', 'Green'],
|
|
472
|
+
selectableCount: 1 // Single-choice
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
```javascript
|
|
478
|
+
// Poll results (snapshot)
|
|
479
|
+
await sock.sendMessage(jid, {
|
|
480
|
+
pollResult: {
|
|
481
|
+
name: 'Favorite color?',
|
|
482
|
+
values: [['Red', 10], ['Blue', 20]] // [option, votes]
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
```
|
|
486
|
+
</details>
|
|
487
|
+
|
|
488
|
+
<details>
|
|
489
|
+
<summary><strong>🛍️ Product Message</strong></summary>
|
|
490
|
+
|
|
491
|
+
```javascript
|
|
492
|
+
await sock.sendMessage(jid, {
|
|
493
|
+
product: {
|
|
494
|
+
productId: '123',
|
|
495
|
+
title: 'Cool T-Shirt',
|
|
496
|
+
description: '100% cotton',
|
|
497
|
+
price: 1999, // In cents (e.g., $19.99)
|
|
498
|
+
currencyCode: 'USD',
|
|
499
|
+
productImage: fs.readFileSync('shirt.jpg')
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
```
|
|
503
|
+
</details>
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
<details>
|
|
507
|
+
<summary><strong>💳 Payment Message</strong></summary>
|
|
508
|
+
|
|
509
|
+
```javascript
|
|
510
|
+
await sock.sendMessage(jid, {
|
|
511
|
+
payment: {
|
|
512
|
+
note: 'Here is payment message',
|
|
513
|
+
currency: 'USD', // optional
|
|
514
|
+
offset: 0, // optional
|
|
515
|
+
amount: '100000', // optional
|
|
516
|
+
expiry: 0, // optional
|
|
517
|
+
from: '628xxx@s.whatsapp.net', // optional
|
|
518
|
+
image: { // optional
|
|
519
|
+
placeholderArgb: "your_background", // optional
|
|
520
|
+
textArgb: "your_text", // optional
|
|
521
|
+
subtextArgb: "your_subtext" // optional
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
})
|
|
525
|
+
```
|
|
526
|
+
</details>
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
<details>
|
|
530
|
+
<summary><strong>📜 Payment Invite Message</strong></summary>
|
|
531
|
+
|
|
532
|
+
```javascript
|
|
533
|
+
await sock.sendMessage(jid, {
|
|
534
|
+
paymentInvite: {
|
|
535
|
+
type: 1, // 1 || 2 || 3
|
|
536
|
+
expiry: 0
|
|
537
|
+
}
|
|
538
|
+
})
|
|
539
|
+
```
|
|
540
|
+
</details>
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
<details>
|
|
544
|
+
<summary><strong>👤 Channel Admin Invite</strong></summary>
|
|
545
|
+
|
|
546
|
+
```javascript
|
|
547
|
+
await sock.sendMessage(jid, {
|
|
548
|
+
adminInvite: {
|
|
549
|
+
jid: '172xxx@newsletter',
|
|
550
|
+
name: 'Newsletter Title',
|
|
551
|
+
caption: 'Undangan admin channel saya',
|
|
552
|
+
expiration: 86400,
|
|
553
|
+
jpegThumbnail: fs.readFileSync('preview.jpg') // optional
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
```
|
|
557
|
+
</details>
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
<details>
|
|
561
|
+
<summary><strong>👥 Group Invite Message</strong></summary>
|
|
562
|
+
|
|
563
|
+
```javascript
|
|
564
|
+
await sock.sendMessage(jid, {
|
|
565
|
+
groupInvite: {
|
|
566
|
+
jid: '123xxx@g.us',
|
|
567
|
+
name: 'Group Name!',
|
|
568
|
+
caption: 'Invitation To Join My Whatsapp Group',
|
|
569
|
+
code: 'xYz3yAtf...', // code invite link
|
|
570
|
+
expiration: 86400,
|
|
571
|
+
jpegThumbnail: fs.readFileSync('preview.jpg') // optional
|
|
572
|
+
}
|
|
573
|
+
})
|
|
574
|
+
```
|
|
575
|
+
</details>
|
|
576
|
+
|
|
577
|
+
<details>
|
|
578
|
+
<summary><strong>🔢 Phone Number Message</strong></summary>
|
|
579
|
+
|
|
580
|
+
```javascript
|
|
581
|
+
// Request phone number
|
|
582
|
+
await sock.sendMessage(jid, {
|
|
583
|
+
requestPhoneNumber: {}
|
|
584
|
+
})
|
|
585
|
+
```
|
|
586
|
+
```javascript
|
|
587
|
+
// Share phone number
|
|
588
|
+
await sock.sendMessage(jid, {
|
|
589
|
+
sharePhoneNumber: {}
|
|
590
|
+
})
|
|
591
|
+
```
|
|
592
|
+
</details>
|
|
593
|
+
|
|
594
|
+
<details>
|
|
595
|
+
<summary><strong>↪️ Reply Button Message</strong></summary>
|
|
596
|
+
|
|
597
|
+
```javascript
|
|
598
|
+
// Reply List Message
|
|
599
|
+
await sock.sendMessage(jid, {
|
|
600
|
+
buttonReply: {
|
|
601
|
+
name: 'Hii',
|
|
602
|
+
description: 'description',
|
|
603
|
+
rowId: 'ID'
|
|
604
|
+
},
|
|
605
|
+
type: 'list'
|
|
606
|
+
})
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
```javascript
|
|
610
|
+
// Reply Button Message
|
|
611
|
+
await sock.sendMessage(jid, {
|
|
612
|
+
buttonReply: {
|
|
613
|
+
displayText: 'Hii',
|
|
614
|
+
id: 'ID'
|
|
615
|
+
},
|
|
616
|
+
type: 'plain'
|
|
617
|
+
})
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
```javascript
|
|
621
|
+
// Reply Template Message
|
|
622
|
+
await sock.sendMessage(jid, {
|
|
623
|
+
buttonReply: {
|
|
624
|
+
displayText: 'Hii',
|
|
625
|
+
id: 'ID',
|
|
626
|
+
index: 1 // number id button reply
|
|
627
|
+
},
|
|
628
|
+
type: 'template'
|
|
629
|
+
})
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
```javascript
|
|
633
|
+
// Reply Interactive Message
|
|
634
|
+
await sock.sendMessage(jid, {
|
|
635
|
+
buttonReply: {
|
|
636
|
+
body: 'Hii',
|
|
637
|
+
nativeFlows: {
|
|
638
|
+
name: 'menu_options',
|
|
639
|
+
paramsJson: JSON.stringify({ id: 'ID', description: 'description' })
|
|
640
|
+
version: 1 // 2 | 3
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
type: 'interactive'
|
|
644
|
+
})
|
|
645
|
+
```
|
|
646
|
+
</details>
|
|
647
|
+
|
|
648
|
+
<details>
|
|
649
|
+
<summary><strong>#️⃣ Status Mentions Message</strong></summary>
|
|
650
|
+
|
|
651
|
+
```javascript
|
|
652
|
+
await sock.sendStatusMentions({
|
|
653
|
+
image: {
|
|
654
|
+
url: 'https://example.com/image.jpg'
|
|
655
|
+
},
|
|
656
|
+
caption: 'Nice day!'
|
|
657
|
+
}, ["123@s.whatsapp.net", "123@s.whatsapp.net"])
|
|
658
|
+
```
|
|
659
|
+
</details>
|
|
660
|
+
|
|
661
|
+
<details>
|
|
662
|
+
<summary><strong>📸 Album Message</strong></summary>
|
|
663
|
+
|
|
664
|
+
```javascript
|
|
665
|
+
await sock.sendAlbumMessage(jid,
|
|
666
|
+
[{
|
|
667
|
+
image: { url: 'https://example.com/image.jpg' },
|
|
668
|
+
caption: 'Hello World'
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
image: fs.readFileSync('image.jpg'),
|
|
672
|
+
caption: 'Hello World'
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
video: { url: 'https://example.com/video.mp4' },
|
|
676
|
+
caption: 'Hello World'
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
video: fs.readFileSync('video.mp4'),
|
|
680
|
+
caption: 'Hello World'
|
|
681
|
+
}],
|
|
682
|
+
{ quoted: message, delay: 3000 })
|
|
683
|
+
```
|
|
684
|
+
</details>
|
|
685
|
+
|
|
686
|
+
<details>
|
|
687
|
+
<summary><strong>👨💻 Interactive Message</strong></summary>
|
|
688
|
+
|
|
689
|
+
> This is an interactive chat created based on Proto WhatsApp business data, if the message does not work then there may be a change in the buttonParamsJson structure.
|
|
690
|
+
|
|
691
|
+
<details>
|
|
692
|
+
<summary><strong>Shop Flow Message</strong></summary>
|
|
693
|
+
|
|
694
|
+
<div align="center">
|
|
695
|
+
<img src="https://files.catbox.moe/pdeeq8.png" alt="Example Shop Message" width="450"/>
|
|
696
|
+
<p>Preview the shop message display, usually used to direct customers to the Facebook page or account.</td>
|
|
697
|
+
</div>
|
|
698
|
+
|
|
699
|
+
```javascript
|
|
700
|
+
// Headers Text
|
|
701
|
+
await sock.sendMessage(jid, {
|
|
702
|
+
text: 'Here is body message',
|
|
703
|
+
title: 'Here is title',
|
|
704
|
+
subtitle: 'Here is subtitle',
|
|
705
|
+
footer: '© WhatsApp Baileys',
|
|
706
|
+
viewOnce: true,
|
|
707
|
+
shop: {
|
|
708
|
+
surface: 1, // 2 | 3 | 4
|
|
709
|
+
id: 'facebook_store_name'
|
|
710
|
+
}
|
|
711
|
+
})
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
```javascript
|
|
715
|
+
// Headers Image
|
|
716
|
+
await sock.sendMessage(jid, {
|
|
717
|
+
image: {
|
|
718
|
+
url: 'https://www.example.com/image.jpg'
|
|
719
|
+
},
|
|
720
|
+
caption: 'Here is body message',
|
|
721
|
+
title: 'Here is title',
|
|
722
|
+
subtitle: 'Here is subtitle',
|
|
723
|
+
footer: '© WhatsApp Baileys',
|
|
724
|
+
shop: {
|
|
725
|
+
surface: 1, // 2 | 3 | 4
|
|
726
|
+
id: 'facebook_store_name'
|
|
727
|
+
},
|
|
728
|
+
hasMediaAttachment: true, // or false
|
|
729
|
+
viewOnce: true
|
|
730
|
+
})
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
```javascript
|
|
734
|
+
// Headers Video
|
|
735
|
+
await sock.sendMessage(jid, {
|
|
736
|
+
video: {
|
|
737
|
+
url: 'https://www.example.com/video.mp4'
|
|
738
|
+
},
|
|
739
|
+
caption: 'Here is body message',
|
|
740
|
+
title: 'Here is title',
|
|
741
|
+
subtitle: 'Here is subtitle',
|
|
742
|
+
footer: '© WhatsApp Baileys',
|
|
743
|
+
shop: {
|
|
744
|
+
surface: 1, // 2 | 3 | 4
|
|
745
|
+
id: 'facebook_store_name'
|
|
746
|
+
},
|
|
747
|
+
hasMediaAttachment: true, // or false
|
|
748
|
+
viewOnce: true
|
|
749
|
+
})
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
```javascript
|
|
753
|
+
// Headers Document
|
|
754
|
+
await sock.sendMessage(jid, {
|
|
755
|
+
document: {
|
|
756
|
+
url: 'https://www.example.com/document.pdf'
|
|
757
|
+
},
|
|
758
|
+
mimetype: 'application/pdf',
|
|
759
|
+
jpegThumbnail: await sock.resize('https://www.example.com/thumbnail.jpg', 320, 320),
|
|
760
|
+
caption: 'Here is body message',
|
|
761
|
+
title: 'Here is title',
|
|
762
|
+
subtitle: 'Here is subtitle',
|
|
763
|
+
footer: '© WhatsApp Baileys',
|
|
764
|
+
shop: {
|
|
765
|
+
surface: 1, // 2 | 3 | 4
|
|
766
|
+
id: 'facebook_store_name'
|
|
767
|
+
},
|
|
768
|
+
hasMediaAttachment: false, // or true,
|
|
769
|
+
viewOnce: true
|
|
770
|
+
})
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
```javascript
|
|
774
|
+
// Headers Location
|
|
775
|
+
await sock.sendMessage(jid, {
|
|
776
|
+
location: {
|
|
777
|
+
degressLatitude: -0,
|
|
778
|
+
degressLongitude: 0,
|
|
779
|
+
name: 'Example Location'
|
|
780
|
+
},
|
|
781
|
+
caption: 'Here is body message',
|
|
782
|
+
title: 'Here is title',
|
|
783
|
+
subtitle: 'Here is subtitle',
|
|
784
|
+
footer: '© WhatsApp Baileys',
|
|
785
|
+
shop: {
|
|
786
|
+
surface: 1, // 2 | 3 | 4
|
|
787
|
+
id: 'facebook_store_name'
|
|
788
|
+
},
|
|
789
|
+
hasMediaAttachment: false, // or true
|
|
790
|
+
viewOnce: true
|
|
791
|
+
})
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
```javascript
|
|
795
|
+
// Headers Product
|
|
796
|
+
await sock.sendMessage(jid, {
|
|
797
|
+
product: {
|
|
798
|
+
productImage: {
|
|
799
|
+
url: 'https://www.example.com/product.jpg'
|
|
800
|
+
},
|
|
801
|
+
productId: '23942543532047956', // catalog business ID
|
|
802
|
+
title: 'Example Product',
|
|
803
|
+
description: 'Example Product Description',
|
|
804
|
+
currencyCode: 'IDR',
|
|
805
|
+
priceAmount1000: '2000000',
|
|
806
|
+
retailerId: 'ExampleRetailer',
|
|
807
|
+
url: 'https://www.example.com/product',
|
|
808
|
+
productImageCount: 1
|
|
809
|
+
},
|
|
810
|
+
businessOwnerJid: '628xxx@s.whatsapp.net',
|
|
811
|
+
caption: 'Here is body message',
|
|
812
|
+
title: 'Here is title',
|
|
813
|
+
subtitle: 'Here is subtitle',
|
|
814
|
+
footer: '© WhatsApp Baileys',
|
|
815
|
+
shop: {
|
|
816
|
+
surface: 1, // 2 | 3 | 4
|
|
817
|
+
id: 'facebook_store_name'
|
|
818
|
+
},
|
|
819
|
+
hasMediaAttachment: false, // or true
|
|
820
|
+
viewOnce: true
|
|
821
|
+
})
|
|
822
|
+
```
|
|
823
|
+
</details>
|
|
824
|
+
|
|
825
|
+
<details>
|
|
826
|
+
<summary><strong>Carosell Message</strong></summary>
|
|
827
|
+
|
|
828
|
+
<div align="center">
|
|
829
|
+
<img src="https://files.catbox.moe/cf3hxd.png" alt="Example Carosell Message" width="450"/>
|
|
830
|
+
<p>Preview the carosel message display, a scrollable message card that displays various items.</td>
|
|
831
|
+
</div>
|
|
832
|
+
|
|
833
|
+
```javascript
|
|
834
|
+
await sock.sendMessage(jid, {
|
|
835
|
+
text: 'Here is body message',
|
|
836
|
+
title: 'Here is title',
|
|
837
|
+
subtile: 'Here is subtitle',
|
|
838
|
+
footer: '© WhatsApp baileys',
|
|
839
|
+
cards: [{
|
|
840
|
+
image: { url: 'https://www.example.com/image.jpg' }, // or buffer
|
|
841
|
+
title: 'The title cards',
|
|
842
|
+
body: 'The body cards',
|
|
843
|
+
footer: '© WhatsApp',
|
|
844
|
+
buttons: [{
|
|
845
|
+
name: 'quick_reply',
|
|
846
|
+
buttonParamsJson: JSON.stringify({
|
|
847
|
+
display_text: 'Display Text',
|
|
848
|
+
id: '123'
|
|
849
|
+
})
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
name: 'cta_url',
|
|
853
|
+
buttonParamsJson: JSON.stringify({
|
|
854
|
+
display_text: 'Display Text',
|
|
855
|
+
url: 'https://www.example.com'
|
|
856
|
+
})
|
|
857
|
+
}]
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
video: { url: 'https://www.example.com/video.mp4' }, // or buffer
|
|
861
|
+
title: 'The title cards 2',
|
|
862
|
+
body: 'The body cards 2',
|
|
863
|
+
footer: '© WhatsApp',
|
|
864
|
+
buttons: [{
|
|
865
|
+
name: 'quick_reply',
|
|
866
|
+
buttonParamsJson: JSON.stringify({
|
|
867
|
+
display_text: 'Display Text',
|
|
868
|
+
id: 'ID'
|
|
869
|
+
})
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
name: 'cta_url',
|
|
873
|
+
buttonParamsJson: JSON.stringify({
|
|
874
|
+
display_text: 'Display Text',
|
|
875
|
+
url: 'https://www.example.com'
|
|
876
|
+
})
|
|
877
|
+
}]
|
|
878
|
+
}]
|
|
879
|
+
})
|
|
880
|
+
```
|
|
881
|
+
</details>
|
|
882
|
+
|
|
883
|
+
<details>
|
|
884
|
+
<summary><strong>Native Flow Message</strong></summary>
|
|
885
|
+
|
|
886
|
+
> Native flow messages are used to display various types of button messages, even for flow dialogs. These buttons are easy to use and are often able to accommodate many parameters.
|
|
887
|
+
|
|
888
|
+
<details>
|
|
889
|
+
<summary><strong>header_type</strong></summary>
|
|
890
|
+
|
|
891
|
+
```javascript
|
|
892
|
+
// Headers text
|
|
893
|
+
await sock.sendMessage(jid, {
|
|
894
|
+
text: 'This is body message!',
|
|
895
|
+
title: 'This is title',
|
|
896
|
+
subtitle: 'This is subtitle',
|
|
897
|
+
footer: '© WhatsApp Baileys',
|
|
898
|
+
interactive: native_flow_button
|
|
899
|
+
})
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
```javascript
|
|
903
|
+
// Headers image
|
|
904
|
+
await sock.sendMessage(jid, {
|
|
905
|
+
image: { url: 'https://www.example.com/image.jpg' },
|
|
906
|
+
caption: 'This is body message!',
|
|
907
|
+
title: 'This is title',
|
|
908
|
+
subtitle: 'This is subtitle',
|
|
909
|
+
footer: '© WhatsApp Baileys',
|
|
910
|
+
hasMediaAttachment: true,
|
|
911
|
+
interactive: native_flow_button
|
|
912
|
+
})
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
```javascript
|
|
916
|
+
// Headers Video
|
|
917
|
+
await sock.sendMessage(jid, {
|
|
918
|
+
video: { url: 'https://www.example.com/video.mp4' },
|
|
919
|
+
caption: 'This is body message!',
|
|
920
|
+
title: 'This is title',
|
|
921
|
+
subtitle: 'This is subtitle',
|
|
922
|
+
footer: '© WhatsApp Baileys',
|
|
923
|
+
hasMediaAttachment: true,
|
|
924
|
+
interactive: native_flow_button
|
|
925
|
+
})
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
```javascript
|
|
929
|
+
// Headers Document
|
|
930
|
+
await sock.sendMessage(jid, {
|
|
931
|
+
document: { url: 'https://www.example.com/document.pdf' },
|
|
932
|
+
jpegThumbnail: fs.readFileSync('preview.jpg'),
|
|
933
|
+
mimetype: 'application/pdf',
|
|
934
|
+
caption: 'This is body message!',
|
|
935
|
+
title: 'This is title',
|
|
936
|
+
subtitle: 'This is subtitle',
|
|
937
|
+
footer: '© WhatsApp Baileys',
|
|
938
|
+
hasMediaAttachment: true,
|
|
939
|
+
interactive: native_flow_button
|
|
940
|
+
})
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
```javascript
|
|
944
|
+
// Headers Location
|
|
945
|
+
await sock.sendMessage(jid, {
|
|
946
|
+
location: {
|
|
947
|
+
degressLatitude: -0,
|
|
948
|
+
degressLongitude: 0,
|
|
949
|
+
name: 'Here is name location'
|
|
950
|
+
},
|
|
951
|
+
caption: 'This is body message!',
|
|
952
|
+
title: 'This is title',
|
|
953
|
+
subtitle: 'This is subtitle',
|
|
954
|
+
footer: '© WhatsApp Baileys',
|
|
955
|
+
hasMediaAttachment: true,
|
|
956
|
+
interactive: native_flow_button
|
|
957
|
+
})
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
```javascript
|
|
961
|
+
// Headers Product
|
|
962
|
+
await sock.sendMessage(jid, {
|
|
963
|
+
product: {
|
|
964
|
+
productImage: {
|
|
965
|
+
url: 'https://www.example.com/product.jpg'
|
|
966
|
+
},
|
|
967
|
+
productId: '23942543532047956', // catalog business ID
|
|
968
|
+
title: 'Example Product',
|
|
969
|
+
description: 'Example Product Description',
|
|
970
|
+
currencyCode: 'IDR',
|
|
971
|
+
priceAmount1000: '2000000',
|
|
972
|
+
retailerId: 'ExampleRetailer',
|
|
973
|
+
url: 'https://www.example.com/product',
|
|
974
|
+
productImageCount: 1
|
|
975
|
+
},
|
|
976
|
+
businessOwnerJid: '628xxx@s.whatsapp.net',
|
|
977
|
+
caption: 'This is body message!',
|
|
978
|
+
title: 'This is title',
|
|
979
|
+
subtitle: 'This is subtitle',
|
|
980
|
+
footer: '© WhatsApp Baileys',
|
|
981
|
+
hasMediaAttachment: true,
|
|
982
|
+
interactive: native_flow_button
|
|
983
|
+
})
|
|
984
|
+
```
|
|
985
|
+
</details>
|
|
986
|
+
|
|
987
|
+
<details>
|
|
988
|
+
<summary><strong>native_flow_button</strong></summary>
|
|
989
|
+
|
|
990
|
+
<table border="1">
|
|
991
|
+
<thead>
|
|
992
|
+
<tr>
|
|
993
|
+
<th>display_flow_thumb</th>
|
|
994
|
+
<th>native_flow</th>
|
|
995
|
+
</tr>
|
|
996
|
+
</thead>
|
|
997
|
+
<tbody>
|
|
998
|
+
<tr>
|
|
999
|
+
<td>
|
|
1000
|
+
<img src="https://files.catbox.moe/n3wqck.png" alt="Quick Reply" width="300">
|
|
1001
|
+
</td>
|
|
1002
|
+
<td>
|
|
1003
|
+
quick_reply
|
|
1004
|
+
</td>
|
|
1005
|
+
</tr>
|
|
1006
|
+
</tbody>
|
|
1007
|
+
</table>
|
|
1008
|
+
|
|
1009
|
+
```javascript
|
|
1010
|
+
const native_flow_button = [{
|
|
1011
|
+
name: 'quick_reply',
|
|
1012
|
+
buttonParamsJson: JSON.stringify({
|
|
1013
|
+
display_text: 'Quick Reply',
|
|
1014
|
+
id: '123'
|
|
1015
|
+
})
|
|
1016
|
+
}]
|
|
1017
|
+
```
|
|
1018
|
+
---
|
|
1019
|
+
|
|
1020
|
+
<table border="1">
|
|
1021
|
+
<thead>
|
|
1022
|
+
<tr>
|
|
1023
|
+
<th>display_flow_thumb</th>
|
|
1024
|
+
<th>native_flow</th>
|
|
1025
|
+
</tr>
|
|
1026
|
+
</thead>
|
|
1027
|
+
<tbody>
|
|
1028
|
+
<tr>
|
|
1029
|
+
<td>
|
|
1030
|
+
<img src="https://files.catbox.moe/0bbxj0.png" alt="CTA URL" width="300">
|
|
1031
|
+
</td>
|
|
1032
|
+
<td>
|
|
1033
|
+
cta_url
|
|
1034
|
+
</td>
|
|
1035
|
+
</tr>
|
|
1036
|
+
</tbody>
|
|
1037
|
+
</table>
|
|
1038
|
+
|
|
1039
|
+
```javascript
|
|
1040
|
+
const native_flow_button = [{
|
|
1041
|
+
name: 'cta_url',
|
|
1042
|
+
buttonParamsJson: JSON.stringify({
|
|
1043
|
+
display_text: 'Action URL',
|
|
1044
|
+
url: 'https://www.example.com',
|
|
1045
|
+
merchant_url: 'https://www.example.com'
|
|
1046
|
+
})
|
|
1047
|
+
}]
|
|
1048
|
+
```
|
|
1049
|
+
---
|
|
1050
|
+
|
|
1051
|
+
<table border="1">
|
|
1052
|
+
<thead>
|
|
1053
|
+
<tr>
|
|
1054
|
+
<th>display_flow_thumb</th>
|
|
1055
|
+
<th>native_flow</th>
|
|
1056
|
+
</tr>
|
|
1057
|
+
</thead>
|
|
1058
|
+
<tbody>
|
|
1059
|
+
<tr>
|
|
1060
|
+
<td>
|
|
1061
|
+
<img src="https://files.catbox.moe/8vgfcw.png" alt="CTA Copy" width="300">
|
|
1062
|
+
</td>
|
|
1063
|
+
<td>
|
|
1064
|
+
cta_copy
|
|
1065
|
+
</td>
|
|
1066
|
+
</tr>
|
|
1067
|
+
</tbody>
|
|
1068
|
+
</table>
|
|
1069
|
+
|
|
1070
|
+
```javascript
|
|
1071
|
+
const native_flow_button = [{
|
|
1072
|
+
name: 'cta_copy',
|
|
1073
|
+
buttonParamsJson: JSON.stringify({
|
|
1074
|
+
display_text: 'Action Copy',
|
|
1075
|
+
copy_code: '12345678'
|
|
1076
|
+
})
|
|
1077
|
+
}]
|
|
1078
|
+
```
|
|
1079
|
+
---
|
|
1080
|
+
|
|
1081
|
+
<table border="1">
|
|
1082
|
+
<thead>
|
|
1083
|
+
<tr>
|
|
1084
|
+
<th>display_flow_thumb</th>
|
|
1085
|
+
<th>native_flow</th>
|
|
1086
|
+
</tr>
|
|
1087
|
+
</thead>
|
|
1088
|
+
<tbody>
|
|
1089
|
+
<tr>
|
|
1090
|
+
<td>
|
|
1091
|
+
<img src="https://files.catbox.moe/ftvx6v.png" alt="CTA Call" width="300">
|
|
1092
|
+
</td>
|
|
1093
|
+
<td>
|
|
1094
|
+
cta_call
|
|
1095
|
+
</td>
|
|
1096
|
+
</tr>
|
|
1097
|
+
</tbody>
|
|
1098
|
+
</table>
|
|
1099
|
+
|
|
1100
|
+
```javascript
|
|
1101
|
+
const native_flow_button = [{
|
|
1102
|
+
name: 'cta_call',
|
|
1103
|
+
buttonParamsJson: JSON.stringify({
|
|
1104
|
+
display_text: 'Action Call',
|
|
1105
|
+
phone_number: '628xxx'
|
|
1106
|
+
})
|
|
1107
|
+
}]
|
|
1108
|
+
```
|
|
1109
|
+
---
|
|
1110
|
+
|
|
1111
|
+
<table border="1">
|
|
1112
|
+
<thead>
|
|
1113
|
+
<tr>
|
|
1114
|
+
<th>display_flow_thumb</th>
|
|
1115
|
+
<th>native_flow</th>
|
|
1116
|
+
</tr>
|
|
1117
|
+
</thead>
|
|
1118
|
+
<tbody>
|
|
1119
|
+
<tr>
|
|
1120
|
+
<td>
|
|
1121
|
+
<img src="https://files.catbox.moe/hpswwj.png" alt="CTA Catalog" width="300">
|
|
1122
|
+
</td>
|
|
1123
|
+
<td>
|
|
1124
|
+
cta_catalog
|
|
1125
|
+
</td>
|
|
1126
|
+
</tr>
|
|
1127
|
+
</tbody>
|
|
1128
|
+
</table>
|
|
1129
|
+
|
|
1130
|
+
```javascript
|
|
1131
|
+
const native_flow_button = [{
|
|
1132
|
+
name: 'cta_catalog',
|
|
1133
|
+
buttonParamsJson: JSON.stringify({
|
|
1134
|
+
business_phone_number: '628xxx'
|
|
1135
|
+
})
|
|
1136
|
+
}]
|
|
1137
|
+
```
|
|
1138
|
+
---
|
|
1139
|
+
|
|
1140
|
+
<table border="1">
|
|
1141
|
+
<thead>
|
|
1142
|
+
<tr>
|
|
1143
|
+
<th>display_flow_thumb</th>
|
|
1144
|
+
<th>native_flow</th>
|
|
1145
|
+
</tr>
|
|
1146
|
+
</thead>
|
|
1147
|
+
<tbody>
|
|
1148
|
+
<tr>
|
|
1149
|
+
<td>
|
|
1150
|
+
<img src="https://files.catbox.moe/buia02.png" alt="CTA Reminder" width="300">
|
|
1151
|
+
</td>
|
|
1152
|
+
<td>
|
|
1153
|
+
cta_reminder
|
|
1154
|
+
</td>
|
|
1155
|
+
</tr>
|
|
1156
|
+
</tbody>
|
|
1157
|
+
</table>
|
|
1158
|
+
|
|
1159
|
+
```javascript
|
|
1160
|
+
const native_flow_button = [{
|
|
1161
|
+
name: 'cta_reminder',
|
|
1162
|
+
buttonParamsJson: JSON.stringify({
|
|
1163
|
+
display_text: 'Action Reminder'
|
|
1164
|
+
})
|
|
1165
|
+
}]
|
|
1166
|
+
```
|
|
1167
|
+
---
|
|
1168
|
+
|
|
1169
|
+
<table border="1">
|
|
1170
|
+
<thead>
|
|
1171
|
+
<tr>
|
|
1172
|
+
<th>display_flow_thumb</th>
|
|
1173
|
+
<th>native_flow</th>
|
|
1174
|
+
</tr>
|
|
1175
|
+
</thead>
|
|
1176
|
+
<tbody>
|
|
1177
|
+
<tr>
|
|
1178
|
+
<td>
|
|
1179
|
+
<img src="https://files.catbox.moe/mhhqrc.png" alt="CTA Reminder" width="300">
|
|
1180
|
+
</td>
|
|
1181
|
+
<td>
|
|
1182
|
+
cta_cancel_reminder
|
|
1183
|
+
</td>
|
|
1184
|
+
</tr>
|
|
1185
|
+
</tbody>
|
|
1186
|
+
</table>
|
|
1187
|
+
|
|
1188
|
+
```javascript
|
|
1189
|
+
const native_flow_button = [{
|
|
1190
|
+
name: 'cta_cancel_reminder',
|
|
1191
|
+
buttonParamsJson: JSON.stringify({
|
|
1192
|
+
display_text: 'Action Unreminder'
|
|
1193
|
+
})
|
|
1194
|
+
}]
|
|
1195
|
+
```
|
|
1196
|
+
---
|
|
1197
|
+
|
|
1198
|
+
<table border="1">
|
|
1199
|
+
<thead>
|
|
1200
|
+
<tr>
|
|
1201
|
+
<th>display_flow_thumb</th>
|
|
1202
|
+
<th>native_flow</th>
|
|
1203
|
+
</tr>
|
|
1204
|
+
</thead>
|
|
1205
|
+
<tbody>
|
|
1206
|
+
<tr>
|
|
1207
|
+
<td>
|
|
1208
|
+
<img src="https://files.catbox.moe/gktote.png" alt="Address Message" width="300">
|
|
1209
|
+
</td>
|
|
1210
|
+
<td>
|
|
1211
|
+
address_message
|
|
1212
|
+
</td>
|
|
1213
|
+
</tr>
|
|
1214
|
+
</tbody>
|
|
1215
|
+
</table>
|
|
1216
|
+
|
|
1217
|
+
```javascript
|
|
1218
|
+
const native_flow_button = [{
|
|
1219
|
+
name: 'address_message',
|
|
1220
|
+
buttonParamsJson: JSON.stringify({
|
|
1221
|
+
display_text: 'Form Location'
|
|
1222
|
+
})
|
|
1223
|
+
}]
|
|
1224
|
+
```
|
|
1225
|
+
---
|
|
1226
|
+
|
|
1227
|
+
<table border="1">
|
|
1228
|
+
<thead>
|
|
1229
|
+
<tr>
|
|
1230
|
+
<th>display_flow_thumb</th>
|
|
1231
|
+
<th>native_flow</th>
|
|
1232
|
+
</tr>
|
|
1233
|
+
</thead>
|
|
1234
|
+
<tbody>
|
|
1235
|
+
<tr>
|
|
1236
|
+
<td>
|
|
1237
|
+
<img src="https://files.catbox.moe/amzsvv.png" alt="Send Location" width="300">
|
|
1238
|
+
</td>
|
|
1239
|
+
<td>
|
|
1240
|
+
send_location
|
|
1241
|
+
</td>
|
|
1242
|
+
</tr>
|
|
1243
|
+
</tbody>
|
|
1244
|
+
</table>
|
|
1245
|
+
|
|
1246
|
+
```javascript
|
|
1247
|
+
const native_flow_button = [{
|
|
1248
|
+
name: 'send_location',
|
|
1249
|
+
buttonParamsJson: JSON.stringify({
|
|
1250
|
+
display_text: 'Send Location'
|
|
1251
|
+
})
|
|
1252
|
+
}]
|
|
1253
|
+
```
|
|
1254
|
+
---
|
|
1255
|
+
|
|
1256
|
+
<table border="1">
|
|
1257
|
+
<thead>
|
|
1258
|
+
<tr>
|
|
1259
|
+
<th>display_flow_thumb</th>
|
|
1260
|
+
<th>native_flow</th>
|
|
1261
|
+
</tr>
|
|
1262
|
+
</thead>
|
|
1263
|
+
<tbody>
|
|
1264
|
+
<tr>
|
|
1265
|
+
<td>
|
|
1266
|
+
<img src="https://files.catbox.moe/hpswwj.png" alt="Open Web Views" width="300">
|
|
1267
|
+
</td>
|
|
1268
|
+
<td>
|
|
1269
|
+
open_webview
|
|
1270
|
+
</td>
|
|
1271
|
+
</tr>
|
|
1272
|
+
</tbody>
|
|
1273
|
+
</table>
|
|
1274
|
+
|
|
1275
|
+
```javascript
|
|
1276
|
+
const native_flow_button = [{
|
|
1277
|
+
name: 'open_webview',
|
|
1278
|
+
buttonParamsJson: JSON.stringify({
|
|
1279
|
+
title: 'URL Web View',
|
|
1280
|
+
link: {
|
|
1281
|
+
in_app_webview: true, // or false
|
|
1282
|
+
url: 'https://www.example.com'
|
|
1283
|
+
}
|
|
1284
|
+
})
|
|
1285
|
+
}]
|
|
1286
|
+
```
|
|
1287
|
+
---
|
|
1288
|
+
|
|
1289
|
+
<table border="1">
|
|
1290
|
+
<thead>
|
|
1291
|
+
<tr>
|
|
1292
|
+
<th>display_flow_thumb</th>
|
|
1293
|
+
<th>native_flow</th>
|
|
1294
|
+
</tr>
|
|
1295
|
+
</thead>
|
|
1296
|
+
<tbody>
|
|
1297
|
+
<tr>
|
|
1298
|
+
<td>
|
|
1299
|
+
<img src="https://files.catbox.moe/1zv71s.png" alt="Multi Product Message" width="300">
|
|
1300
|
+
</td>
|
|
1301
|
+
<td>
|
|
1302
|
+
mpm
|
|
1303
|
+
</td>
|
|
1304
|
+
</tr>
|
|
1305
|
+
</tbody>
|
|
1306
|
+
</table>
|
|
1307
|
+
|
|
1308
|
+
```javascript
|
|
1309
|
+
const native_flow_button = [{
|
|
1310
|
+
name: 'mpm',
|
|
1311
|
+
buttonParamsJson: JSON.stringify({
|
|
1312
|
+
product_id: '23942543532047956'
|
|
1313
|
+
})
|
|
1314
|
+
}]
|
|
1315
|
+
```
|
|
1316
|
+
---
|
|
1317
|
+
|
|
1318
|
+
<table border="1">
|
|
1319
|
+
<thead>
|
|
1320
|
+
<tr>
|
|
1321
|
+
<th>display_flow_thumb</th>
|
|
1322
|
+
<th>native_flow</th>
|
|
1323
|
+
</tr>
|
|
1324
|
+
</thead>
|
|
1325
|
+
<tbody>
|
|
1326
|
+
<tr>
|
|
1327
|
+
<td>
|
|
1328
|
+
<img src="https://files.catbox.moe/b41mfc.png" alt="Transaction Details" width="300">
|
|
1329
|
+
</td>
|
|
1330
|
+
<td>
|
|
1331
|
+
wa_payment_transaction_details
|
|
1332
|
+
</td>
|
|
1333
|
+
</tr>
|
|
1334
|
+
</tbody>
|
|
1335
|
+
</table>
|
|
1336
|
+
|
|
1337
|
+
```javascript
|
|
1338
|
+
const native_flow_button = [{
|
|
1339
|
+
name: 'wa_payment_transaction_details',
|
|
1340
|
+
buttonParamsJson: JSON.stringify({
|
|
1341
|
+
transaction_id: '12345848'
|
|
1342
|
+
})
|
|
1343
|
+
}]
|
|
1344
|
+
```
|
|
1345
|
+
---
|
|
1346
|
+
|
|
1347
|
+
<table border="1">
|
|
1348
|
+
<thead>
|
|
1349
|
+
<tr>
|
|
1350
|
+
<th>display_flow_thumb</th>
|
|
1351
|
+
<th>native_flow</th>
|
|
1352
|
+
</tr>
|
|
1353
|
+
</thead>
|
|
1354
|
+
<tbody>
|
|
1355
|
+
<tr>
|
|
1356
|
+
<td>
|
|
1357
|
+
<img src="https://files.catbox.moe/krp9fv.png" alt="Greeting Message" width="300">
|
|
1358
|
+
</td>
|
|
1359
|
+
<td>
|
|
1360
|
+
automated_greeting_message_view_catalog
|
|
1361
|
+
</td>
|
|
1362
|
+
</tr>
|
|
1363
|
+
</tbody>
|
|
1364
|
+
</table>
|
|
1365
|
+
|
|
1366
|
+
```javascript
|
|
1367
|
+
const native_flow_button = [{
|
|
1368
|
+
name: 'automated_greeting_message_view_catalog',
|
|
1369
|
+
buttonParamsJson: JSON.stringify({
|
|
1370
|
+
business_phone_number: '628xxx',
|
|
1371
|
+
catalog_product_id: '23942543532047956'
|
|
1372
|
+
})
|
|
1373
|
+
}]
|
|
1374
|
+
```
|
|
1375
|
+
---
|
|
1376
|
+
|
|
1377
|
+
<table border="1">
|
|
1378
|
+
<thead>
|
|
1379
|
+
<tr>
|
|
1380
|
+
<th>display_flow_thumb</th>
|
|
1381
|
+
<th>native_flow</th>
|
|
1382
|
+
</tr>
|
|
1383
|
+
</thead>
|
|
1384
|
+
<tbody>
|
|
1385
|
+
<tr>
|
|
1386
|
+
<td>
|
|
1387
|
+
<img src="https://files.catbox.moe/vuqvmx.png" alt="Form Message" width="300">
|
|
1388
|
+
</td>
|
|
1389
|
+
<td>
|
|
1390
|
+
galaxy_message
|
|
1391
|
+
</td>
|
|
1392
|
+
</tr>
|
|
1393
|
+
</tbody>
|
|
1394
|
+
</table>
|
|
1395
|
+
|
|
1396
|
+
```javascript
|
|
1397
|
+
const native_flow_button = [{
|
|
1398
|
+
name: 'galaxy_message',
|
|
1399
|
+
buttonParamsJson: JSON.stringify({
|
|
1400
|
+
mode: 'published',
|
|
1401
|
+
flow_message_version: '3',
|
|
1402
|
+
flow_token: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',
|
|
1403
|
+
flow_id: '1307913409923914',
|
|
1404
|
+
flow_cta: 'Here is button form',
|
|
1405
|
+
flow_action: 'navigate',
|
|
1406
|
+
flow_action_payload: {
|
|
1407
|
+
screen: 'QUESTION_ONE',
|
|
1408
|
+
params: {
|
|
1409
|
+
user_id: '123456789',
|
|
1410
|
+
referral: 'campaign_xyz'
|
|
1411
|
+
}
|
|
1412
|
+
},
|
|
1413
|
+
flow_metadata: {
|
|
1414
|
+
flow_json_version: '201',
|
|
1415
|
+
data_api_protocol: 'v2',
|
|
1416
|
+
flow_name: 'Lead Qualification [en]',
|
|
1417
|
+
data_api_version: 'v2',
|
|
1418
|
+
categories: ['Lead Generation', 'Sales']
|
|
1419
|
+
}
|
|
1420
|
+
})
|
|
1421
|
+
}]
|
|
1422
|
+
```
|
|
1423
|
+
---
|
|
1424
|
+
|
|
1425
|
+
<table border="1">
|
|
1426
|
+
<thead>
|
|
1427
|
+
<tr>
|
|
1428
|
+
<th>display_flow_thumb</th>
|
|
1429
|
+
<th>native_flow</th>
|
|
1430
|
+
</tr>
|
|
1431
|
+
</thead>
|
|
1432
|
+
<tbody>
|
|
1433
|
+
<tr>
|
|
1434
|
+
<td>
|
|
1435
|
+
<img src="https://files.catbox.moe/zg4vs9.png" alt="Single Select" width="300">
|
|
1436
|
+
</td>
|
|
1437
|
+
<td>
|
|
1438
|
+
single_select
|
|
1439
|
+
</td>
|
|
1440
|
+
</tr>
|
|
1441
|
+
</tbody>
|
|
1442
|
+
</table>
|
|
1443
|
+
|
|
1444
|
+
```javascript
|
|
1445
|
+
const native_flow_button = [{
|
|
1446
|
+
name: 'single_select',
|
|
1447
|
+
buttonParamsJson: JSON.stringify({
|
|
1448
|
+
title: 'Selection Button',
|
|
1449
|
+
sections: [{
|
|
1450
|
+
title: 'Title 1',
|
|
1451
|
+
highlight_label: 'Highlight label 1',
|
|
1452
|
+
rows: [{
|
|
1453
|
+
header: 'Header 1',
|
|
1454
|
+
title: 'Title 1',
|
|
1455
|
+
description: 'Description 1',
|
|
1456
|
+
id: 'Id 1'
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
header: 'Header 2',
|
|
1460
|
+
title: 'Title 2',
|
|
1461
|
+
description: 'Description 2',
|
|
1462
|
+
id: 'Id 2'
|
|
1463
|
+
}
|
|
1464
|
+
]
|
|
1465
|
+
}]
|
|
1466
|
+
})
|
|
1467
|
+
}]
|
|
1468
|
+
```
|
|
1469
|
+
</details>
|
|
1470
|
+
</details>
|
|
1471
|
+
</details>
|
|
1472
|
+
|
|
1473
|
+
<details>
|
|
1474
|
+
<summary><strong>🛍️ Product Message</strong></summary>
|
|
1475
|
+
|
|
1476
|
+
```javascript
|
|
1477
|
+
await sock.sendMessage(jid, {
|
|
1478
|
+
product: {
|
|
1479
|
+
productId: '123',
|
|
1480
|
+
title: 'Cool T-Shirt',
|
|
1481
|
+
description: '100% cotton',
|
|
1482
|
+
price: 1999, // In cents (e.g., $19.99)
|
|
1483
|
+
currencyCode: 'USD',
|
|
1484
|
+
productImage: fs.readFileSync('shirt.jpg')
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
```
|
|
1488
|
+
</details>
|
|
1489
|
+
|
|
1490
|
+
<details>
|
|
1491
|
+
<summary><strong>🎭 Buttons Messages</strong></summary>
|
|
1492
|
+
|
|
1493
|
+
<br>
|
|
1494
|
+
|
|
1495
|
+
> This message button may not work if WhatsApp prohibits the free and open use of the message button. Use a WhatsApp partner if you still want to use the message button.
|
|
1496
|
+
|
|
1497
|
+
<details>
|
|
1498
|
+
<summary><strong>header_type</strong></summary>
|
|
1499
|
+
|
|
1500
|
+
```javascript
|
|
1501
|
+
// Button Headers Text
|
|
1502
|
+
await sock.sendMessage(jid, {
|
|
1503
|
+
text: 'Choose an option:',
|
|
1504
|
+
buttons: button_params,
|
|
1505
|
+
footer: '© WhatsApp Baileys'
|
|
1506
|
+
});
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
```javascript
|
|
1510
|
+
// Button Headers Image
|
|
1511
|
+
await sock.sendMessage(jid, {
|
|
1512
|
+
image: fs.readFileSync('image.jpg'),
|
|
1513
|
+
caption: 'Choose an option:',
|
|
1514
|
+
buttons: button_params,
|
|
1515
|
+
footer: '© WhatsApp Baileys'
|
|
1516
|
+
});
|
|
1517
|
+
```
|
|
1518
|
+
|
|
1519
|
+
```javascript
|
|
1520
|
+
// Button Headers Video
|
|
1521
|
+
await sock.sendMessage(jid, {
|
|
1522
|
+
video: fs.readFileSync('video.mp4'),
|
|
1523
|
+
caption: 'Choose an option:',
|
|
1524
|
+
buttons: button_params,
|
|
1525
|
+
footer: '© WhatsApp Baileys'
|
|
1526
|
+
});
|
|
1527
|
+
```
|
|
1528
|
+
|
|
1529
|
+
```javascript
|
|
1530
|
+
// Button Headers Location
|
|
1531
|
+
await sock.sendMessage(jid, {
|
|
1532
|
+
location: {
|
|
1533
|
+
degreesLatitude: 37.422,
|
|
1534
|
+
degreesLongitude: -122.084
|
|
1535
|
+
},
|
|
1536
|
+
caption: 'Choose an option:',
|
|
1537
|
+
buttons: button_params,
|
|
1538
|
+
footer: '© WhatsApp Baileys'
|
|
1539
|
+
});
|
|
1540
|
+
```
|
|
1541
|
+
</details>
|
|
1542
|
+
|
|
1543
|
+
<details>
|
|
1544
|
+
<summary><strong>button_params</strong></summary>
|
|
1545
|
+
|
|
1546
|
+
```javascript
|
|
1547
|
+
// Button Params Default
|
|
1548
|
+
const button_params = [{
|
|
1549
|
+
buttonId: 'id1',
|
|
1550
|
+
buttonText: {
|
|
1551
|
+
displayText: 'Option 1'
|
|
1552
|
+
},
|
|
1553
|
+
type: 1
|
|
1554
|
+
},{
|
|
1555
|
+
buttonId: 'id2',
|
|
1556
|
+
buttonText: {
|
|
1557
|
+
displayText: 'Option 2'
|
|
1558
|
+
},
|
|
1559
|
+
type: 1
|
|
1560
|
+
}]
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1563
|
+
```javascript
|
|
1564
|
+
// Button Params NativeFlow
|
|
1565
|
+
const button_params = [{
|
|
1566
|
+
buttonId: 'id1',
|
|
1567
|
+
buttonText: {
|
|
1568
|
+
displayText: 'Option 1'
|
|
1569
|
+
},
|
|
1570
|
+
type: 1
|
|
1571
|
+
},{
|
|
1572
|
+
buttonId: 'flow',
|
|
1573
|
+
buttonText: {
|
|
1574
|
+
displayText: 'flow'
|
|
1575
|
+
},
|
|
1576
|
+
nativeFlowInfo: {
|
|
1577
|
+
name: 'cta_url',
|
|
1578
|
+
buttonParamsJson: JSON.stringify({
|
|
1579
|
+
display_text: 'Visit URL',
|
|
1580
|
+
url: 'https://web.whatsapp.com',
|
|
1581
|
+
merchant_url: 'https://web.whatsapp.com'
|
|
1582
|
+
})
|
|
1583
|
+
},
|
|
1584
|
+
type: 2
|
|
1585
|
+
}]
|
|
1586
|
+
```
|
|
1587
|
+
</details>
|
|
1588
|
+
</details>
|
|
1589
|
+
|
|
1590
|
+
<details>
|
|
1591
|
+
<summary><strong>🎭 List Messages </strong></summary>
|
|
1592
|
+
|
|
1593
|
+
```javascript
|
|
1594
|
+
// Single Select
|
|
1595
|
+
await sock.sendMessage(jid, {
|
|
1596
|
+
text: 'Menu:',
|
|
1597
|
+
sections: [
|
|
1598
|
+
{ title: 'Food', rows: [
|
|
1599
|
+
{ title: 'Pizza', rowId: 'pizza' },
|
|
1600
|
+
{ title: 'Burger', rowId: 'burger' }
|
|
1601
|
+
]}
|
|
1602
|
+
],
|
|
1603
|
+
buttonText: 'Browse'
|
|
1604
|
+
});
|
|
1605
|
+
```
|
|
1606
|
+
|
|
1607
|
+
```javascript
|
|
1608
|
+
// Product List
|
|
1609
|
+
await sock.sendMessage(jid, {
|
|
1610
|
+
title: 'Here is title product',
|
|
1611
|
+
text: 'Text message',
|
|
1612
|
+
footer: '© WhatsApp Baileys',
|
|
1613
|
+
buttonText: 'Select Menu',
|
|
1614
|
+
productList: [{
|
|
1615
|
+
title: 'Product Collection',
|
|
1616
|
+
products: [{
|
|
1617
|
+
productId: '23942543532047956' // catalog business ID
|
|
1618
|
+
}]
|
|
1619
|
+
}],
|
|
1620
|
+
businessOwnerJid: '6285643115199@s.whatsapp.net',
|
|
1621
|
+
thumbnail: { url: 'https://www.example.com/file' }
|
|
1622
|
+
})
|
|
1623
|
+
```
|
|
1624
|
+
</details>
|
|
1625
|
+
|
|
1626
|
+
<br>
|
|
1627
|
+
|
|
1628
|
+
### 📣 Newsletter
|
|
1629
|
+
<details>
|
|
1630
|
+
<summary><strong>📋 Newsletter Metadata</strong></summary>
|
|
1631
|
+
|
|
1632
|
+
```javascript
|
|
1633
|
+
// code can't have "https://whatsapp.com/channel/", only code
|
|
1634
|
+
const newsletter = await sock.newsletterMetadata("invite", "0029Vaf0HPMLdQeZsp3XRp2T")
|
|
1635
|
+
console.log("Newsletter metadata:", newsletter)
|
|
1636
|
+
```
|
|
1637
|
+
|
|
1638
|
+
```javascript
|
|
1639
|
+
// from jid newsletter
|
|
1640
|
+
const newsletter = await sock.newsletterMetadata("jid", "120363282083849178@newsletter")
|
|
1641
|
+
console.log("Newsletter metadata:", newsletter)
|
|
1642
|
+
```
|
|
1643
|
+
</details>
|
|
1644
|
+
|
|
1645
|
+
<details>
|
|
1646
|
+
<summary><strong>👥 Newsletter Follow</strong></summary>
|
|
1647
|
+
|
|
1648
|
+
```javascript
|
|
1649
|
+
await sock.newsletterFollow("120363282083849178@newsletter")
|
|
1650
|
+
```
|
|
1651
|
+
</details>
|
|
1652
|
+
|
|
1653
|
+
<details>
|
|
1654
|
+
<summary><strong>👥 Newsletter Unfollow</strong></summary>
|
|
1655
|
+
|
|
1656
|
+
```javascript
|
|
1657
|
+
await sock.newsletterUnfollow("120363282083849178@newsletter")
|
|
1658
|
+
```
|
|
1659
|
+
</details>
|
|
1660
|
+
|
|
1661
|
+
<details>
|
|
1662
|
+
<summary><strong>🔈 Newsletter Mute</strong></summary>
|
|
1663
|
+
|
|
1664
|
+
```javascript
|
|
1665
|
+
await sock.newsletterMute("120363282083849178@newsletter")
|
|
1666
|
+
```
|
|
1667
|
+
</details>
|
|
1668
|
+
|
|
1669
|
+
<details>
|
|
1670
|
+
<summary><strong>🔊 Newsletter Unmute</strong></summary>
|
|
1671
|
+
|
|
1672
|
+
```javascript
|
|
1673
|
+
await sock.newsletterUnmute("120363282083849178@newsletter")
|
|
1674
|
+
```
|
|
1675
|
+
</details>
|
|
1676
|
+
|
|
1677
|
+
<details>
|
|
1678
|
+
<summary><strong>❤️ Newsletter Reaction Mode</strong></summary>
|
|
1679
|
+
|
|
1680
|
+
```javascript
|
|
1681
|
+
// Allow all emoji
|
|
1682
|
+
await sock.newsletterReactionMode("120363282083849178@newsletter", "ALL")
|
|
1683
|
+
```
|
|
1684
|
+
|
|
1685
|
+
```javascript
|
|
1686
|
+
// Allow special emoji (👍, ❤️, 😯, 😢, 🙏)
|
|
1687
|
+
await sock.newsletterReactionMode("120363282083849178@newsletter", "BASIC")
|
|
1688
|
+
```
|
|
1689
|
+
|
|
1690
|
+
```javascript
|
|
1691
|
+
// No reaction allowed
|
|
1692
|
+
await sock.newsletterReactionMode("120363282083849178@newsletter", "NONE")
|
|
1693
|
+
```
|
|
1694
|
+
</details>
|
|
1695
|
+
|
|
1696
|
+
<details>
|
|
1697
|
+
<summary><strong>📋 Update Description</strong></summary>
|
|
1698
|
+
|
|
1699
|
+
```javascript
|
|
1700
|
+
await sock.newsletterUpdateDescription("120363282083849178@newsletter", "News description here!")
|
|
1701
|
+
```
|
|
1702
|
+
</details>
|
|
1703
|
+
|
|
1704
|
+
<details>
|
|
1705
|
+
<summary><strong>👤 Update Name Newsletter</strong></summary>
|
|
1706
|
+
|
|
1707
|
+
```javascript
|
|
1708
|
+
await sock.newsletterUpdateName("120363282083849178@newsletter", "New newsletter name!")
|
|
1709
|
+
```
|
|
1710
|
+
</details>
|
|
1711
|
+
|
|
1712
|
+
<details>
|
|
1713
|
+
<summary><strong>🖼️ Change Profile Newsletter</strong></summary>
|
|
1714
|
+
|
|
1715
|
+
```javascript
|
|
1716
|
+
// Change
|
|
1717
|
+
await sock.newsletterUpdatePicture("120363282083849178@newsletter", { url: 'https://example.com/image.jpg' })
|
|
1718
|
+
```
|
|
1719
|
+
|
|
1720
|
+
```javascript
|
|
1721
|
+
// Remove
|
|
1722
|
+
await sock.newsletterRemovePicture("120363282083849178@newsletter")
|
|
1723
|
+
```
|
|
1724
|
+
</details>
|
|
1725
|
+
|
|
1726
|
+
<details>
|
|
1727
|
+
<summary><strong>📣 Newsletter Create</strong></summary>
|
|
1728
|
+
|
|
1729
|
+
```javascript
|
|
1730
|
+
const newsletter = await sock.newsletterCreate("Here is name newsletter!", "Here is description!", { url: 'https://example.com/image.jpg' })
|
|
1731
|
+
console.log("Here is data new created newsletter:", newsletter)
|
|
1732
|
+
```
|
|
1733
|
+
</details>
|
|
1734
|
+
|
|
1735
|
+
<details>
|
|
1736
|
+
<summary><strong>🔥 List Newsletter Join</strong></summary>
|
|
1737
|
+
|
|
1738
|
+
```javascript
|
|
1739
|
+
const list_newsletter = await sock.newsletterFetchAllParticipating()
|
|
1740
|
+
console.log("Your list newsletter join:", list_newsletter)
|
|
1741
|
+
```
|
|
1742
|
+
</details>
|
|
1743
|
+
|
|
1744
|
+
<details>
|
|
1745
|
+
<summary><strong>😎 Newsletter Change Owner</strong></summary>
|
|
1746
|
+
|
|
1747
|
+
```javascript
|
|
1748
|
+
await sock.newsletterChangeOwner("120363282083849178@newsletter", "123@lid")
|
|
1749
|
+
```
|
|
1750
|
+
</details>
|
|
1751
|
+
|
|
1752
|
+
<details>
|
|
1753
|
+
<summary><strong>😂 Newsletter Demote</strong></summary>
|
|
1754
|
+
|
|
1755
|
+
```javascript
|
|
1756
|
+
await sock.newsletterDemote("120363282083849178@newsletter", "123@lid")
|
|
1757
|
+
```
|
|
1758
|
+
</details>
|
|
1759
|
+
|
|
1760
|
+
<details>
|
|
1761
|
+
<summary><strong>🌟 Newsletter Reaction Message</strong></summary>
|
|
1762
|
+
|
|
1763
|
+
```javascript
|
|
1764
|
+
await sock.newsletterReactMessage("120363282083849178@newsletter", "12", "🦖")
|
|
1765
|
+
```
|
|
1766
|
+
</details>
|
|
1767
|
+
|
|
1768
|
+
<br>
|
|
1769
|
+
|
|
1770
|
+
### 🛠️ Groups
|
|
1771
|
+
<details>
|
|
1772
|
+
<summary><strong>🔄 Create Group</strong></summary>
|
|
1773
|
+
|
|
1774
|
+
```javascript
|
|
1775
|
+
const group = await sock.groupCreate("New Group Title", ["123@s.whatsapp.net", "456@s.whatsapp.net"]);
|
|
1776
|
+
console.log("New group create data:", group)
|
|
1777
|
+
```
|
|
1778
|
+
</details>
|
|
1779
|
+
|
|
1780
|
+
<details>
|
|
1781
|
+
<summary><strong>⚙️ Change Group Settings</strong></summary>
|
|
1782
|
+
|
|
1783
|
+
```javascript
|
|
1784
|
+
// only allow admins to send messages
|
|
1785
|
+
await sock.groupSettingUpdate(jid, 'announcement')
|
|
1786
|
+
```
|
|
1787
|
+
|
|
1788
|
+
```javascript
|
|
1789
|
+
// allow everyone to send messages
|
|
1790
|
+
await sock.groupSettingUpdate(jid, 'not_announcement')
|
|
1791
|
+
```
|
|
1792
|
+
|
|
1793
|
+
```javascript
|
|
1794
|
+
// allow everyone to modify the group's settings -- like display picture etc.
|
|
1795
|
+
await sock.groupSettingUpdate(jid, 'unlocked')
|
|
1796
|
+
```
|
|
1797
|
+
|
|
1798
|
+
```javascript
|
|
1799
|
+
// only allow admins to modify the group's settings
|
|
1800
|
+
await sock.groupSettingUpdate(jid, 'locked')
|
|
1801
|
+
```
|
|
1802
|
+
</details>
|
|
1803
|
+
|
|
1804
|
+
<details>
|
|
1805
|
+
<summary><strong>💯 Add, Remove, Promote, Demote</strong></summary>
|
|
1806
|
+
|
|
1807
|
+
```javascript
|
|
1808
|
+
// add member
|
|
1809
|
+
await sock.groupParticipantsUpdate(jid, ['123@s.whatsapp.net', '456@s.whatsapp.net'], 'add')
|
|
1810
|
+
|
|
1811
|
+
// remove member
|
|
1812
|
+
await sock.groupParticipantsUpdate(jid, ['123@s.whatsapp.net', '456@s.whatsapp.net'], 'remove')
|
|
1813
|
+
|
|
1814
|
+
// promote member (admins)
|
|
1815
|
+
await sock.groupParticipantsUpdate(jid, ['123@s.whatsapp.net', '456@s.whatsapp.net'], 'promote')
|
|
1816
|
+
|
|
1817
|
+
// demote member (unadmins)
|
|
1818
|
+
await sock.groupParticipantsUpdate(jid, ['123@s.whatsapp.net', '456@s.whatsapp.net'], 'demote')
|
|
1819
|
+
```
|
|
1820
|
+
</details>
|
|
1821
|
+
|
|
1822
|
+
<details>
|
|
1823
|
+
<summary><strong>👥 Change Subject Title</strong></summary>
|
|
1824
|
+
|
|
1825
|
+
```javascript
|
|
1826
|
+
await sock.groupUpdateSubject(jid, 'New Subject Title!')
|
|
1827
|
+
```
|
|
1828
|
+
</details>
|
|
1829
|
+
|
|
1830
|
+
<details>
|
|
1831
|
+
<summary><strong>📋 Change Description</strong></summary>
|
|
1832
|
+
|
|
1833
|
+
```javascript
|
|
1834
|
+
await sock.groupUpdateDescription(jid, 'New Description!')
|
|
1835
|
+
```
|
|
1836
|
+
</details>
|
|
1837
|
+
|
|
1838
|
+
<details>
|
|
1839
|
+
<summary><strong>⛔ Leave Group</strong></summary>
|
|
1840
|
+
|
|
1841
|
+
```javascript
|
|
1842
|
+
await sock.groupLeave(jid)
|
|
1843
|
+
```
|
|
1844
|
+
</details>
|
|
1845
|
+
|
|
1846
|
+
<details>
|
|
1847
|
+
<summary><strong>🔗 Invite Code</strong></summary>
|
|
1848
|
+
|
|
1849
|
+
```javascript
|
|
1850
|
+
// to create link with code use "https://chat.whatsapp.com/" + code
|
|
1851
|
+
const code = await sock.groupInviteCode(jid)
|
|
1852
|
+
console.log('group code: ' + code)
|
|
1853
|
+
```
|
|
1854
|
+
</details>
|
|
1855
|
+
|
|
1856
|
+
<details>
|
|
1857
|
+
<summary><strong>🔁 Revoke/Reset Invite Code</strong></summary>
|
|
1858
|
+
|
|
1859
|
+
```javascript
|
|
1860
|
+
const code = await sock.groupRevokeInvite(jid)
|
|
1861
|
+
console.log('New group code: ' + code)
|
|
1862
|
+
```
|
|
1863
|
+
</details>
|
|
1864
|
+
|
|
1865
|
+
<details>
|
|
1866
|
+
<summary><strong>🟢 Join By Invite Code</strong></summary>
|
|
1867
|
+
|
|
1868
|
+
```javascript
|
|
1869
|
+
// code can't have "https://chat.whatsapp.com/", only code
|
|
1870
|
+
const response = await sock.groupAcceptInvite(code)
|
|
1871
|
+
console.log('joined to: ' + response)
|
|
1872
|
+
```
|
|
1873
|
+
</details>
|
|
1874
|
+
|
|
1875
|
+
<details>
|
|
1876
|
+
<summary><strong>📋 Group Metadata By Code</strong></summary>
|
|
1877
|
+
|
|
1878
|
+
```javascript
|
|
1879
|
+
const response = await sock.groupGetInviteInfo(code)
|
|
1880
|
+
console.log('group information: ' + response)
|
|
1881
|
+
```
|
|
1882
|
+
</details>
|
|
1883
|
+
|
|
1884
|
+
<details>
|
|
1885
|
+
<summary><strong>📋 Group Metadata</strong></summary>
|
|
1886
|
+
|
|
1887
|
+
```javascript
|
|
1888
|
+
const metadata = await sock.groupMetadata(jid)
|
|
1889
|
+
console.log(metadata.id + ', title: ' + metadata.subject + ', description: ' + metadata.desc)
|
|
1890
|
+
```
|
|
1891
|
+
</details>
|
|
1892
|
+
|
|
1893
|
+
<details>
|
|
1894
|
+
<summary><strong>🟢 Join using `groupInviteMessage`</strong></summary>
|
|
1895
|
+
|
|
1896
|
+
```javascript
|
|
1897
|
+
const response = await sock.groupAcceptInviteV4(jid, groupInviteMessage)
|
|
1898
|
+
console.log('joined to: ' + response)
|
|
1899
|
+
```
|
|
1900
|
+
</details>
|
|
1901
|
+
|
|
1902
|
+
<details>
|
|
1903
|
+
<summary><strong>👥 Join Request List</strong></summary>
|
|
1904
|
+
|
|
1905
|
+
```javascript
|
|
1906
|
+
const response = await sock.groupRequestParticipantsList(jid)
|
|
1907
|
+
console.log(response)
|
|
1908
|
+
```
|
|
1909
|
+
</details>
|
|
1910
|
+
|
|
1911
|
+
<details>
|
|
1912
|
+
<summary><strong>👥 Join Approve/Reject</strong></summary>
|
|
1913
|
+
|
|
1914
|
+
```javascript
|
|
1915
|
+
// Approve
|
|
1916
|
+
const response = await sock.groupRequestParticipantsUpdate(jid, ['123@s.whatsapp.net', '456@s.whatsapp.net'], 'approve')
|
|
1917
|
+
```
|
|
1918
|
+
|
|
1919
|
+
```javascript
|
|
1920
|
+
// Reject
|
|
1921
|
+
const response = await sock.groupRequestParticipantsUpdate(jid, ['123@s.whatsapp.net', '456@s.whatsapp.net'], 'reject')
|
|
1922
|
+
```
|
|
1923
|
+
</details>
|
|
1924
|
+
|
|
1925
|
+
<details>
|
|
1926
|
+
<summary><strong>👥 Group Member List</strong></summary>
|
|
1927
|
+
|
|
1928
|
+
```javascript
|
|
1929
|
+
const response = await sock.groupFetchAllParticipating()
|
|
1930
|
+
console.log(response)
|
|
1931
|
+
```
|
|
1932
|
+
</details>
|
|
1933
|
+
|
|
1934
|
+
<details>
|
|
1935
|
+
<summary><strong>🕑 Ephemeral Toggle</strong></summary>
|
|
1936
|
+
|
|
1937
|
+
- Ephemeral can be:
|
|
1938
|
+
|
|
1939
|
+
| Time | Seconds |
|
|
1940
|
+
|-------|----------------|
|
|
1941
|
+
| Remove | 0 |
|
|
1942
|
+
| 24h | 86.400 |
|
|
1943
|
+
| 7d | 604.800 |
|
|
1944
|
+
| 90d | 7.776.000 |
|
|
1945
|
+
|
|
1946
|
+
```javascript
|
|
1947
|
+
await sock.groupToggleEphemeral(jid, 86400)
|
|
1948
|
+
```
|
|
1949
|
+
</details>
|
|
1950
|
+
|
|
1951
|
+
<details>
|
|
1952
|
+
<summary><strong>👥 Member Add Mode</strong></summary>
|
|
1953
|
+
|
|
1954
|
+
```javascript
|
|
1955
|
+
// Everyone Member
|
|
1956
|
+
await sock.groupMemberAddMode(jid, 'all_member_add')
|
|
1957
|
+
```
|
|
1958
|
+
|
|
1959
|
+
```javascript
|
|
1960
|
+
// Only Admin
|
|
1961
|
+
await sock.groupMemberAddMode(jid, 'admin_add')
|
|
1962
|
+
```
|
|
1963
|
+
</details>
|
|
1964
|
+
|
|
1965
|
+
<br>
|
|
1966
|
+
|
|
1967
|
+
### 🔒 Privacy
|
|
1968
|
+
<details>
|
|
1969
|
+
<summary><strong>🖼️ Change Profile User or Group</strong></summary>
|
|
1970
|
+
|
|
1971
|
+
```javascript
|
|
1972
|
+
// Change
|
|
1973
|
+
await sock.updateProfilePicture(jid, { url: 'https://example.com/image.jpg' })
|
|
1974
|
+
```
|
|
1975
|
+
|
|
1976
|
+
```javascript
|
|
1977
|
+
// Remove
|
|
1978
|
+
await sock.removeProfilePicture(jid)
|
|
1979
|
+
```
|
|
1980
|
+
</details>
|
|
1981
|
+
|
|
1982
|
+
<details>
|
|
1983
|
+
<summary><strong>🚫 Block/Unblock User</strong></summary>
|
|
1984
|
+
|
|
1985
|
+
```javascript
|
|
1986
|
+
// Block
|
|
1987
|
+
await sock.updateBlockStatus(jid, 'block');
|
|
1988
|
+
```
|
|
1989
|
+
|
|
1990
|
+
```javascript
|
|
1991
|
+
// Unblock
|
|
1992
|
+
await sock.updateBlockStatus(jid, 'unblock');
|
|
1993
|
+
```
|
|
1994
|
+
</details>
|
|
1995
|
+
|
|
1996
|
+
<details>
|
|
1997
|
+
<summary><strong>👤 Metadata Privacy</strong></summary>
|
|
1998
|
+
|
|
1999
|
+
```javascript
|
|
2000
|
+
const privacySettings = await sock.fetchPrivacySettings(true)
|
|
2001
|
+
console.log('privacy settings: ' + privacySettings)
|
|
2002
|
+
```
|
|
2003
|
+
</details>
|
|
2004
|
+
|
|
2005
|
+
<details>
|
|
2006
|
+
<summary><strong>⛔ Metadata Blocklist</strong></summary>
|
|
2007
|
+
|
|
2008
|
+
```javascript
|
|
2009
|
+
const response = await sock.fetchBlocklist()
|
|
2010
|
+
console.log(response)
|
|
2011
|
+
```
|
|
2012
|
+
</details>
|
|
2013
|
+
|
|
2014
|
+
<details>
|
|
2015
|
+
<summary><strong>👀 Last Seen</strong></summary>
|
|
2016
|
+
|
|
2017
|
+
```javascript
|
|
2018
|
+
// Everyone
|
|
2019
|
+
await sock.updateLastSeenPrivacy("all")
|
|
2020
|
+
```
|
|
2021
|
+
|
|
2022
|
+
```javascript
|
|
2023
|
+
// Contacts
|
|
2024
|
+
await sock.updateLastSeenPrivacy("contacts")
|
|
2025
|
+
```
|
|
2026
|
+
|
|
2027
|
+
```javascript
|
|
2028
|
+
// Contacts Blacklist
|
|
2029
|
+
await sock.updateLastSeenPrivacy("contact_blacklist")
|
|
2030
|
+
```
|
|
2031
|
+
|
|
2032
|
+
```javascript
|
|
2033
|
+
// Hide
|
|
2034
|
+
await sock.updateLastSeenPrivacy("none")
|
|
2035
|
+
```
|
|
2036
|
+
</details>
|
|
2037
|
+
|
|
2038
|
+
<details>
|
|
2039
|
+
<summary><strong>👀 Online Status</strong></summary>
|
|
2040
|
+
|
|
2041
|
+
```javascript
|
|
2042
|
+
// Everyone
|
|
2043
|
+
await sock.updateOnlinePrivacy("all")
|
|
2044
|
+
```
|
|
2045
|
+
|
|
2046
|
+
```javascript
|
|
2047
|
+
// Match last seen
|
|
2048
|
+
await sock.updateOnlinePrivacy("match_last_seen")
|
|
2049
|
+
```
|
|
2050
|
+
</details>
|
|
2051
|
+
|
|
2052
|
+
<details>
|
|
2053
|
+
<summary><strong>🖼️ Profile Picture</strong></summary>
|
|
2054
|
+
|
|
2055
|
+
```javascript
|
|
2056
|
+
// Everyone
|
|
2057
|
+
await sock.updateProfilePicturePrivacy("all")
|
|
2058
|
+
```
|
|
2059
|
+
|
|
2060
|
+
```javascript
|
|
2061
|
+
// Contacts
|
|
2062
|
+
await sock.updateProfilePicturePrivacy("contacts")
|
|
2063
|
+
```
|
|
2064
|
+
|
|
2065
|
+
```javascript
|
|
2066
|
+
// Contacts Blacklist
|
|
2067
|
+
await sock.updateProfilePicturePrivacy("contact_blacklist")
|
|
2068
|
+
```
|
|
2069
|
+
|
|
2070
|
+
```javascript
|
|
2071
|
+
// Hide
|
|
2072
|
+
await sock.updateProfilePicturePrivacy("none")
|
|
2073
|
+
```
|
|
2074
|
+
</details>
|
|
2075
|
+
|
|
2076
|
+
<details>
|
|
2077
|
+
<summary><strong>✨ Status WhatsApp</strong></summary>
|
|
2078
|
+
|
|
2079
|
+
```javascript
|
|
2080
|
+
// Everyone
|
|
2081
|
+
await sock.updateStatusPrivacy("all")
|
|
2082
|
+
```
|
|
2083
|
+
|
|
2084
|
+
```javascript
|
|
2085
|
+
// Contacts
|
|
2086
|
+
await sock.updateStatusPrivacy("contacts")
|
|
2087
|
+
```
|
|
2088
|
+
|
|
2089
|
+
```javascript
|
|
2090
|
+
// Contacts Blacklist
|
|
2091
|
+
await sock.updateStatusPrivacy("contact_blacklist")
|
|
2092
|
+
```
|
|
2093
|
+
|
|
2094
|
+
```javascript
|
|
2095
|
+
// Hide
|
|
2096
|
+
await sock.updateStatusPrivacy("none")
|
|
2097
|
+
```
|
|
2098
|
+
</details>
|
|
2099
|
+
|
|
2100
|
+
<details>
|
|
2101
|
+
<summary><strong>👁️ Blue Tiks Read</strong></summary>
|
|
2102
|
+
|
|
2103
|
+
```javascript
|
|
2104
|
+
// Show
|
|
2105
|
+
await sock.updateReadReceiptsPrivacy("all")
|
|
2106
|
+
```
|
|
2107
|
+
|
|
2108
|
+
```javascript
|
|
2109
|
+
// Hide
|
|
2110
|
+
await sock.updateReadReceiptsPrivacy("none")
|
|
2111
|
+
```
|
|
2112
|
+
</details>
|
|
2113
|
+
|
|
2114
|
+
<details>
|
|
2115
|
+
<summary><strong>👥 Group Add</strong></summary>
|
|
2116
|
+
|
|
2117
|
+
```javascript
|
|
2118
|
+
// Everyone
|
|
2119
|
+
await sock.updateGroupsAddPrivacy("all")
|
|
2120
|
+
```
|
|
2121
|
+
|
|
2122
|
+
```javascript
|
|
2123
|
+
// Contacts
|
|
2124
|
+
await sock.updateGroupsAddPrivacy("contacts")
|
|
2125
|
+
```
|
|
2126
|
+
|
|
2127
|
+
```javascript
|
|
2128
|
+
// Contacts Blacklist
|
|
2129
|
+
await sock.updateGroupsAddPrivacy("contact_blacklist")
|
|
2130
|
+
```
|
|
2131
|
+
</details>
|
|
2132
|
+
|
|
2133
|
+
<details>
|
|
2134
|
+
<summary><strong>🕑 Default Disappearing Mode</strong></summary>
|
|
2135
|
+
|
|
2136
|
+
| Time | Seconds |
|
|
2137
|
+
|-------|----------------|
|
|
2138
|
+
| Remove | 0 |
|
|
2139
|
+
| 24h | 86.400 |
|
|
2140
|
+
| 7d | 604.800 |
|
|
2141
|
+
| 90d | 7.776.000 |
|
|
2142
|
+
|
|
2143
|
+
```javascript
|
|
2144
|
+
await sock.updateDefaultDisappearingMode(86400)
|
|
2145
|
+
```
|
|
2146
|
+
</details>
|
|
2147
|
+
|
|
2148
|
+
<br>
|
|
2149
|
+
|
|
2150
|
+
### ⚙️ Advanced
|
|
2151
|
+
<details>
|
|
2152
|
+
<summary><strong>🔧 Debug Logs</strong></summary>
|
|
2153
|
+
|
|
2154
|
+
```javascript
|
|
2155
|
+
const sock = makeWASocket({ logger: { level: 'debug' } });
|
|
2156
|
+
```
|
|
2157
|
+
</details>
|
|
2158
|
+
|
|
2159
|
+
<details>
|
|
2160
|
+
<summary><strong>📡 Raw WebSocket Events</strong></summary>
|
|
2161
|
+
|
|
2162
|
+
```javascript
|
|
2163
|
+
sock.ws.on('CB:presence', (json) => console.log('Sockets update:', json));
|
|
2164
|
+
|
|
2165
|
+
// for any message with tag 'edge_routing'
|
|
2166
|
+
sock.ws.on('CB:edge_routing', (node) => console.log('Sockets update:', node));
|
|
2167
|
+
|
|
2168
|
+
// for any message with tag 'edge_routing' and id attribute = abcd
|
|
2169
|
+
sock.ws.on('CB:edge_routing,id:abcd', (node) => console.log('Sockets update:', node));
|
|
2170
|
+
|
|
2171
|
+
// for any message with tag 'edge_routing', id attribute = abcd & first content node routing_info
|
|
2172
|
+
sock.ws.on('CB:edge_routing,id:abcd,routing_info', (node) => console.log('Sockets update:', node));
|
|
2173
|
+
```
|
|
2174
|
+
</details>
|
|
2175
|
+
|
|
2176
|
+
<br>
|
|
2177
|
+
|
|
2178
|
+
## ⚠️ Disclaimer
|
|
2179
|
+
This project is **not affiliated** with WhatsApp/Meta. Use at your own risk.
|
|
2180
|
+
Refer to [WhatsApp's Terms](https://www.whatsapp.com/legal) for compliance.
|
|
2181
|
+
|
|
2182
|
+
<br>
|
|
2183
|
+
|
|
2184
|
+
### 🔗 Full Documentation
|
|
2185
|
+
Explore all features in the **[Baileys GitHub Wiki](https://github.com/whiskeysockets/baileys/wiki)**
|