socketon 0.31.0 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -242
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +3345 -0
- package/WAProto/index.d.ts +37016 -0
- package/lib/Socket/business.d.ts +1 -1
- package/lib/Socket/chats.d.ts +1 -1
- package/lib/Socket/chats.js +28 -15
- package/lib/Socket/groups.d.ts +1 -1
- package/lib/Socket/{dugong.js → ibranihbossenggoldong.js} +10 -10
- package/lib/Socket/index.d.ts +1 -1
- package/lib/Socket/messages-send.d.ts +1 -1
- package/lib/Socket/messages-send.js +55 -55
- package/lib/Socket/newsletter.d.ts +1 -1
- package/lib/Socket/newsletter.js +63 -14
- package/lib/Socket/registration.d.ts +1 -1
- package/lib/Socket/socket.d.ts +1 -1
- package/lib/Socket/socket.js +26 -21
- package/lib/Socket/usync.d.ts +1 -1
- package/lib/Utils/generics.js +1 -78
- package/lib/Utils/messages.js +1 -0
- package/lib/index.js +9 -7
- package/package.json +106 -124
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,50 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://camo.githubusercontent.com/aeb57cb85f8b46c9828d450dcf3d9f79abf68c2f273446ec20fb00c813c9e59b/68747470733a2f2f66696c65732e636174626f782e6d6f652f30776c3870792e706e67" alt="Socketon Banner" width="100%">
|
|
3
|
+
</div>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
<img src="https://files.catbox.moe/0wl8py.png" alt="socketon" width="320" />
|
|
5
|
-
</p>
|
|
5
|
+
# Socketon
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
</p>
|
|
7
|
+
**WhatsApp API Modification** - Advanced WhatsApp integration library with enhanced features and security.
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
<a href="https://www.npmjs.com/package/socketon">
|
|
13
|
-
<img src="https://img.shields.io/npm/v/socketon" />
|
|
14
|
-
</a>
|
|
15
|
-
<a href="https://www.npmjs.com/package/socketon">
|
|
16
|
-
<img src="https://img.shields.io/npm/dm/socketon" />
|
|
17
|
-
</a>
|
|
18
|
-
<a href="./LICENSE">
|
|
19
|
-
<img src="https://img.shields.io/npm/l/socketon" />
|
|
20
|
-
</a>
|
|
21
|
-
</p>
|
|
9
|
+
## Description
|
|
22
10
|
|
|
23
|
-
|
|
11
|
+
Socketon is a powerful WhatsApp API modification designed for building robust messaging applications. It provides enhanced features for managing conversations, automating responses, and integrating with various services.
|
|
24
12
|
|
|
25
|
-
##
|
|
13
|
+
## Features
|
|
26
14
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
46
|
-
|
|
47
|
-
---
|
|
15
|
+
- WhatsApp message automation
|
|
16
|
+
- Group management capabilities
|
|
17
|
+
- Interactive message support
|
|
18
|
+
- Session management
|
|
19
|
+
- Custom pairing process
|
|
20
|
+
- Multi-device compatibility
|
|
21
|
+
- Advanced security features
|
|
48
22
|
|
|
49
23
|
## Installation
|
|
50
24
|
|
|
@@ -52,221 +26,38 @@ This is a fork of Baileys focused on stability, session handling, and more flexi
|
|
|
52
26
|
npm install socketon
|
|
53
27
|
```
|
|
54
28
|
|
|
55
|
-
|
|
56
|
-
- Node.js >= 20.0.0
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Quick Start
|
|
61
|
-
|
|
62
|
-
### Basic Echo Bot
|
|
63
|
-
|
|
64
|
-
```javascript
|
|
65
|
-
const { makeWASocket, useMultiFileAuthState } = require('socketon');
|
|
66
|
-
|
|
67
|
-
async function startBot() {
|
|
68
|
-
// Setup authentication
|
|
69
|
-
const { state, saveCreds } = await useMultiFileAuthState('./auth');
|
|
70
|
-
|
|
71
|
-
// Create WhatsApp socket
|
|
72
|
-
const sock = makeWASocket({
|
|
73
|
-
auth: state,
|
|
74
|
-
printQRInTerminal: true
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Handle connection
|
|
78
|
-
sock.ev.on('connection.update', (update) => {
|
|
79
|
-
const { connection, qr } = update;
|
|
80
|
-
|
|
81
|
-
if (qr) console.log('Scan QR Code:', qr);
|
|
82
|
-
if (connection === 'open') console.log('Connected to WhatsApp!');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// Handle messages
|
|
86
|
-
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
87
|
-
for (const msg of messages) {
|
|
88
|
-
if (msg.key.fromMe) continue;
|
|
89
|
-
|
|
90
|
-
const jid = msg.key.remoteJid;
|
|
91
|
-
const text = msg.message?.conversation || msg.message?.extendedTextMessage?.text || '';
|
|
92
|
-
|
|
93
|
-
console.log(`Message from ${jid}: ${text}`);
|
|
94
|
-
|
|
95
|
-
// Echo response
|
|
96
|
-
if (text) {
|
|
97
|
-
await sock.sendMessage(jid, { text: `Echo: ${text}` });
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// Save credentials
|
|
103
|
-
sock.ev.on('creds.update', saveCreds);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
startBot().catch(console.error);
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Pairing Code Authentication
|
|
110
|
-
|
|
111
|
-
```javascript
|
|
112
|
-
const { makeWASocket, useMultiFileAuthState } = require('socketon');
|
|
113
|
-
|
|
114
|
-
async function startWithPairing() {
|
|
115
|
-
const { state, saveCreds } = await useMultiFileAuthState('./auth');
|
|
116
|
-
|
|
117
|
-
const sock = makeWASocket({
|
|
118
|
-
auth: state,
|
|
119
|
-
printQRInTerminal: false // Disable QR, use pairing code
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
sock.ev.on('connection.update', async (update) => {
|
|
123
|
-
const { connection } = update;
|
|
124
|
-
|
|
125
|
-
if (connection === 'open') {
|
|
126
|
-
// Use default "SOCKETON" pairing code
|
|
127
|
-
const pairingCode = await sock.requestPairingCode('6281234567890');
|
|
128
|
-
console.log('Pairing Code:', pairingCode);
|
|
129
|
-
|
|
130
|
-
// Or use custom pairing code
|
|
131
|
-
// const customCode = await sock.requestPairingCode('6281234567890', 'MYCODE');
|
|
132
|
-
// console.log('Custom Pairing Code:', customCode);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
sock.ev.on('creds.update', saveCreds);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
startWithPairing().catch(console.error);
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
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
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## Migration from Baileys
|
|
186
|
-
|
|
187
|
-
Migrating from Baileys is usually simple, just change the import:
|
|
29
|
+
## Usage
|
|
188
30
|
|
|
189
31
|
```javascript
|
|
190
|
-
// From Baileys
|
|
191
|
-
const { makeWASocket } = require('@whiskeysockets/baileys');
|
|
192
|
-
|
|
193
|
-
// To Socketon
|
|
194
32
|
const { makeWASocket } = require('socketon');
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
For detailed migration steps, see the [Migration Guide](COMPLETE_GUIDE.md#migration-guide) in the complete documentation.
|
|
198
33
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
|
214
|
-
|
|
215
|
-
Message Failures:
|
|
216
|
-
- Verify JID format
|
|
217
|
-
- Check if recipient blocked you
|
|
218
|
-
- Implement retry logic for reliability
|
|
219
|
-
|
|
220
|
-
For detailed troubleshooting, see [COMPLETE_GUIDE.md#troubleshooting](COMPLETE_GUIDE.md#troubleshooting).
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
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
|
|
34
|
+
// Initialize the socket
|
|
35
|
+
const sock = makeWASocket({
|
|
36
|
+
// Configuration options
|
|
37
|
+
});
|
|
38
|
+
```
|
|
233
39
|
|
|
234
|
-
|
|
235
|
-
<img src="https://contrib.rocks/image?repo=IbraDecode/socketon" alt="contributors" />
|
|
236
|
-
</a>
|
|
40
|
+
## Version
|
|
237
41
|
|
|
238
|
-
|
|
42
|
+
**1.6.0**
|
|
239
43
|
|
|
240
44
|
## License
|
|
241
45
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
## Credits
|
|
247
|
-
|
|
248
|
-
- Original Baileys: [@adiwajshing/baileys](https://github.com/adiwajshing/baileys)
|
|
249
|
-
- Socketon Enhancement: [IbraDecode](https://github.com/IbraDecode)
|
|
250
|
-
|
|
251
|
-
---
|
|
46
|
+
MIT
|
|
252
47
|
|
|
253
|
-
##
|
|
48
|
+
## Author
|
|
254
49
|
|
|
255
|
-
|
|
256
|
-
- **GitHub Issues**: [Report bugs](https://github.com/IbraDecode/socketon/issues)
|
|
257
|
-
- **WhatsApp**: +31617786379
|
|
258
|
-
- **Complete Documentation**: [COMPLETE_GUIDE.md](COMPLETE_GUIDE.md)
|
|
50
|
+
Ibra Decode
|
|
259
51
|
|
|
260
|
-
|
|
52
|
+
## Repository
|
|
261
53
|
|
|
262
|
-
|
|
54
|
+
https://www.npmjs.com/package/socketon
|
|
263
55
|
|
|
264
|
-
##
|
|
56
|
+
## Dependencies
|
|
265
57
|
|
|
266
|
-
|
|
58
|
+
- node >=20.0.0
|
|
59
|
+
- Various security-enhanced modules
|
|
267
60
|
|
|
268
|
-
|
|
61
|
+
## Notes
|
|
269
62
|
|
|
270
|
-
|
|
271
|
-
<a href="#readme-top">back to top</a>
|
|
272
|
-
</p>
|
|
63
|
+
This library is intended for legitimate use cases only. Please respect WhatsApp's Terms of Service when using this library.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
yarn pbjs -t static-module -w commonjs -o ./WAProto/index.js ./WAProto/WAProto.proto;
|
|
2
|
+
yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
|
|
3
|
+
|
|
4
|
+
#protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=env=node,useOptionals=true,forceLong=long --ts_proto_out=. ./src/Binary/WAMessage.proto;
|