socketon 0.30.7 → 0.31.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.
Files changed (3) hide show
  1. package/README.md +175 -87
  2. package/lib/index.js +3 -3
  3. package/package.json +125 -107
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
+ # Socketon WhatsApp API Library
2
+
1
3
  <p align="center">
2
4
  <img src="https://files.catbox.moe/0wl8py.png" alt="socketon" width="320" />
3
5
  </p>
4
6
 
5
- <a id="readme-top"></a>
6
-
7
7
  <p align="center">
8
- WhatsApp API library (fork of baileys) with improved stability, custom pairing code, and better session handling.
8
+ A modern, stable, and feature-rich WhatsApp API library for Node.js. Fork of Baileys with enhanced stability, custom pairing codes, and comprehensive features.
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -22,145 +22,214 @@
22
22
 
23
23
  ---
24
24
 
25
- ## why socketon?
25
+ ## Why Socketon?
26
26
 
27
- kalau kamu ngerasa baileys sekarang udah delay, suka double respon, atau kadang infinite connecting, socketon bisa jadi alternatif yang lebih enak.
27
+ If you feel Baileys is now slow, has double responses, or sometimes infinite connecting, Socketon can be a better alternative.
28
28
 
29
- ini fork dari baileys yang difokusin buat stabilitas, session handling, dan pairing code yang lebih fleksibel. sebagian besar api tetap sama, jadi migrasi dari baileys biasanya gak butuh perubahan besar.
29
+ This is a fork of Baileys focused on stability, session handling, and more flexible pairing codes. Most APIs remain the same, so migration from Baileys usually doesn't require major changes.
30
30
 
31
31
  ---
32
32
 
33
- ## features
33
+ ## Key Features
34
34
 
35
- - custom pairing code (default: socketon)
36
- - improved session handling (lebih rapih dan stabil)
37
- - multi-device support
38
- - interactive messages (buttons, list, native flow)
39
- - album messages (multiple images)
40
- - newsletter support + auto-follow (built-in)
41
- - event / poll / payment request / product messages
42
- - document support
43
- - lightweight and fast, no browser required
35
+ - Custom Pairing Codes: Default "SOCKETON" code for easier authentication
36
+ - Enhanced Stability: Improved session handling and automatic reconnection
37
+ - Multi-Device Support: Full compatibility with WhatsApp's multi-device feature
38
+ - Interactive Messages: Buttons, lists, and native flow interactions
39
+ - Album Messages: Send multiple images in a single message
40
+ - Newsletter Integration: Auto-follow and manual newsletter management
41
+ - Business Messaging: Product catalogs, payments, and business features
42
+ - Media Support: Comprehensive upload/download with progress tracking
43
+ - Event-Driven Architecture: Extensive real-time event system
44
+ - TypeScript Support: Full type definitions for better development experience
45
+ - Lightweight & Fast: WebSocket-based, no browser dependencies
44
46
 
45
47
  ---
46
48
 
47
- ## installation
49
+ ## Installation
48
50
 
49
51
  ```bash
50
- npm i socketon
52
+ npm install socketon
51
53
  ```
52
54
 
53
- requirements:
54
- - node.js >= 20
55
+ Requirements:
56
+ - Node.js >= 20.0.0
55
57
 
56
58
  ---
57
59
 
58
- ## quick start
60
+ ## Quick Start
59
61
 
60
- ### connect (qr)
62
+ ### Basic Echo Bot
61
63
 
62
- ```js
63
- const { makeWASocket, useMultiFileAuthState } = require('socketon')
64
+ ```javascript
65
+ const { makeWASocket, useMultiFileAuthState } = require('socketon');
64
66
 
65
- async function start() {
66
- const { state, saveCreds } = await useMultiFileAuthState('./auth')
67
+ async function startBot() {
68
+ // Setup authentication
69
+ const { state, saveCreds } = await useMultiFileAuthState('./auth');
67
70
 
71
+ // Create WhatsApp socket
68
72
  const sock = makeWASocket({
69
73
  auth: state,
70
74
  printQRInTerminal: true
71
- })
75
+ });
72
76
 
73
- sock.ev.on('creds.update', saveCreds)
77
+ // Handle connection
78
+ sock.ev.on('connection.update', (update) => {
79
+ const { connection, qr } = update;
74
80
 
75
- sock.ev.on('connection.update', ({ connection }) => {
76
- if (connection === 'open') console.log('connected')
77
- if (connection === 'close') console.log('disconnected')
78
- })
79
- }
81
+ if (qr) console.log('Scan QR Code:', qr);
82
+ if (connection === 'open') console.log('Connected to WhatsApp!');
83
+ });
80
84
 
81
- start()
82
- ```
85
+ // Handle messages
86
+ sock.ev.on('messages.upsert', async ({ messages }) => {
87
+ for (const msg of messages) {
88
+ if (msg.key.fromMe) continue;
83
89
 
84
- ### auto reply (simple)
90
+ const jid = msg.key.remoteJid;
91
+ const text = msg.message?.conversation || msg.message?.extendedTextMessage?.text || '';
85
92
 
86
- ```js
87
- sock.ev.on('messages.upsert', async ({ messages }) => {
88
- const m = messages[0]
89
- if (!m?.message || m.key.fromMe) return
93
+ console.log(`Message from ${jid}: ${text}`);
90
94
 
91
- const jid = m.key.remoteJid
92
- const text = m.message.conversation || m.message.extendedTextMessage?.text
93
- if (!text) return
95
+ // Echo response
96
+ if (text) {
97
+ await sock.sendMessage(jid, { text: `Echo: ${text}` });
98
+ }
99
+ }
100
+ });
94
101
 
95
- await sock.sendMessage(jid, { text: `echo: ${text}` })
96
- })
97
- ```
102
+ // Save credentials
103
+ sock.ev.on('creds.update', saveCreds);
104
+ }
98
105
 
99
- ---
106
+ startBot().catch(console.error);
107
+ ```
100
108
 
101
- ## pairing code (no qr)
109
+ ### Pairing Code Authentication
102
110
 
103
- ```js
104
- const { makeWASocket, useMultiFileAuthState } = require('socketon')
111
+ ```javascript
112
+ const { makeWASocket, useMultiFileAuthState } = require('socketon');
105
113
 
106
- async function pairing() {
107
- const { state, saveCreds } = await useMultiFileAuthState('./auth')
114
+ async function startWithPairing() {
115
+ const { state, saveCreds } = await useMultiFileAuthState('./auth');
108
116
 
109
117
  const sock = makeWASocket({
110
118
  auth: state,
111
- printQRInTerminal: false
112
- })
119
+ printQRInTerminal: false // Disable QR, use pairing code
120
+ });
113
121
 
114
- sock.ev.on('creds.update', saveCreds)
122
+ sock.ev.on('connection.update', async (update) => {
123
+ const { connection } = update;
115
124
 
116
- sock.ev.on('connection.update', async ({ connection }) => {
117
- if (connection !== 'open') return
125
+ if (connection === 'open') {
126
+ // Use default "SOCKETON" pairing code
127
+ const pairingCode = await sock.requestPairingCode('6281234567890');
128
+ console.log('Pairing Code:', pairingCode);
118
129
 
119
- const code = await sock.requestPairingCode('6281234567890')
120
- console.log('pairing code:', code)
130
+ // Or use custom pairing code
131
+ // const customCode = await sock.requestPairingCode('6281234567890', 'MYCODE');
132
+ // console.log('Custom Pairing Code:', customCode);
133
+ }
134
+ });
121
135
 
122
- // custom
123
- // const custom = await sock.requestPairingCode('6281234567890', 'KODEKAMU')
124
- // console.log('custom code:', custom)
125
- })
136
+ sock.ev.on('creds.update', saveCreds);
126
137
  }
127
138
 
128
- pairing()
139
+ startWithPairing().catch(console.error);
129
140
  ```
130
141
 
131
142
  ---
132
143
 
133
- ## migration from baileys
144
+ ## Documentation
145
+
146
+ ### Complete Guide
147
+ For comprehensive documentation covering everything from basic to advanced usage:
148
+
149
+ [Read the Complete Guide](COMPLETE_GUIDE.md)
150
+
151
+ The complete guide includes:
152
+ - Detailed installation and setup
153
+ - Authentication methods (QR code, pairing code)
154
+ - Message handling (text, media, interactive)
155
+ - Group management and newsletter features
156
+ - Business API integration and webhooks
157
+ - Event system and error handling
158
+ - Advanced usage patterns and performance optimization
159
+ - Database integration and real-world use cases
160
+ - Deployment guides and troubleshooting
161
+ - API reference and migration guide
162
+
163
+ ### Examples Directory
164
+ Check the [examples/](examples/) directory for runnable code samples:
165
+
166
+ - Basic Bot: Simple echo bot with command handling
167
+ - Media Handling: Download/upload images, videos, documents
168
+ - Group Management: Admin bot for group control
169
+ - Business Features: Product catalog and ordering system
170
+ - Analytics: Bot with usage statistics and monitoring
171
+ - Deployment: Production-ready setup with Docker/PM2
172
+
173
+ ### Use Cases
174
+
175
+ Socketon is perfect for building:
176
+ - Chatbots: Customer service, entertainment, automation
177
+ - Business Applications: CRM integration, order management
178
+ - Automation Tools: Message forwarding, scheduling
179
+ - Analytics Bots: Message tracking, user engagement
180
+ - Fun Bots: Games, quizzes, interactive experiences
181
+ - E-commerce: Product catalogs, order processing
134
182
 
135
- pindah dari baileys biasanya simpel, cukup ganti import:
183
+ ---
184
+
185
+ ## Migration from Baileys
136
186
 
137
- ```js
138
- // baileys
139
- const { makeWASocket } = require('@whiskeysockets/baileys')
187
+ Migrating from Baileys is usually simple, just change the import:
140
188
 
141
- // socketon
142
- const { makeWASocket } = require('socketon')
189
+ ```javascript
190
+ // From Baileys
191
+ const { makeWASocket } = require('@whiskeysockets/baileys');
192
+
193
+ // To Socketon
194
+ const { makeWASocket } = require('socketon');
143
195
  ```
144
196
 
197
+ For detailed migration steps, see the [Migration Guide](COMPLETE_GUIDE.md#migration-guide) in the complete documentation.
198
+
145
199
  ---
146
200
 
147
- ## docs
201
+ ## Troubleshooting
148
202
 
149
- full docs dan advanced examples:
150
- - [DOCS/README.md](./DOCS/README.md)
203
+ ### Common Issues
151
204
 
152
- ---
205
+ Connection Problems:
206
+ - Check internet connection
207
+ - Ensure WhatsApp account is active
208
+ - Try deleting auth/ folder and re-authenticating
209
+
210
+ Authentication Issues:
211
+ - Delete auth folder and scan QR again
212
+ - Check file permissions on auth directory
213
+ - Ensure stable network during authentication
153
214
 
154
- ## links
215
+ Message Failures:
216
+ - Verify JID format
217
+ - Check if recipient blocked you
218
+ - Implement retry logic for reliability
155
219
 
156
- - npm: https://www.npmjs.com/package/socketon
157
- - repo: https://github.com/IbraDecode/socketon
158
- - issues: https://github.com/IbraDecode/socketon/issues
159
- - discussions: https://github.com/IbraDecode/socketon/discussions
220
+ For detailed troubleshooting, see [COMPLETE_GUIDE.md#troubleshooting](COMPLETE_GUIDE.md#troubleshooting).
160
221
 
161
222
  ---
162
223
 
163
- ## contributors
224
+ ## Contributing
225
+
226
+ We welcome contributions! Please see our [Contributing Guide](COMPLETE_GUIDE.md#contributing) for details.
227
+
228
+ 1. Fork the repository
229
+ 2. Create a feature branch
230
+ 3. Make your changes
231
+ 4. Add tests if applicable
232
+ 5. Submit a pull request
164
233
 
165
234
  <a href="https://github.com/IbraDecode/socketon/graphs/contributors">
166
235
  <img src="https://contrib.rocks/image?repo=IbraDecode/socketon" alt="contributors" />
@@ -168,16 +237,35 @@ full docs dan advanced examples:
168
237
 
169
238
  ---
170
239
 
171
- ## credits
240
+ ## License
172
241
 
173
- - original baileys by @adiwajshing
174
- - modified and maintained by kiuur & ibra decode
242
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
175
243
 
176
244
  ---
177
245
 
178
- <p align="center">
179
- star repo ini kalau bermanfaat
180
- </p>
246
+ ## Credits
247
+
248
+ - Original Baileys: [@adiwajshing/baileys](https://github.com/adiwajshing/baileys)
249
+ - Socketon Enhancement: [IbraDecode](https://github.com/IbraDecode)
250
+
251
+ ---
252
+
253
+ ## Support & Community
254
+
255
+ - **Telegram Community**: [Join our community](https://t.me/socketon)
256
+ - **GitHub Issues**: [Report bugs](https://github.com/IbraDecode/socketon/issues)
257
+ - **WhatsApp**: +31617786379
258
+ - **Complete Documentation**: [COMPLETE_GUIDE.md](COMPLETE_GUIDE.md)
259
+
260
+ ---
261
+
262
+ Ready to build your WhatsApp bot? Start with the Quick Start above, or explore the complete documentation for advanced features!
263
+
264
+ ## Version Management
265
+
266
+ See [VERSION_MANAGEMENT.md](VERSION_MANAGEMENT.md) for detailed versioning and release information.
267
+
268
+ Socketon v0.31.0 - Built by IbraDecode
181
269
 
182
270
  <p align="center">
183
271
  <a href="#readme-top">back to top</a>
package/lib/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  const chalk = require("chalk");
4
4
 
5
- console.log(chalk.magentaBright.bold("\n© Socketon - 2025 By Ibra Decode\n"));
6
- console.log(chalk.cyan(`Jika Butuh Bantuan`));
7
- console.log(chalk.red(`WhatsApp: +31617786379`));
5
+ const packageInfo = require('../package.json');
6
+ console.log(chalk.magentaBright.bold(`\n© Socketon v${packageInfo.version} - 2025 By IbraDecode`));
7
+ console.log(chalk.cyan(`Need Help? WhatsApp: +31617786379`));
8
8
  console.log(chalk.gray("------------------------------\n"));
9
9
 
10
10
 
package/package.json CHANGED
@@ -1,112 +1,130 @@
1
1
  {
2
- "name": "socketon",
3
- "version": "0.30.7",
4
- "description": "WhatsApp API Library - Socketon By IbraDecode",
5
- "keywords": [
6
- "whatsapp",
7
- "socketon",
8
- "baileys",
9
- "whatsapp-web",
10
- "whatsapp-chat",
11
- "whatsapp-group",
12
- "botwa",
13
- "whatsapp-bot",
14
- "whatsapp-api",
15
- "socketon-whatsapp"
16
- ],
17
- "homepage": "https://github.com/IbraDecode/socketon",
18
- "repository": {
19
- "url": "https://github.com/IbraDecode/socketon"
2
+ "name": "socketon",
3
+ "version": "0.31.0",
4
+ "description": "WhatsApp API Library - Socketon By IbraDecode",
5
+ "keywords": [
6
+ "whatsapp",
7
+ "socketon",
8
+ "baileys",
9
+ "whatsapp-web",
10
+ "whatsapp-chat",
11
+ "whatsapp-group",
12
+ "botwa",
13
+ "whatsapp-bot",
14
+ "whatsapp-api",
15
+ "socketon-whatsapp"
16
+ ],
17
+ "homepage": "https://github.com/IbraDecode/socketon",
18
+ "repository": {
19
+ "url": "https://github.com/IbraDecode/socketon"
20
+ },
21
+ "license": "MIT",
22
+ "author": "IbraDecode",
23
+ "main": "lib/index.js",
24
+ "types": "lib/index.d.ts",
25
+ "files": [
26
+ "lib/*",
27
+ "WAProto/*.js",
28
+ "engine-requirements.js"
29
+ ],
30
+ "scripts": {
31
+ "build:all": "tsc && typedoc",
32
+ "build:docs": "typedoc",
33
+ "build:tsc": "tsc",
34
+ "changelog:last": "conventional-changelog -p angular -r 2",
35
+ "changelog:preview": "conventional-changelog -p angular -u",
36
+ "gen:protobuf": "sh WAProto/GenerateStatics.sh",
37
+ "lint": "eslint src --ext .js,.ts,.jsx,.tsx",
38
+ "lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
39
+ "prepack": "npm run build:all && npm run lint",
40
+ "prepare": "",
41
+ "preinstall": "node ./engine-requirements.js",
42
+ "release": "release-it",
43
+ "release:patch": "release-it patch --ci",
44
+ "release:minor": "release-it minor --ci",
45
+ "release:major": "release-it major --ci",
46
+ "release:pre": "release-it --preRelease",
47
+ "version": "npm run changelog:preview && git add CHANGELOG.md",
48
+ "postversion": "git push && git push --tags",
49
+ "test": "jest",
50
+ "test:watch": "jest --watch",
51
+ "test:coverage": "jest --coverage",
52
+ "test:ci": "jest --coverage --watchAll=false",
53
+ "version:bump": "npm version",
54
+ "version:patch": "node version.js bump patch",
55
+ "version:minor": "node version.js bump minor",
56
+ "version:major": "node version.js bump major",
57
+ "version:current": "node version.js current",
58
+ "version:validate": "node version.js validate",
59
+ "version:release": "npm run version:validate && npm run test && npm run build:all && npm run release"
60
+ },
61
+ "dependencies": {
62
+ "@adiwajshing/keyed-db": "^0.2.4",
63
+ "@hapi/boom": "^9.1.3",
64
+ "@cacheable/node-cache": "^1.4.0",
65
+ "async-mutex": "^0.5.0",
66
+ "audio-decode": "^2.1.3",
67
+ "axios": "^1.3.3",
68
+ "cache-manager": "4.0.1",
69
+ "chalk": "^4.1.2",
70
+ "futoin-hkdf": "^1.5.1",
71
+ "libphonenumber-js": "^1.10.20",
72
+ "lodash": "^4.17.21",
73
+ "libsignal": "npm:@shennmine/libsignal-node@2.0.1",
74
+ "music-metadata": "^7.12.3",
75
+ "node-cache": "^5.1.2",
76
+ "node-fetch": "^2.6.1",
77
+ "pino": "^7.0.0",
78
+ "protobufjs": "^7.2.4",
79
+ "uuid": "^9.0.0",
80
+ "ws": "^8.13.0"
81
+ },
82
+ "devDependencies": {
83
+ "@eslint/js": "^9.0.0",
84
+ "eslint": "^9.0.0",
85
+ "typescript-eslint": "^8.0.0",
86
+ "@types/got": "^9.6.11",
87
+ "@types/jest": "^27.5.1",
88
+ "@types/node": "^16.0.0",
89
+ "@types/sharp": "^0.29.4",
90
+ "@types/ws": "^8.0.0",
91
+ "conventional-changelog-cli": "^4.1.0",
92
+ "eslint": "^8.0.0",
93
+ "jest": "^27.0.6",
94
+ "jimp": "^0.16.1",
95
+ "link-preview-js": "^3.0.0",
96
+ "open": "^8.4.2",
97
+ "qrcode-terminal": "^0.12.0",
98
+ "release-it": "^17.1.1",
99
+ "sharp": "^0.30.5",
100
+ "ts-jest": "^27.0.3",
101
+ "ts-node": "^10.8.1",
102
+ "typedoc": "^0.25.8",
103
+ "typescript": "^4.6.4",
104
+ "json": "^11.0.0"
105
+ },
106
+ "peerDependencies": {
107
+ "jimp": "^0.16.1",
108
+ "link-preview-js": "^3.0.0",
109
+ "qrcode-terminal": "^0.12.0",
110
+ "sharp": "^0.32.2"
111
+ },
112
+ "peerDependenciesMeta": {
113
+ "jimp": {
114
+ "optional": true
20
115
  },
21
- "license": "MIT",
22
- "author": "IbraDecode",
23
- "main": "lib/index.js",
24
- "types": "lib/index.d.ts",
25
- "files": [
26
- "lib/*",
27
- "WAProto/*.js",
28
- "engine-requirements.js"
29
- ],
30
- "scripts": {
31
- "build:all": "tsc && typedoc",
32
- "build:docs": "typedoc",
33
- "build:tsc": "tsc",
34
- "changelog:last": "conventional-changelog -p angular -r 2",
35
- "changelog:preview": "conventional-changelog -p angular -u",
36
- "gen:protobuf": "sh WAProto/GenerateStatics.sh",
37
- "lint": "eslint src --ext .js,.ts,.jsx,.tsx",
38
- "lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
39
- "prepack": "",
40
- "prepare": "",
41
- "preinstall": "node ./engine-requirements.js",
42
- "release": "release-it",
43
- "test": "jest"
116
+ "link-preview-js": {
117
+ "optional": true
44
118
  },
45
- "dependencies": {
46
- "@adiwajshing/keyed-db": "^0.2.4",
47
- "@hapi/boom": "^9.1.3",
48
- "@cacheable/node-cache": "^1.4.0",
49
- "async-mutex": "^0.5.0",
50
- "audio-decode": "^2.1.3",
51
- "axios": "^1.3.3",
52
- "cache-manager": "4.0.1",
53
- "chalk": "^4.1.2",
54
- "futoin-hkdf": "^1.5.1",
55
- "libphonenumber-js": "^1.10.20",
56
- "lodash": "^4.17.21",
57
- "libsignal": "npm:@shennmine/libsignal-node@2.0.1",
58
- "music-metadata": "^7.12.3",
59
- "node-cache": "^5.1.2",
60
- "node-fetch": "^2.6.1",
61
- "pino": "^7.0.0",
62
- "protobufjs": "^7.2.4",
63
- "uuid": "^9.0.0",
64
- "ws": "^8.13.0"
119
+ "qrcode-terminal": {
120
+ "optional": true
65
121
  },
66
- "devDependencies": {
67
- "@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
68
- "@types/got": "^9.6.11",
69
- "@types/jest": "^27.5.1",
70
- "@types/node": "^16.0.0",
71
- "@types/sharp": "^0.29.4",
72
- "@types/ws": "^8.0.0",
73
- "conventional-changelog-cli": "^2.2.2",
74
- "eslint": "^8.0.0",
75
- "jest": "^27.0.6",
76
- "jimp": "^0.16.1",
77
- "link-preview-js": "^3.0.0",
78
- "open": "^8.4.2",
79
- "qrcode-terminal": "^0.12.0",
80
- "release-it": "^15.10.3",
81
- "sharp": "^0.30.5",
82
- "ts-jest": "^27.0.3",
83
- "ts-node": "^10.8.1",
84
- "typedoc": "^0.24.7",
85
- "typescript": "^4.6.4",
86
- "json": "^11.0.0"
87
- },
88
- "peerDependencies": {
89
- "jimp": "^0.16.1",
90
- "link-preview-js": "^3.0.0",
91
- "qrcode-terminal": "^0.12.0",
92
- "sharp": "^0.32.2"
93
- },
94
- "peerDependenciesMeta": {
95
- "jimp": {
96
- "optional": true
97
- },
98
- "link-preview-js": {
99
- "optional": true
100
- },
101
- "qrcode-terminal": {
102
- "optional": true
103
- },
104
- "sharp": {
105
- "optional": true
106
- }
107
- },
108
- "packageManager": "yarn@1.22.19",
109
- "engines": {
110
- "node": ">=20.0.0"
122
+ "sharp": {
123
+ "optional": true
111
124
  }
112
- }
125
+ },
126
+ "packageManager": "yarn@1.22.19",
127
+ "engines": {
128
+ "node": ">=20.0.0"
129
+ }
130
+ }