wolfsocket 1.0.7 → 1.0.8
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 +144 -144
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
# wolfsocket
|
|
2
|
-
|
|
3
|
-
`wolfsocket` is a [Baileys](https://github.com/WhiskeySockets/Baileys) fork maintained by **WOLF TECH**. It preserves the upstream API while adding native group-status messages, enhanced sticker fields, and native WhatsApp table rendering for Markdown AI responses.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install wolfsocket
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
The package is ESM and requires Node.js 20 or newer.
|
|
12
|
-
|
|
13
|
-
## Quick start
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import makeWASocket, { useMultiFileAuthState } from 'wolfsocket'
|
|
17
|
-
|
|
18
|
-
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
|
|
19
|
-
const sock = makeWASocket({ auth: state })
|
|
20
|
-
sock.ev.on('creds.update', saveCreds)
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Native Markdown tables
|
|
24
|
-
|
|
25
|
-
Send an AI response containing Markdown pipe tables through `markdownTable`. WhatsApp renders each detected table with its native rich-table interface while preserving surrounding prose.
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
const aiResponse = `Current plans:
|
|
29
|
-
|
|
30
|
-
| Plan | Storage | Price |
|
|
31
|
-
| --- | ---: | ---: |
|
|
32
|
-
| Basic | 10 GB | $5 |
|
|
33
|
-
| Pro | 100 GB | $15 |
|
|
34
|
-
|
|
35
|
-
Choose the plan that works for you.`
|
|
36
|
-
|
|
37
|
-
await sock.sendMessage(jid, {
|
|
38
|
-
markdownTable: aiResponse,
|
|
39
|
-
tableTitle: 'Plan comparison'
|
|
40
|
-
})
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Supported behavior:
|
|
44
|
-
|
|
45
|
-
- Multiple tables in one response
|
|
46
|
-
- Text before, between, and after tables
|
|
47
|
-
- Native heading and data rows
|
|
48
|
-
- Escaped pipe characters (`\|`)
|
|
49
|
-
- Optional title for the first table
|
|
50
|
-
- Validation that every row has the same number of columns
|
|
51
|
-
|
|
52
|
-
The lower-level helpers are also exported:
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
import { parseMarkdownTables, markdownToAIRichResponse } from 'wolfsocket'
|
|
56
|
-
|
|
57
|
-
const submessages = parseMarkdownTables(markdown, { title: 'Results' })
|
|
58
|
-
const richResponse = markdownToAIRichResponse(markdown, { title: 'Results' })
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Article cards
|
|
62
|
-
|
|
63
|
-
Send a WhatsApp external-ad reply card with `sock.sendArticleCard()`. The card metadata is encoded in `contextInfo.externalAdReply`.
|
|
64
|
-
|
|
65
|
-
```js
|
|
66
|
-
await sock.sendArticleCard(jid, {
|
|
67
|
-
text: 'Learn more in these articles:',
|
|
68
|
-
title: 'How to create and share a status',
|
|
69
|
-
body: 'WhatsApp Help Center',
|
|
70
|
-
url: 'https://faq.whatsapp.com/123456',
|
|
71
|
-
thumbnailUrl: 'https://example.com/help-center.png',
|
|
72
|
-
mediaType: 1,
|
|
73
|
-
renderLargerThumbnail: true,
|
|
74
|
-
showAdAttribution: true
|
|
75
|
-
})
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
`text`, `body`, and `thumbnailUrl` are optional. `mediaType` accepts the protobuf image (`1`) or video (`2`) value. WhatsApp controls the final card appearance and attribution label.
|
|
79
|
-
|
|
80
|
-
## Group status
|
|
81
|
-
|
|
82
|
-
`sendGroupStatus()` posts an update visible only inside a particular WhatsApp group. The group JID must end in `@g.us`.
|
|
83
|
-
|
|
84
|
-
```js
|
|
85
|
-
await sock.sendGroupStatus(groupJid, { text: 'Hello, group!' })
|
|
86
|
-
|
|
87
|
-
await sock.sendGroupStatus(groupJid, {
|
|
88
|
-
image: imageBuffer,
|
|
89
|
-
caption: 'New image'
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
await sock.sendGroupStatus(groupJid, {
|
|
93
|
-
video: videoBuffer,
|
|
94
|
-
caption: 'New video'
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
await sock.sendGroupStatus(groupJid, {
|
|
98
|
-
audio: audioBuffer,
|
|
99
|
-
mimetype: 'audio/ogg; codecs=opus',
|
|
100
|
-
ptt: true
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
await sock.sendGroupStatus(groupJid, { sticker: stickerBuffer })
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### `sock.sendGroupStatus(jid, content)`
|
|
107
|
-
|
|
108
|
-
| Parameter | Type | Description |
|
|
109
|
-
| --- | --- | --- |
|
|
110
|
-
| `jid` | `string` | Target group JID (`...@g.us`) |
|
|
111
|
-
| `content` | `AnyMessageContent` | Content accepted by `sock.sendMessage()` |
|
|
112
|
-
|
|
113
|
-
Returns a `Promise<WAMessage>` containing the sent message key.
|
|
114
|
-
|
|
115
|
-
## Enhanced sticker fields
|
|
116
|
-
|
|
117
|
-
The regular message API supports additional sticker properties represented by the current WhatsApp protobuf:
|
|
118
|
-
|
|
119
|
-
```js
|
|
120
|
-
await sock.sendMessage(jid, {
|
|
121
|
-
sticker: webpBuffer,
|
|
122
|
-
isAiSticker: true,
|
|
123
|
-
isAvatar: false,
|
|
124
|
-
isLottie: false,
|
|
125
|
-
accessibilityLabel: 'AI-generated sticker'
|
|
126
|
-
})
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
These fields do not convert a WebP file into WhatsApp's signed premium `application/was` sticker format.
|
|
130
|
-
|
|
131
|
-
## Differences from upstream Baileys
|
|
132
|
-
|
|
133
|
-
- Adds `sock.sendGroupStatus()` for text and media group-status updates.
|
|
134
|
-
- Adds Markdown-to-native-table parsing through the `markdownTable` message property.
|
|
135
|
-
- Adds `sock.sendArticleCard()` for external-ad reply article cards.
|
|
136
|
-
- Exports `parseMarkdownTables()` and `markdownToAIRichResponse()`.
|
|
137
|
-
- Supports enhanced sticker protobuf fields.
|
|
138
|
-
- Fixes media stanza detection required by group-status messages.
|
|
139
|
-
|
|
140
|
-
All other standard Baileys APIs remain available.
|
|
141
|
-
|
|
142
|
-
## License
|
|
143
|
-
|
|
144
|
-
MIT. See [LICENSE](./LICENSE). The original Baileys copyright notice is preserved. Modifications by Briton Kiplangat (Silent Wolf) / WOLF TECH are licensed under the same terms.
|
|
1
|
+
# wolfsocket
|
|
2
|
+
|
|
3
|
+
`wolfsocket` is a [Baileys](https://github.com/WhiskeySockets/Baileys) fork maintained by **WOLF TECH**. It preserves the upstream API while adding native group-status messages, enhanced sticker fields, and native WhatsApp table rendering for Markdown AI responses.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install wolfsocket
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package is ESM and requires Node.js 20 or newer.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import makeWASocket, { useMultiFileAuthState } from 'wolfsocket'
|
|
17
|
+
|
|
18
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
|
|
19
|
+
const sock = makeWASocket({ auth: state })
|
|
20
|
+
sock.ev.on('creds.update', saveCreds)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Native Markdown tables
|
|
24
|
+
|
|
25
|
+
Send an AI response containing Markdown pipe tables through `markdownTable`. WhatsApp renders each detected table with its native rich-table interface while preserving surrounding prose.
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const aiResponse = `Current plans:
|
|
29
|
+
|
|
30
|
+
| Plan | Storage | Price |
|
|
31
|
+
| --- | ---: | ---: |
|
|
32
|
+
| Basic | 10 GB | $5 |
|
|
33
|
+
| Pro | 100 GB | $15 |
|
|
34
|
+
|
|
35
|
+
Choose the plan that works for you.`
|
|
36
|
+
|
|
37
|
+
await sock.sendMessage(jid, {
|
|
38
|
+
markdownTable: aiResponse,
|
|
39
|
+
tableTitle: 'Plan comparison'
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Supported behavior:
|
|
44
|
+
|
|
45
|
+
- Multiple tables in one response
|
|
46
|
+
- Text before, between, and after tables
|
|
47
|
+
- Native heading and data rows
|
|
48
|
+
- Escaped pipe characters (`\|`)
|
|
49
|
+
- Optional title for the first table
|
|
50
|
+
- Validation that every row has the same number of columns
|
|
51
|
+
|
|
52
|
+
The lower-level helpers are also exported:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import { parseMarkdownTables, markdownToAIRichResponse } from 'wolfsocket'
|
|
56
|
+
|
|
57
|
+
const submessages = parseMarkdownTables(markdown, { title: 'Results' })
|
|
58
|
+
const richResponse = markdownToAIRichResponse(markdown, { title: 'Results' })
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Article cards
|
|
62
|
+
|
|
63
|
+
Send a WhatsApp external-ad reply card with `sock.sendArticleCard()`. The card metadata is encoded in `contextInfo.externalAdReply`.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
await sock.sendArticleCard(jid, {
|
|
67
|
+
text: 'Learn more in these articles:',
|
|
68
|
+
title: 'How to create and share a status',
|
|
69
|
+
body: 'WhatsApp Help Center',
|
|
70
|
+
url: 'https://faq.whatsapp.com/123456',
|
|
71
|
+
thumbnailUrl: 'https://example.com/help-center.png',
|
|
72
|
+
mediaType: 1,
|
|
73
|
+
renderLargerThumbnail: true,
|
|
74
|
+
showAdAttribution: true
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`text`, `body`, and `thumbnailUrl` are optional. `mediaType` accepts the protobuf image (`1`) or video (`2`) value. WhatsApp controls the final card appearance and attribution label.
|
|
79
|
+
|
|
80
|
+
## Group status
|
|
81
|
+
|
|
82
|
+
`sendGroupStatus()` posts an update visible only inside a particular WhatsApp group. The group JID must end in `@g.us`.
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
await sock.sendGroupStatus(groupJid, { text: 'Hello, group!' })
|
|
86
|
+
|
|
87
|
+
await sock.sendGroupStatus(groupJid, {
|
|
88
|
+
image: imageBuffer,
|
|
89
|
+
caption: 'New image'
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
await sock.sendGroupStatus(groupJid, {
|
|
93
|
+
video: videoBuffer,
|
|
94
|
+
caption: 'New video'
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
await sock.sendGroupStatus(groupJid, {
|
|
98
|
+
audio: audioBuffer,
|
|
99
|
+
mimetype: 'audio/ogg; codecs=opus',
|
|
100
|
+
ptt: true
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
await sock.sendGroupStatus(groupJid, { sticker: stickerBuffer })
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `sock.sendGroupStatus(jid, content)`
|
|
107
|
+
|
|
108
|
+
| Parameter | Type | Description |
|
|
109
|
+
| --- | --- | --- |
|
|
110
|
+
| `jid` | `string` | Target group JID (`...@g.us`) |
|
|
111
|
+
| `content` | `AnyMessageContent` | Content accepted by `sock.sendMessage()` |
|
|
112
|
+
|
|
113
|
+
Returns a `Promise<WAMessage>` containing the sent message key.
|
|
114
|
+
|
|
115
|
+
## Enhanced sticker fields
|
|
116
|
+
|
|
117
|
+
The regular message API supports additional sticker properties represented by the current WhatsApp protobuf:
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
await sock.sendMessage(jid, {
|
|
121
|
+
sticker: webpBuffer,
|
|
122
|
+
isAiSticker: true,
|
|
123
|
+
isAvatar: false,
|
|
124
|
+
isLottie: false,
|
|
125
|
+
accessibilityLabel: 'AI-generated sticker'
|
|
126
|
+
})
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
These fields do not convert a WebP file into WhatsApp's signed premium `application/was` sticker format.
|
|
130
|
+
|
|
131
|
+
## Differences from upstream Baileys
|
|
132
|
+
|
|
133
|
+
- Adds `sock.sendGroupStatus()` for text and media group-status updates.
|
|
134
|
+
- Adds Markdown-to-native-table parsing through the `markdownTable` message property.
|
|
135
|
+
- Adds `sock.sendArticleCard()` for external-ad reply article cards.
|
|
136
|
+
- Exports `parseMarkdownTables()` and `markdownToAIRichResponse()`.
|
|
137
|
+
- Supports enhanced sticker protobuf fields.
|
|
138
|
+
- Fixes media stanza detection required by group-status messages.
|
|
139
|
+
|
|
140
|
+
All other standard Baileys APIs remain available.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT. See [LICENSE](./LICENSE). The original Baileys copyright notice is preserved. Modifications by Briton Kiplangat (Silent Wolf) / WOLF TECH are licensed under the same terms.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wolfsocket",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.8",
|
|
5
5
|
"description": "WOLF TECH fork of Baileys with native Group Status (groupStatusMessageV2) support for text, image, video, audio, and sticker posts.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|