plogme 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.
Files changed (154) hide show
  1. package/LICENSE +61 -0
  2. package/README.md +212 -0
  3. package/WAProto/V +1 -0
  4. package/WAProto/WAProto.proto +8051 -0
  5. package/WAProto/index.js +289292 -0
  6. package/engine-requirements.js +51 -0
  7. package/lib/Defaults/ban-checker.js +44 -0
  8. package/lib/Defaults/index.js +158 -0
  9. package/lib/Signal/Group/ciphertext-message.js +11 -0
  10. package/lib/Signal/Group/group-session-builder.js +29 -0
  11. package/lib/Signal/Group/group_cipher.js +81 -0
  12. package/lib/Signal/Group/index.js +11 -0
  13. package/lib/Signal/Group/keyhelper.js +17 -0
  14. package/lib/Signal/Group/sender-chain-key.js +25 -0
  15. package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
  16. package/lib/Signal/Group/sender-key-message.js +65 -0
  17. package/lib/Signal/Group/sender-key-name.js +47 -0
  18. package/lib/Signal/Group/sender-key-record.js +40 -0
  19. package/lib/Signal/Group/sender-key-state.js +83 -0
  20. package/lib/Signal/Group/sender-message-key.js +25 -0
  21. package/lib/Signal/libsignal.js +428 -0
  22. package/lib/Signal/lid-mapping.js +280 -0
  23. package/lib/Socket/Client/index.js +2 -0
  24. package/lib/Socket/Client/types.js +10 -0
  25. package/lib/Socket/Client/websocket.js +53 -0
  26. package/lib/Socket/aigroups.js +315 -0
  27. package/lib/Socket/ban-checker.js +153 -0
  28. package/lib/Socket/business.js +407 -0
  29. package/lib/Socket/chats.js +1831 -0
  30. package/lib/Socket/chats.js[old] +1227 -0
  31. package/lib/Socket/communities.js +431 -0
  32. package/lib/Socket/graphql.js +899 -0
  33. package/lib/Socket/groups.js +549 -0
  34. package/lib/Socket/groups.js[old] +347 -0
  35. package/lib/Socket/index.js +71 -0
  36. package/lib/Socket/interactive-handler.js +600 -0
  37. package/lib/Socket/interop.js +563 -0
  38. package/lib/Socket/managed-account.js +208 -0
  39. package/lib/Socket/messages-recv.js +2144 -0
  40. package/lib/Socket/messages-send.js +2650 -0
  41. package/lib/Socket/messages-send.js[latest working] +1759 -0
  42. package/lib/Socket/mex.js +41 -0
  43. package/lib/Socket/newsletter.js +226 -0
  44. package/lib/Socket/privacy.js +446 -0
  45. package/lib/Socket/registration.js +428 -0
  46. package/lib/Socket/socket.js +1050 -0
  47. package/lib/Socket/username.js +229 -0
  48. package/lib/Store/index.js +4 -0
  49. package/lib/Store/make-cache-manager-store.js +89 -0
  50. package/lib/Store/make-in-memory-store.js +420 -0
  51. package/lib/Store/make-ordered-dictionary.js +78 -0
  52. package/lib/Store/object-repository.js +23 -0
  53. package/lib/Types/Auth.js +1 -0
  54. package/lib/Types/Bussines.js +1 -0
  55. package/lib/Types/Call.js +1 -0
  56. package/lib/Types/Chat.js +7 -0
  57. package/lib/Types/Contact.js +1 -0
  58. package/lib/Types/Events.js +1 -0
  59. package/lib/Types/GroupMetadata.js +1 -0
  60. package/lib/Types/Label.js +24 -0
  61. package/lib/Types/LabelAssociation.js +6 -0
  62. package/lib/Types/Message.js +17 -0
  63. package/lib/Types/Mex.js +39 -0
  64. package/lib/Types/Product.js +1 -0
  65. package/lib/Types/RichType.js +22 -0
  66. package/lib/Types/Signal.js +1 -0
  67. package/lib/Types/Socket.js +2 -0
  68. package/lib/Types/State.js +48 -0
  69. package/lib/Types/USync.js +1 -0
  70. package/lib/Types/index.js +25 -0
  71. package/lib/Utils/auth-utils.js +301 -0
  72. package/lib/Utils/bot-planning-replay.js +169 -0
  73. package/lib/Utils/browser-utils.js +28 -0
  74. package/lib/Utils/business.js +230 -0
  75. package/lib/Utils/channel-policy.js +1 -0
  76. package/lib/Utils/chat-utils.js +885 -0
  77. package/lib/Utils/chat-utils.js[old] +871 -0
  78. package/lib/Utils/companion-reg-client-utils.js +32 -0
  79. package/lib/Utils/consumer-application.js +102 -0
  80. package/lib/Utils/crypto.js +117 -0
  81. package/lib/Utils/decode-wa-message.js +484 -0
  82. package/lib/Utils/event-buffer.js +589 -0
  83. package/lib/Utils/games/slot-machine.js +258 -0
  84. package/lib/Utils/games/website-preview.js +293 -0
  85. package/lib/Utils/generics.js +390 -0
  86. package/lib/Utils/generics.js@old +385 -0
  87. package/lib/Utils/group-history.js +56 -0
  88. package/lib/Utils/history.js +130 -0
  89. package/lib/Utils/identity-change-handler.js +48 -0
  90. package/lib/Utils/index.js +35 -0
  91. package/lib/Utils/integrity.js +296 -0
  92. package/lib/Utils/jid-display-normalization.js +209 -0
  93. package/lib/Utils/link-preview.js +84 -0
  94. package/lib/Utils/logger.js +2 -0
  95. package/lib/Utils/lt-hash.js +7 -0
  96. package/lib/Utils/make-mutex.js +32 -0
  97. package/lib/Utils/message-composer.js +467 -0
  98. package/lib/Utils/message-inspect.js +67 -0
  99. package/lib/Utils/message-retry-manager.js +241 -0
  100. package/lib/Utils/messages-media.js +1006 -0
  101. package/lib/Utils/messages-media.js[old] +916 -0
  102. package/lib/Utils/messages.js +1982 -0
  103. package/lib/Utils/messages.js[old] +1902 -0
  104. package/lib/Utils/meta-ai-msmsg.js +130 -0
  105. package/lib/Utils/meta-compositing.js +202 -0
  106. package/lib/Utils/native-flow.js +100 -0
  107. package/lib/Utils/noise-handler.js +200 -0
  108. package/lib/Utils/offline-node-processor.js +39 -0
  109. package/lib/Utils/pre-key-manager.js +105 -0
  110. package/lib/Utils/process-message.js +582 -0
  111. package/lib/Utils/reporting-utils.js +257 -0
  112. package/lib/Utils/rich-message-utils.js +942 -0
  113. package/lib/Utils/rich-message-utils.js[Old] +387 -0
  114. package/lib/Utils/signal.js +200 -0
  115. package/lib/Utils/stanza-ack.js +37 -0
  116. package/lib/Utils/sync-action-utils.js +47 -0
  117. package/lib/Utils/tc-token-utils.js +162 -0
  118. package/lib/Utils/use-multi-file-auth-state.js +120 -0
  119. package/lib/Utils/use-single-file-auth-state.js +96 -0
  120. package/lib/Utils/use-sqlite-auth-state.js +108 -0
  121. package/lib/Utils/validate-connection.js +206 -0
  122. package/lib/Utils/view-once-utils.js +206 -0
  123. package/lib/Utils/voip-rekey.js +20 -0
  124. package/lib/Utils/welcome-flow.js +220 -0
  125. package/lib/WABinary/constants.js +1463 -0
  126. package/lib/WABinary/decode.js +261 -0
  127. package/lib/WABinary/encode.js +219 -0
  128. package/lib/WABinary/generic-utils.js +227 -0
  129. package/lib/WABinary/index.js +5 -0
  130. package/lib/WABinary/jid-utils.js +95 -0
  131. package/lib/WABinary/types.js +1 -0
  132. package/lib/WAM/BinaryInfo.js +9 -0
  133. package/lib/WAM/constants.js +22852 -0
  134. package/lib/WAM/encode.js +149 -0
  135. package/lib/WAM/index.js +3 -0
  136. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +96 -0
  137. package/lib/WAUSync/Protocols/USyncContactProtocol.js +56 -0
  138. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
  139. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
  140. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +70 -0
  141. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +28 -0
  142. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +25 -0
  143. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
  144. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +34 -0
  145. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
  146. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
  147. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
  148. package/lib/WAUSync/Protocols/index.js +12 -0
  149. package/lib/WAUSync/USyncQuery.js +201 -0
  150. package/lib/WAUSync/USyncUser.js +54 -0
  151. package/lib/WAUSync/index.js +3 -0
  152. package/lib/index.d.ts +406 -0
  153. package/lib/index.js +11 -0
  154. package/package.json +125 -0
package/LICENSE ADDED
@@ -0,0 +1,61 @@
1
+ CRYSNOVAX SOURCE LICENSE
2
+ Version 1.0
3
+ License identifier: Crysnovax Source License v1.0
4
+
5
+ Copyright (c) 2026 Crysnovax — @crysnovax/baileys
6
+
7
+ Preamble
8
+ --------
9
+ This software is the result of substantial original work by Crysnovax.
10
+ It is distributed under a restricted license that protects the author's
11
+ attribution rights. It is NOT the MIT license and intentionally does
12
+ not grant the same freedoms.
13
+
14
+ 1. Permitted Use
15
+ You may use, run, and modify this software for your own personal or
16
+ non-commercial purposes, including private bot projects, prototypes,
17
+ and internal tooling, provided that all copyright and attribution
18
+ notices are preserved.
19
+
20
+ 2. Attribution Requirement
21
+ Any copy, fork, modified version, or derivative of this software must
22
+ retain, visibly and unmodified, in the source code, documentation,
23
+ and any user-facing material (bot menus, footers, README files,
24
+ sticker pack metadata, etc.):
25
+ - the original package name, or an explicit credit line reading
26
+ "Based on @crysnovax/baileys by Crysnovax",
27
+ - this license text,
28
+ - the copyright notice above.
29
+
30
+ 3. Prohibited Conduct
31
+ You may NOT, without the prior written permission of Crysnovax:
32
+ - rename, rebrand, or republish this software or substantial
33
+ portions of it under a different name or author,
34
+ - remove, obscure, or alter any attribution, watermark, integrity
35
+ check, or branding enforcement contained in the software,
36
+ - sell, license, sublicense, or commercially redistribute this
37
+ software or substantial portions of it,
38
+ - use AI tools, automated rewriting, or any other means to strip
39
+ attribution and claim the work as your own.
40
+
41
+ 4. Enforcement
42
+ This software contains integrity and attribution checks. Tampering
43
+ with, deleting, or circumventing them does not grant you any rights
44
+ under this license. Violations may be pursued to the fullest extent
45
+ permitted by law, including copyright claims, DMCA takedowns, and
46
+ platform (npm, GitHub) abuse reports.
47
+
48
+ 5. No Warranty
49
+ THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
50
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
51
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
52
+ NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
53
+ BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN
54
+ ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN
55
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
+ SOFTWARE.
57
+
58
+ 6. Termination
59
+ Any violation of this license automatically terminates your rights
60
+ to use, copy, or modify the software. Upon termination you must
61
+ delete all copies in your possession.
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ # plogme
2
+
3
+ A Node.js WhatsApp Web API client for building messaging integrations with authentication, media transfer, groups, interactive messages, status updates, and rich message composition.
4
+
5
+ > **Package naming note:** npm scoped packages require a scope and package name. The valid package form is `plogme`; the bare string `@plogme` is a scope, not an installable package name by itself.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install plogme
11
+ ```
12
+
13
+ For a repository checkout:
14
+
15
+ ```bash
16
+ npm install github:crysnovax/baileys
17
+ ```
18
+
19
+ ## Requirements
20
+
21
+ The package supports current Node.js LTS releases. Use Node.js 20 or newer for the latest runtime and dependency compatibility.
22
+
23
+ ## Quick start
24
+
25
+ ```js
26
+ import {
27
+ makeWASocket,
28
+ DisconnectReason,
29
+ useMultiFileAuthState
30
+ } from 'plogme'
31
+ import { Boom } from '@hapi/boom'
32
+ import pino from 'pino'
33
+
34
+ async function start() {
35
+ const { state, saveCreds } = await useMultiFileAuthState('./session')
36
+ const socket = makeWASocket({
37
+ auth: state,
38
+ logger: pino({ level: 'silent' })
39
+ })
40
+
41
+ socket.ev.on('creds.update', saveCreds)
42
+ socket.ev.on('connection.update', ({ connection, lastDisconnect }) => {
43
+ if (connection === 'open') console.log('Connected')
44
+ if (connection === 'close') {
45
+ const status = new Boom(lastDisconnect?.error)?.output?.statusCode
46
+ if (status !== DisconnectReason.loggedOut) start()
47
+ }
48
+ })
49
+
50
+ socket.ev.on('messages.upsert', async ({ messages }) => {
51
+ const message = messages[0]
52
+ if (!message?.message) return
53
+ await socket.sendMessage(message.key.remoteJid, { text: 'Hello from plogme' })
54
+ })
55
+ }
56
+
57
+ start()
58
+ ```
59
+
60
+ ## Authentication
61
+
62
+ The recommended authentication state is multi-file authentication:
63
+
64
+ ```js
65
+ import { useMultiFileAuthState } from 'plogme'
66
+
67
+ const { state, saveCreds } = await useMultiFileAuthState('./session')
68
+ ```
69
+
70
+ Pairing codes can be requested after the socket has initialized:
71
+
72
+ ```js
73
+ const code = await socket.requestPairingCode('15551234567')
74
+ console.log(code)
75
+ ```
76
+
77
+ Keep authentication files private. Do not commit session credentials, private keys, or environment files to a public repository.
78
+
79
+ ## Text, mentions, and reactions
80
+
81
+ ```js
82
+ await socket.sendMessage(jid, { text: 'Hello!' })
83
+
84
+ await socket.sendMessage(jid, {
85
+ text: 'Hello @15551234567',
86
+ mentions: ['15551234567@s.whatsapp.net']
87
+ })
88
+
89
+ await socket.sendMessage(jid, {
90
+ react: { text: '✅', key: message.key }
91
+ })
92
+ ```
93
+
94
+ ## Media
95
+
96
+ ```js
97
+ await socket.sendMessage(jid, {
98
+ image: { url: './image.jpg' },
99
+ caption: 'Image caption'
100
+ })
101
+
102
+ await socket.sendMessage(jid, {
103
+ video: { url: './video.mp4' },
104
+ caption: 'Video caption',
105
+ gifPlayback: false
106
+ })
107
+
108
+ await socket.sendMessage(jid, {
109
+ document: { url: './report.pdf' },
110
+ mimetype: 'application/pdf',
111
+ fileName: 'report.pdf'
112
+ })
113
+
114
+ await socket.sendMessage(jid, {
115
+ audio: { url: './audio.ogg' },
116
+ mimetype: 'audio/ogg; codecs=opus'
117
+ })
118
+ ```
119
+
120
+ ## Interactive messages
121
+
122
+ The client supports button, list, template, carousel, and native-flow message structures exposed by the installed library version. A basic button example is:
123
+
124
+ ```js
125
+ await socket.sendMessage(jid, {
126
+ text: 'Choose an option',
127
+ footer: 'Menu',
128
+ buttons: [
129
+ { buttonId: 'confirm', buttonText: { displayText: 'Confirm' }, type: 1 },
130
+ { buttonId: 'cancel', buttonText: { displayText: 'Cancel' }, type: 1 }
131
+ ],
132
+ headerType: 1
133
+ })
134
+ ```
135
+
136
+ Always validate button input on the server. A button identifier is user-controlled input and must not be treated as an authorization grant.
137
+
138
+ ## Groups
139
+
140
+ ```js
141
+ const metadata = await socket.groupMetadata(groupJid)
142
+ await socket.groupParticipantsUpdate(groupJid, [userJid], 'add')
143
+ await socket.groupParticipantsUpdate(groupJid, [userJid], 'remove')
144
+ await socket.groupSettingUpdate(groupJid, 'announcement')
145
+ ```
146
+
147
+ Group administration calls require the connected account to have the corresponding privileges. Applications should handle permission failures and disconnected sessions gracefully.
148
+
149
+ ## Status updates
150
+
151
+ Status messages can be sent with text, images, videos, captions, and mentions according to the message content supported by the current protocol version:
152
+
153
+ ```js
154
+ await socket.sendMessage('status@broadcast', {
155
+ text: 'Service status: online',
156
+ backgroundArgb: 0xff102a43,
157
+ font: 2
158
+ })
159
+ ```
160
+
161
+ ## Message options
162
+
163
+ ```js
164
+ await socket.sendMessage(jid, {
165
+ text: 'Disappearing message',
166
+ ephemeralExpiration: 86400
167
+ })
168
+
169
+ await socket.sendMessage(jid, {
170
+ text: 'Updated text',
171
+ edit: message.key
172
+ })
173
+
174
+ await socket.sendMessage(jid, {
175
+ delete: message.key
176
+ })
177
+ ```
178
+
179
+ Use raw protocol options only when the target client and installed library version support them. Unsupported message fields can be rejected by WhatsApp or ignored by the recipient.
180
+
181
+ ## Error handling and reconnection
182
+
183
+ Connections can close because of logout, network interruption, protocol updates, or server-side session invalidation. Applications should distinguish logout from recoverable failures and should avoid starting multiple concurrent connection loops.
184
+
185
+ ```js
186
+ socket.ev.on('connection.update', ({ connection, lastDisconnect }) => {
187
+ if (connection !== 'close') return
188
+ const status = new Boom(lastDisconnect?.error)?.output?.statusCode
189
+ if (status === DisconnectReason.loggedOut) {
190
+ console.error('Session logged out; remove the old session and pair again.')
191
+ return
192
+ }
193
+ console.log('Connection interrupted; reconnect using a backoff strategy.')
194
+ })
195
+ ```
196
+
197
+ ## Development
198
+
199
+ ```bash
200
+ npm install
201
+ npm test
202
+ ```
203
+
204
+ Before opening a pull request, run the test suite, check the generated package contents, and confirm that no credentials or session files are included.
205
+
206
+ ## License
207
+
208
+ Review the repository license before distributing applications built with this package. Keep required notices with redistributed source and binaries.
209
+
210
+ ## Support
211
+
212
+ For implementation questions, include the Node.js version, package version, operating system, relevant error text, and a minimal reproducible example. Never include authentication state or private account data in an issue.
package/WAProto/V ADDED
@@ -0,0 +1 @@
1
+