@open-wa/schema 5.0.0-alpha.2 → 5.0.0-alpha.3

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 (102) hide show
  1. package/dist/generated/index.cjs +598 -0
  2. package/dist/generated/index.cjs.map +1 -0
  3. package/dist/generated/index.d.cts +3674 -0
  4. package/dist/generated/index.d.cts.map +1 -0
  5. package/dist/generated/index.d.mts +3674 -0
  6. package/dist/generated/index.d.mts.map +1 -0
  7. package/dist/generated/index.mjs +595 -0
  8. package/dist/generated/index.mjs.map +1 -0
  9. package/dist/http-manifest-BlJWPKsp.d.mts +177 -0
  10. package/dist/http-manifest-BlJWPKsp.d.mts.map +1 -0
  11. package/dist/http-manifest-DCOVY9QZ.d.cts +177 -0
  12. package/dist/http-manifest-DCOVY9QZ.d.cts.map +1 -0
  13. package/dist/http-manifest.cjs +59 -0
  14. package/dist/http-manifest.cjs.map +1 -0
  15. package/dist/http-manifest.d.cts +2 -0
  16. package/dist/http-manifest.d.mts +2 -0
  17. package/dist/http-manifest.mjs +58 -0
  18. package/dist/http-manifest.mjs.map +1 -0
  19. package/dist/implementor-DIBNbQXA.d.cts +8 -0
  20. package/dist/implementor-DIBNbQXA.d.cts.map +1 -0
  21. package/dist/implementor-DoN9ga7C.d.mts +8 -0
  22. package/dist/implementor-DoN9ga7C.d.mts.map +1 -0
  23. package/dist/implementor.cjs +50 -0
  24. package/dist/implementor.cjs.map +1 -0
  25. package/dist/implementor.d.cts +2 -0
  26. package/dist/implementor.d.mts +2 -0
  27. package/dist/implementor.mjs +48 -0
  28. package/dist/implementor.mjs.map +1 -0
  29. package/dist/index-BB9uyLe8.d.cts +1323 -0
  30. package/dist/index-BB9uyLe8.d.cts.map +1 -0
  31. package/dist/index-D77q1gPk.d.mts +1323 -0
  32. package/dist/index-D77q1gPk.d.mts.map +1 -0
  33. package/dist/index.cjs +649 -0
  34. package/dist/index.cjs.map +1 -0
  35. package/dist/index.d.cts +4 -0
  36. package/dist/index.d.mts +4 -0
  37. package/dist/index.mjs +299 -0
  38. package/dist/index.mjs.map +1 -0
  39. package/dist/methods/index.cjs +125 -0
  40. package/dist/methods/index.d.cts +2 -0
  41. package/dist/methods/index.d.mts +2 -0
  42. package/dist/methods/index.mjs +2 -0
  43. package/dist/methods-BXZrkKjP.mjs +2633 -0
  44. package/dist/methods-BXZrkKjP.mjs.map +1 -0
  45. package/dist/methods-CuiwUO7-.cjs +3802 -0
  46. package/dist/methods-CuiwUO7-.cjs.map +1 -0
  47. package/dist/registry-CsyR8i6y.mjs +284 -0
  48. package/dist/registry-CsyR8i6y.mjs.map +1 -0
  49. package/dist/registry-TbMVoiw5.cjs +355 -0
  50. package/dist/registry-TbMVoiw5.cjs.map +1 -0
  51. package/package.json +6 -3
  52. package/CHANGELOG.md +0 -31
  53. package/client_migration_doc.md +0 -467
  54. package/codecs_and_params_plan.md +0 -936
  55. package/migration_plan_doc.md +0 -223
  56. package/scripts/gen-client-implementation.ts +0 -129
  57. package/scripts/gen-client-reference-docs.ts +0 -621
  58. package/scripts/gen-openapi.ts +0 -96
  59. package/scripts/gen-types.ts +0 -43
  60. package/scripts/verify-v5-pipeline.ts +0 -85
  61. package/src/__tests__/generators.contract.test.ts +0 -181
  62. package/src/__tests__/registry.contract.test.ts +0 -81
  63. package/src/client-config.ts +0 -30
  64. package/src/codecs.test.ts +0 -41
  65. package/src/codecs.ts +0 -191
  66. package/src/common-types.ts +0 -280
  67. package/src/config.ts +0 -47
  68. package/src/enums.ts +0 -63
  69. package/src/events/groups.ts +0 -33
  70. package/src/events/index.ts +0 -4
  71. package/src/events/messaging.ts +0 -72
  72. package/src/events/registry.ts +0 -114
  73. package/src/events/state.ts +0 -59
  74. package/src/generated/AliasMap.ts +0 -214
  75. package/src/generated/BaseClient.ts +0 -868
  76. package/src/generated/BaseNamespacedClient.ts +0 -212
  77. package/src/generated/index.ts +0 -5
  78. package/src/generated/openapi.json +0 -7799
  79. package/src/generated/types.ts +0 -377
  80. package/src/http-manifest.ts +0 -97
  81. package/src/implementor.test.ts +0 -88
  82. package/src/implementor.ts +0 -75
  83. package/src/index.ts +0 -43
  84. package/src/methods/business.ts +0 -51
  85. package/src/methods/chats.ts +0 -263
  86. package/src/methods/communities.ts +0 -119
  87. package/src/methods/contacts.ts +0 -158
  88. package/src/methods/groups.ts +0 -376
  89. package/src/methods/index.ts +0 -33
  90. package/src/methods/labels.ts +0 -86
  91. package/src/methods/media.ts +0 -36
  92. package/src/methods/messaging.ts +0 -828
  93. package/src/methods/session.ts +0 -261
  94. package/src/methods/status.ts +0 -120
  95. package/src/open-wa-utils.d.ts +0 -4
  96. package/src/parameters.ts +0 -237
  97. package/src/registry.test.ts +0 -30
  98. package/src/registry.ts +0 -601
  99. package/tsconfig.generated.json +0 -11
  100. package/tsconfig.json +0 -15
  101. package/tsdown.config.ts +0 -16
  102. package/vitest.config.ts +0 -10
@@ -0,0 +1,2633 @@
1
+ import { d as parameterRegistry, o as defineMethodV2 } from "./registry-CsyR8i6y.mjs";
2
+ import { z } from "zod";
3
+ import { assertFile, getDUrl } from "@open-wa/utils";
4
+ //#region src/common-types.ts
5
+ const ContactIdSchema$1 = z.string().brand("ContactId");
6
+ const ChatIdSchema$1 = z.string().brand("ChatId");
7
+ const MessageIdSchema$1 = z.string().brand("MessageId");
8
+ const GroupChatIdSchema = z.string().brand("GroupChatId");
9
+ const GroupIdSchema$1 = z.string().brand("GroupId");
10
+ const GroupMetadataSchema = z.object({
11
+ id: GroupIdSchema$1,
12
+ subject: z.string(),
13
+ creation: z.number(),
14
+ owner: ContactIdSchema$1.optional(),
15
+ desc: z.string().optional(),
16
+ descTime: z.number().optional(),
17
+ descOwner: ContactIdSchema$1.optional(),
18
+ restrict: z.boolean().optional(),
19
+ announce: z.boolean().optional(),
20
+ participants: z.array(z.object({
21
+ id: ContactIdSchema$1,
22
+ isAdmin: z.boolean(),
23
+ isSuperAdmin: z.boolean().optional()
24
+ }))
25
+ }).passthrough();
26
+ const IdSchema = z.object({
27
+ server: z.string(),
28
+ user: z.string(),
29
+ _serialized: z.string()
30
+ });
31
+ let MessageTypes = /* @__PURE__ */ function(MessageTypes) {
32
+ MessageTypes["TEXT"] = "chat";
33
+ MessageTypes["AUDIO"] = "audio";
34
+ MessageTypes["VOICE"] = "ptt";
35
+ MessageTypes["IMAGE"] = "image";
36
+ MessageTypes["VIDEO"] = "video";
37
+ MessageTypes["DOCUMENT"] = "document";
38
+ MessageTypes["STICKER"] = "sticker";
39
+ MessageTypes["LOCATION"] = "location";
40
+ MessageTypes["CONTACT_CARD"] = "vcard";
41
+ MessageTypes["CONTACT_CARD_MULTI"] = "multi_vcard";
42
+ MessageTypes["REVOKED"] = "revoked";
43
+ MessageTypes["ORDER"] = "order";
44
+ MessageTypes["BUTTONS_RESPONSE"] = "buttons_response";
45
+ MessageTypes["LIST_RESPONSE"] = "list_response";
46
+ MessageTypes["UNKNOWN"] = "unknown";
47
+ return MessageTypes;
48
+ }({});
49
+ let MessageAck = /* @__PURE__ */ function(MessageAck) {
50
+ MessageAck[MessageAck["ACK_ERROR"] = -1] = "ACK_ERROR";
51
+ MessageAck[MessageAck["ACK_PENDING"] = 0] = "ACK_PENDING";
52
+ MessageAck[MessageAck["ACK_SERVER"] = 1] = "ACK_SERVER";
53
+ MessageAck[MessageAck["ACK_DEVICE"] = 2] = "ACK_DEVICE";
54
+ MessageAck[MessageAck["ACK_READ"] = 3] = "ACK_READ";
55
+ MessageAck[MessageAck["ACK_PLAYED"] = 4] = "ACK_PLAYED";
56
+ return MessageAck;
57
+ }({});
58
+ /**
59
+ * An enum of all the "simple listeners". A simple listener is a listener that just takes one parameter which is the callback function to handle the event.
60
+ */
61
+ let SimpleListener = /* @__PURE__ */ function(SimpleListener) {
62
+ /**
63
+ * Represents [[onMessage]]
64
+ */
65
+ SimpleListener["Message"] = "onMessage";
66
+ /**
67
+ * Represents [[onAnyMessage]]
68
+ */
69
+ SimpleListener["AnyMessage"] = "onAnyMessage";
70
+ /**
71
+ * Represents [[onMessageDeleted]]
72
+ */
73
+ SimpleListener["MessageDeleted"] = "onMessageDeleted";
74
+ /**
75
+ * Represents [[onAck]]
76
+ */
77
+ SimpleListener["Ack"] = "onAck";
78
+ /**
79
+ * Represents [[onAddedToGroup]]
80
+ */
81
+ SimpleListener["AddedToGroup"] = "onAddedToGroup";
82
+ /**
83
+ * Represents [[onChatDeleted]]
84
+ */
85
+ SimpleListener["ChatDeleted"] = "onChatDeleted";
86
+ /**
87
+ * Represents [[onBattery]]
88
+ */
89
+ SimpleListener["Battery"] = "onBattery";
90
+ /**
91
+ * Represents [[onChatOpened]]
92
+ */
93
+ SimpleListener["ChatOpened"] = "onChatOpened";
94
+ /**
95
+ * Represents [[onIncomingCall]]
96
+ */
97
+ SimpleListener["IncomingCall"] = "onIncomingCall";
98
+ /**
99
+ * Represents [[onGlobalParticipantsChanged]]
100
+ */
101
+ SimpleListener["GlobalParticipantsChanged"] = "onGlobalParticipantsChanged";
102
+ /**
103
+ * Represents [[onChatState]]
104
+ */
105
+ SimpleListener["ChatState"] = "onChatState";
106
+ /**
107
+ * Represents [[onLogout]]
108
+ */
109
+ SimpleListener["Logout"] = "onLogout";
110
+ /**
111
+ * Represents [[onPlugged]]
112
+ */
113
+ SimpleListener["Plugged"] = "onPlugged";
114
+ /**
115
+ * Represents [[onStateChanged]]
116
+ */
117
+ SimpleListener["StateChanged"] = "onStateChanged";
118
+ /**
119
+ * Represents [[onButton]]
120
+ */
121
+ SimpleListener["Button"] = "onButton";
122
+ /**
123
+ * Requires licence
124
+ * Represents [[onStory]]
125
+ */
126
+ SimpleListener["Story"] = "onStory";
127
+ /**
128
+ * Requires licence
129
+ * Represents [[onRemovedFromGroup]]
130
+ */
131
+ SimpleListener["RemovedFromGroup"] = "onRemovedFromGroup";
132
+ /**
133
+ * Requires licence
134
+ * Represents [[onContactAdded]]
135
+ */
136
+ SimpleListener["ContactAdded"] = "onContactAdded";
137
+ /**
138
+ * Represents [[onOrder]]
139
+ */
140
+ SimpleListener["Order"] = "onOrder";
141
+ return SimpleListener;
142
+ }({});
143
+ const MessageSchemaBase = z.object({
144
+ id: MessageIdSchema$1,
145
+ body: z.string(),
146
+ type: z.nativeEnum(MessageTypes),
147
+ t: z.number(),
148
+ notifyName: z.string().optional(),
149
+ from: ChatIdSchema$1,
150
+ to: ChatIdSchema$1,
151
+ self: z.enum(["in", "out"]),
152
+ ack: z.nativeEnum(MessageAck),
153
+ invis: z.boolean().optional(),
154
+ isNewMsg: z.boolean().optional(),
155
+ star: z.boolean().optional(),
156
+ recvFresh: z.boolean().optional(),
157
+ broadcast: z.boolean().optional(),
158
+ isForwarded: z.boolean().optional(),
159
+ labels: z.array(z.string()).optional(),
160
+ mentionedJidList: z.array(ContactIdSchema$1).optional(),
161
+ caption: z.string().optional(),
162
+ sender: z.any(),
163
+ timestamp: z.number(),
164
+ content: z.string(),
165
+ isGroupMsg: z.boolean(),
166
+ isMMS: z.boolean().optional(),
167
+ isMedia: z.boolean(),
168
+ isNotification: z.boolean(),
169
+ isPSA: z.boolean().optional(),
170
+ fromMe: z.boolean(),
171
+ chat: z.any(),
172
+ chatId: ChatIdSchema$1,
173
+ author: z.string().optional(),
174
+ clientUrl: z.string().optional(),
175
+ deprecatedMms3Url: z.string().optional(),
176
+ isQuotedMsgAvailable: z.boolean(),
177
+ quotedMsg: z.any().optional(),
178
+ quotedMsgObj: z.any().optional(),
179
+ senderId: z.string().optional()
180
+ }).passthrough();
181
+ const ContactSchema = z.object({
182
+ id: ContactIdSchema$1,
183
+ name: z.string().optional(),
184
+ shortName: z.string().optional(),
185
+ pushname: z.string().optional(),
186
+ formattedName: z.string().optional(),
187
+ isBusiness: z.boolean().optional(),
188
+ isEnterprise: z.boolean().optional(),
189
+ isMe: z.boolean().optional(),
190
+ isMyContact: z.boolean().optional(),
191
+ isPSA: z.boolean().optional(),
192
+ isUser: z.boolean().optional(),
193
+ isWAContact: z.boolean().optional(),
194
+ labels: z.array(z.string()).optional(),
195
+ msgs: z.array(z.any()).optional(),
196
+ profilePicThumbObj: z.object({
197
+ eurl: z.string().optional(),
198
+ id: IdSchema.optional(),
199
+ img: z.string().optional(),
200
+ imgFull: z.string().optional(),
201
+ tag: z.string().optional()
202
+ }).optional(),
203
+ statusMute: z.boolean().optional(),
204
+ type: z.string().optional(),
205
+ verifiedLevel: z.number().optional(),
206
+ verifiedName: z.string().optional(),
207
+ isOnline: z.boolean().optional(),
208
+ lastSeen: z.number().optional()
209
+ }).passthrough();
210
+ const LocationSchema = z.object({
211
+ lat: z.number().describe("Latitude coordinate"),
212
+ lng: z.number().describe("Longitude coordinate"),
213
+ name: z.string().optional().describe("Location name"),
214
+ address: z.string().optional().describe("Formatted address"),
215
+ url: z.string().optional().describe("WhatsApp location URL")
216
+ }).passthrough();
217
+ const ChatSchema = z.object({
218
+ id: ContactIdSchema$1.or(GroupChatIdSchema),
219
+ name: z.string().optional(),
220
+ formattedTitle: z.string().optional(),
221
+ isGroup: z.boolean(),
222
+ contact: ContactSchema,
223
+ groupMetadata: z.any().optional(),
224
+ presence: z.any().optional(),
225
+ t: z.number().optional(),
226
+ unreadCount: z.number().optional(),
227
+ lastReceivedKey: z.any().optional(),
228
+ msgs: z.array(z.any()).optional(),
229
+ isReadOnly: z.boolean().optional(),
230
+ muteExpiration: z.number().optional(),
231
+ notSpam: z.boolean().optional(),
232
+ pin: z.number().optional(),
233
+ ack: z.any().optional()
234
+ }).passthrough();
235
+ const MessageSchema = MessageSchemaBase.extend({
236
+ sender: ContactSchema,
237
+ chat: ChatSchema
238
+ });
239
+ const MessageIdReturnSchema = z.object({ _serialized: z.string() }).passthrough();
240
+ //#endregion
241
+ //#region src/codecs.ts
242
+ const chatIdPattern = /^\d+(-\d+)?@(c|g)\.us$|^\d+@lid$/;
243
+ const contactIdPattern = /^\d+@c\.us$/;
244
+ const groupIdPattern = /^\d+(-\d+)?@g\.us$/;
245
+ const messageIdPattern = /^(true|false)_.+_.+$/;
246
+ /**
247
+ * Chat ID Codec
248
+ * Intelligently converts phone numbers to proper WhatsApp chat IDs.
249
+ */
250
+ const chatIdCodec = {
251
+ decode: (input) => {
252
+ if (input.includes("@")) return input;
253
+ const digits = input.replace(/\D/g, "");
254
+ const digitCount = digits.length;
255
+ if (digitCount === 18) return `${digits}@g.us`;
256
+ if (digitCount === 14 && !digits.startsWith("62")) return `${digits}@lid`;
257
+ return `${digits}@c.us`;
258
+ },
259
+ encode: (chatId) => chatId
260
+ };
261
+ /**
262
+ * Contact ID Codec - always formats as @c.us
263
+ */
264
+ const contactIdCodec = {
265
+ decode: (input) => {
266
+ if (input.endsWith("@c.us")) return input;
267
+ return `${input.replace(/\D/g, "")}@c.us`;
268
+ },
269
+ encode: (contactId) => contactId
270
+ };
271
+ /**
272
+ * Group ID Codec - always formats as @g.us
273
+ */
274
+ const groupIdCodec = {
275
+ decode: (input) => {
276
+ if (input.endsWith("@g.us")) return input;
277
+ return `${input.replace(/\D/g, "")}@g.us`;
278
+ },
279
+ encode: (groupId) => groupId
280
+ };
281
+ /**
282
+ * Message ID Codec - validates format only
283
+ */
284
+ const messageIdCodec = {
285
+ decode: (input) => input,
286
+ encode: (messageId) => messageId
287
+ };
288
+ /**
289
+ * File Codec Factory
290
+ */
291
+ const createFileCodec = (outputType) => ({
292
+ decode: async (input) => assertFile(input, outputType),
293
+ encode: (output) => output
294
+ });
295
+ const fileToDataUrlCodec = createFileCodec("DATA_URL");
296
+ const fileToBase64Codec = createFileCodec("BASE_64");
297
+ const fileToBufferCodec = createFileCodec("BUFFER");
298
+ const fileToTempPathCodec = createFileCodec("TEMP_FILE_PATH");
299
+ const fileToStreamCodec = createFileCodec("READ_STREAM");
300
+ const base64ToDataUrlCodec = {
301
+ decode: (base64) => {
302
+ if (base64.startsWith("data:")) return base64;
303
+ return `data:application/octet-stream;base64,${base64}`;
304
+ },
305
+ encode: (dataUrl) => dataUrl.split(",")[1] || dataUrl
306
+ };
307
+ const urlToDataUrlCodec = {
308
+ decode: async (url) => getDUrl(url),
309
+ encode: (_dataUrl) => {
310
+ throw new Error("Cannot encode DataURL back to URL");
311
+ }
312
+ };
313
+ const isoDatetimeToDate = {
314
+ decode: (isoString) => new Date(isoString),
315
+ encode: (date) => date.toISOString()
316
+ };
317
+ const unixSecondsToDate = {
318
+ decode: (seconds) => /* @__PURE__ */ new Date(seconds * 1e3),
319
+ encode: (date) => Math.floor(date.getTime() / 1e3)
320
+ };
321
+ const unixMillisToDate = {
322
+ decode: (millis) => new Date(millis),
323
+ encode: (date) => date.getTime()
324
+ };
325
+ const hexColorCodec = {
326
+ decode: (input) => input.replace("#", "").toUpperCase(),
327
+ encode: (hex) => `#${hex}`
328
+ };
329
+ const jsonStringCodec = (schema) => z.codec(z.string(), schema, {
330
+ decode: (jsonString) => schema.parse(JSON.parse(jsonString)),
331
+ encode: (value) => JSON.stringify(value)
332
+ });
333
+ const ChatIdSchema = z.codec(z.string(), z.string().regex(chatIdPattern).brand("ChatId"), chatIdCodec);
334
+ const ContactIdSchema = z.codec(z.string(), z.string().regex(contactIdPattern).brand("ContactId"), contactIdCodec);
335
+ const GroupIdSchema = z.codec(z.string(), z.string().regex(groupIdPattern).brand("GroupChatId"), groupIdCodec);
336
+ const MessageIdSchema = z.codec(z.string(), z.string().regex(messageIdPattern).brand("MessageId"), messageIdCodec);
337
+ const ChatIdCodecSchema = ChatIdSchema;
338
+ const ContactIdCodecSchema = ContactIdSchema;
339
+ const GroupIdCodecSchema = GroupIdSchema;
340
+ const MessageIdCodecSchema = MessageIdSchema;
341
+ const FileToDataUrlSchema = z.union([z.string(), z.instanceof(Buffer)]).transform(async (input) => fileToDataUrlCodec.decode(input)).pipe(z.string().regex(/^data:.+;base64,.+$/).brand("DataURL"));
342
+ const Base64ToDataUrlSchema = z.codec(z.string(), z.string().regex(/^data:.+;base64,.+$/).brand("DataURL"), base64ToDataUrlCodec);
343
+ const HexColorSchema = z.codec(z.string(), z.string().regex(/^[0-9A-F]+$/), hexColorCodec);
344
+ const IsoDatetimeToDateSchema = z.codec(z.iso.datetime(), z.date(), isoDatetimeToDate);
345
+ const UnixSecondsToDateSchema = z.codec(z.number().int().min(0), z.date(), unixSecondsToDate);
346
+ const UnixMillisToDateSchema = z.codec(z.number().int().min(0), z.date(), unixMillisToDate);
347
+ //#endregion
348
+ //#region src/parameters.ts
349
+ const chatIdParam = ChatIdSchema.describe("Chat ID (phone number or formatted ID)").register(parameterRegistry, {
350
+ example: "447123456789@c.us",
351
+ brandedType: "ChatId",
352
+ formatDescription: "A contact ID, group ID, or LID JID",
353
+ pattern: "^\\d+(-\\d+)?@(c|g)\\.us$|^\\d+@lid$",
354
+ keyAliases: ["id", "contactId"]
355
+ });
356
+ const contactIdParam = ContactIdSchema.describe("Contact ID").register(parameterRegistry, {
357
+ example: "447123456789@c.us",
358
+ brandedType: "ContactId",
359
+ formatDescription: "A WhatsApp contact JID",
360
+ pattern: "^\\d+@c\\.us$",
361
+ keyAliases: ["id"]
362
+ });
363
+ const groupIdParam = GroupIdSchema.describe("Group chat ID").register(parameterRegistry, {
364
+ example: "447123456789-1445627445@g.us",
365
+ brandedType: "GroupChatId",
366
+ formatDescription: "A WhatsApp group JID",
367
+ pattern: "^\\d+(-\\d+)?@g\\.us$",
368
+ keyAliases: ["chatId", "groupChatId"],
369
+ deprecatedKeyAliases: ["groupChatId"]
370
+ });
371
+ const communityIdParam = GroupIdSchema.describe("Community ID").register(parameterRegistry, {
372
+ example: "447123456789-1445627445@g.us",
373
+ brandedType: "GroupChatId",
374
+ formatDescription: "A WhatsApp community JID",
375
+ pattern: "^\\d+(-\\d+)?@g\\.us$"
376
+ });
377
+ const messageIdParam = MessageIdSchema.describe("Message ID").register(parameterRegistry, {
378
+ example: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
379
+ brandedType: "MessageId",
380
+ formatDescription: "A WhatsApp message identifier",
381
+ pattern: "^(true|false)_.+_.+$",
382
+ keyAliases: ["id", "msgId"],
383
+ deprecatedKeyAliases: ["msgId"]
384
+ });
385
+ const toParam = ChatIdSchema.describe("Recipient chat ID").register(parameterRegistry, {
386
+ example: "447123456789@c.us",
387
+ brandedType: "ChatId",
388
+ formatDescription: "The target chat for a send operation",
389
+ pattern: "^\\d+(-\\d+)?@(c|g)\\.us$|^\\d+@lid$",
390
+ keyAliases: ["chatId"]
391
+ });
392
+ const contentParam = z.string().min(1).brand("Content").describe("Message content").register(parameterRegistry, {
393
+ example: "Hello, world!",
394
+ brandedType: "Content",
395
+ keyAliases: [
396
+ "text",
397
+ "body",
398
+ "message"
399
+ ]
400
+ });
401
+ const captionParam = z.string().optional().describe("Media caption").register(parameterRegistry, { example: "Check out this image!" });
402
+ const filenameParam = z.string().optional().describe("Filename with extension").register(parameterRegistry, { example: "document.pdf" });
403
+ const userAgentParam = z.string().optional().describe("User agent string").register(parameterRegistry, {
404
+ example: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
405
+ keyAliases: ["userA"],
406
+ deprecatedKeyAliases: ["userA"]
407
+ });
408
+ const nameParam = z.string().describe("Display name").register(parameterRegistry, {
409
+ example: "OpenWA Bot",
410
+ keyAliases: ["newName"],
411
+ deprecatedKeyAliases: ["newName"]
412
+ });
413
+ const statusTextParam = z.string().describe("Status text").register(parameterRegistry, {
414
+ example: "Available",
415
+ keyAliases: ["newStatus"],
416
+ deprecatedKeyAliases: ["newStatus"]
417
+ });
418
+ const imageDataParam = FileToDataUrlSchema.describe("Image file (path, URL, DataURL, or Base64)").register(parameterRegistry, {
419
+ example: "data:image/png;base64,iVBORw0KGgo...",
420
+ brandedType: "DataURL"
421
+ });
422
+ const fileDataParam = FileToDataUrlSchema.describe("File (path, URL, DataURL, Base64, or Buffer)").register(parameterRegistry, {
423
+ example: "data:application/pdf;base64,JVBERi0xLjQK...",
424
+ brandedType: "DataURL"
425
+ });
426
+ const audioDataParam = FileToDataUrlSchema.describe("Audio file (path, URL, DataURL, or Base64)").register(parameterRegistry, {
427
+ example: "data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAA...",
428
+ brandedType: "DataURL"
429
+ });
430
+ const videoDataParam = FileToDataUrlSchema.describe("Video file (path, URL, DataURL, or Base64)").register(parameterRegistry, {
431
+ example: "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21...",
432
+ brandedType: "DataURL"
433
+ });
434
+ const documentDataParam = FileToDataUrlSchema.describe("Document file (path, URL, DataURL, or Base64)").register(parameterRegistry, {
435
+ example: "data:application/pdf;base64,JVBERi0xLjQK...",
436
+ brandedType: "DataURL"
437
+ });
438
+ const stickerDataParam = FileToDataUrlSchema.describe("Sticker file (path, URL, DataURL, or Base64)").register(parameterRegistry, {
439
+ example: "data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAw...",
440
+ brandedType: "DataURL"
441
+ });
442
+ const latitudeParam = z.union([z.number(), z.string()]).describe("Latitude coordinate").register(parameterRegistry, { example: 51.5074 });
443
+ const longitudeParam = z.union([z.number(), z.string()]).describe("Longitude coordinate").register(parameterRegistry, { example: -.1278 });
444
+ const locationNameParam = z.string().optional().describe("Location name or description").register(parameterRegistry, { example: "London, UK" });
445
+ const waitForIdParam = z.boolean().optional().default(false).describe("Wait for message ID").register(parameterRegistry, { example: true });
446
+ const includeMeParam = z.boolean().optional().default(true).describe("Include own messages").register(parameterRegistry, { example: true });
447
+ const includeNotificationsParam = z.boolean().optional().default(false).describe("Include notification messages").register(parameterRegistry, { example: false });
448
+ const onlyLocalParam = z.boolean().optional().default(false).describe("Delete only locally").register(parameterRegistry, { example: false });
449
+ const skipMyMessagesParam = z.boolean().optional().default(false).describe("Skip own messages").register(parameterRegistry, { example: false });
450
+ const withNewMessagesOnlyParam = z.boolean().optional().default(false).describe("Only chats with unread messages").register(parameterRegistry, { example: false });
451
+ const messageIdsParam = z.union([z.array(messageIdParam), messageIdParam]).describe("Message ID(s) to process").register(parameterRegistry, {
452
+ example: ["false_447123456789@c.us_ABC123", "false_447123456789@c.us_DEF456"],
453
+ brandedType: "MessageId[]",
454
+ keyAliases: ["messages"]
455
+ });
456
+ const mentionedJidListParam = z.array(contactIdParam).optional().describe("List of mentioned contact IDs").register(parameterRegistry, { example: ["447123456789@c.us", "441234567890@c.us"] });
457
+ const messageOptionsParam = z.any().optional().describe("Additional message options").register(parameterRegistry, { example: {
458
+ quotedMsg: "messageId",
459
+ mentionedJidList: ["447123456789@c.us"]
460
+ } });
461
+ //#endregion
462
+ //#region src/methods/messaging.ts
463
+ /**
464
+ * Sends a text message to a chat
465
+ */
466
+ const sendText = defineMethodV2("sendText", {
467
+ meta: {
468
+ description: "Sends a text message to a chat",
469
+ action: "send",
470
+ namespace: "messages",
471
+ license: "none",
472
+ functionality: "both",
473
+ httpMethod: "POST"
474
+ },
475
+ input: z.object({
476
+ to: toParam,
477
+ content: contentParam,
478
+ options: messageOptionsParam
479
+ }),
480
+ parameterOrder: [
481
+ "to",
482
+ "content",
483
+ "options"
484
+ ],
485
+ output: MessageIdReturnSchema.or(z.boolean()).or(z.string())
486
+ });
487
+ /**
488
+ * Sends a text message with mentions
489
+ */
490
+ const sendTextWithMentions = defineMethodV2("sendTextWithMentions", {
491
+ meta: {
492
+ description: "Sends a text message that includes @mentions",
493
+ action: "send",
494
+ namespace: "messages",
495
+ license: "none",
496
+ functionality: "both",
497
+ httpMethod: "POST"
498
+ },
499
+ input: z.object({
500
+ to: toParam,
501
+ content: contentParam,
502
+ hideTags: z.boolean().optional().describe("Removes all tags within the message"),
503
+ mentions: mentionedJidListParam
504
+ }),
505
+ parameterOrder: [
506
+ "to",
507
+ "content",
508
+ "hideTags",
509
+ "mentions"
510
+ ],
511
+ output: MessageIdReturnSchema.or(z.boolean())
512
+ });
513
+ /**
514
+ * Sends a reply with mentions
515
+ */
516
+ const sendReplyWithMentions = defineMethodV2("sendReplyWithMentions", {
517
+ meta: {
518
+ description: "Sends a reply to a message that includes @mentions",
519
+ action: "send",
520
+ namespace: "messages",
521
+ license: "none",
522
+ functionality: "both",
523
+ httpMethod: "POST"
524
+ },
525
+ input: z.object({
526
+ to: toParam,
527
+ content: contentParam,
528
+ replyMessageId: messageIdParam,
529
+ hideTags: z.boolean().optional().describe("Removes all tags within the message"),
530
+ mentions: mentionedJidListParam
531
+ }),
532
+ parameterOrder: [
533
+ "to",
534
+ "content",
535
+ "replyMessageId",
536
+ "hideTags",
537
+ "mentions"
538
+ ],
539
+ output: MessageIdReturnSchema.or(z.boolean())
540
+ });
541
+ /**
542
+ * Sends a payment request
543
+ */
544
+ const sendPaymentRequest = defineMethodV2("sendPaymentRequest", {
545
+ meta: {
546
+ description: "Sends a payment request message",
547
+ action: "send",
548
+ namespace: "messages",
549
+ license: "none",
550
+ functionality: "both",
551
+ httpMethod: "POST"
552
+ },
553
+ input: z.object({
554
+ to: toParam,
555
+ amount: z.number().describe("Amount in 1000 format (e.g £10 => 10000)"),
556
+ currency: z.string().length(3).describe("3 letter currency code"),
557
+ message: z.string().optional().describe("Optional message")
558
+ }),
559
+ parameterOrder: [
560
+ "to",
561
+ "amount",
562
+ "currency",
563
+ "message"
564
+ ],
565
+ output: MessageIdReturnSchema.or(z.boolean())
566
+ });
567
+ /**
568
+ * Sends an image to a chat
569
+ */
570
+ const sendImage = defineMethodV2("sendImage", {
571
+ meta: {
572
+ description: "Sends an image to a chat",
573
+ action: "send",
574
+ namespace: "messages",
575
+ license: "none",
576
+ functionality: "both",
577
+ httpMethod: "POST"
578
+ },
579
+ input: z.object({
580
+ to: toParam,
581
+ imgData: imageDataParam,
582
+ filename: filenameParam,
583
+ caption: captionParam,
584
+ id: messageIdParam.optional(),
585
+ waitForId: waitForIdParam
586
+ }),
587
+ parameterOrder: [
588
+ "to",
589
+ "imgData",
590
+ "filename",
591
+ "caption",
592
+ "id",
593
+ "waitForId"
594
+ ],
595
+ output: MessageIdReturnSchema.or(z.boolean()).or(z.string())
596
+ });
597
+ /**
598
+ * Sends a file/document
599
+ */
600
+ const sendFile = defineMethodV2("sendFile", {
601
+ meta: {
602
+ description: "Sends a file or document to a chat",
603
+ action: "send",
604
+ namespace: "messages",
605
+ license: "none",
606
+ functionality: "both",
607
+ httpMethod: "POST"
608
+ },
609
+ input: z.object({
610
+ to: toParam,
611
+ file: fileDataParam,
612
+ filename: filenameParam,
613
+ caption: captionParam
614
+ }),
615
+ parameterOrder: [
616
+ "to",
617
+ "file",
618
+ "filename",
619
+ "caption"
620
+ ],
621
+ output: MessageIdReturnSchema.or(z.string())
622
+ });
623
+ /**
624
+ * Sends an audio file
625
+ */
626
+ const sendAudio = defineMethodV2("sendAudio", {
627
+ meta: {
628
+ description: "Sends an audio file to a chat",
629
+ action: "send",
630
+ namespace: "messages",
631
+ license: "none",
632
+ functionality: "both",
633
+ httpMethod: "POST"
634
+ },
635
+ input: z.object({
636
+ to: toParam,
637
+ file: audioDataParam,
638
+ filename: filenameParam,
639
+ quotedMsgId: messageIdParam.optional()
640
+ }),
641
+ parameterOrder: [
642
+ "to",
643
+ "file",
644
+ "filename",
645
+ "quotedMsgId"
646
+ ],
647
+ output: MessageIdReturnSchema.or(z.boolean())
648
+ });
649
+ /**
650
+ * Sends a voice note (PTT)
651
+ */
652
+ const sendPtt = defineMethodV2("sendPtt", {
653
+ meta: {
654
+ description: "Sends a voice note (push-to-talk) to a chat",
655
+ action: "send",
656
+ namespace: "messages",
657
+ license: "none",
658
+ functionality: "both",
659
+ httpMethod: "POST",
660
+ aliases: { explicit: ["sendVoiceNote"] }
661
+ },
662
+ input: z.object({
663
+ to: toParam,
664
+ file: audioDataParam,
665
+ quotedMsgId: messageIdParam.optional()
666
+ }),
667
+ parameterOrder: [
668
+ "to",
669
+ "file",
670
+ "quotedMsgId"
671
+ ],
672
+ output: MessageIdReturnSchema.or(z.boolean())
673
+ });
674
+ /**
675
+ * Sends a video as GIF
676
+ */
677
+ const sendVideoAsGif = defineMethodV2("sendVideoAsGif", {
678
+ meta: {
679
+ description: "Sends a video as an animated GIF",
680
+ action: "send",
681
+ namespace: "messages",
682
+ license: "none",
683
+ functionality: "both",
684
+ httpMethod: "POST"
685
+ },
686
+ input: z.object({
687
+ to: toParam,
688
+ file: videoDataParam,
689
+ filename: filenameParam,
690
+ caption: captionParam,
691
+ quotedMsgId: messageIdParam.optional()
692
+ }),
693
+ parameterOrder: [
694
+ "to",
695
+ "file",
696
+ "filename",
697
+ "caption",
698
+ "quotedMsgId"
699
+ ],
700
+ output: MessageIdReturnSchema.or(z.boolean())
701
+ });
702
+ /**
703
+ * Sends a location
704
+ */
705
+ const sendLocation = defineMethodV2("sendLocation", {
706
+ meta: {
707
+ description: "Sends a location to a chat",
708
+ action: "send",
709
+ namespace: "messages",
710
+ license: "none",
711
+ functionality: "both",
712
+ httpMethod: "POST"
713
+ },
714
+ input: z.object({
715
+ to: toParam,
716
+ lat: latitudeParam,
717
+ lng: longitudeParam,
718
+ loc: locationNameParam,
719
+ address: z.string().optional().describe("Address text"),
720
+ url: z.string().url().optional().describe("Address link")
721
+ }),
722
+ parameterOrder: [
723
+ "to",
724
+ "lat",
725
+ "lng",
726
+ "loc",
727
+ "address",
728
+ "url"
729
+ ],
730
+ output: MessageIdReturnSchema.or(z.boolean())
731
+ });
732
+ /**
733
+ * Sends a vCard
734
+ */
735
+ const sendVCard = defineMethodV2("sendVCard", {
736
+ meta: {
737
+ description: "Sends a contact card (vCard)",
738
+ action: "send",
739
+ namespace: "messages",
740
+ license: "none",
741
+ functionality: "both",
742
+ httpMethod: "POST"
743
+ },
744
+ input: z.object({
745
+ to: toParam,
746
+ vcard: z.string().describe("vCard string"),
747
+ contactName: z.string().optional().describe("Contact display name"),
748
+ contactNumber: z.string().optional().describe("Contact number with country code")
749
+ }),
750
+ parameterOrder: [
751
+ "to",
752
+ "vcard",
753
+ "contactName",
754
+ "contactNumber"
755
+ ],
756
+ output: z.boolean()
757
+ });
758
+ /**
759
+ * Sends a contact
760
+ */
761
+ const sendContact = defineMethodV2("sendContact", {
762
+ meta: {
763
+ description: "Sends a single contact",
764
+ action: "send",
765
+ namespace: "messages",
766
+ license: "none",
767
+ functionality: "both",
768
+ httpMethod: "POST"
769
+ },
770
+ input: z.object({
771
+ to: toParam,
772
+ contactId: contactIdParam.or(z.array(contactIdParam))
773
+ }),
774
+ parameterOrder: ["to", "contactId"],
775
+ output: MessageIdReturnSchema.or(z.boolean())
776
+ });
777
+ /**
778
+ * Sends multiple contacts
779
+ */
780
+ const sendMultipleContacts = defineMethodV2("sendMultipleContacts", {
781
+ meta: {
782
+ description: "Sends multiple contacts",
783
+ action: "send",
784
+ namespace: "messages",
785
+ license: "none",
786
+ functionality: "both",
787
+ httpMethod: "POST",
788
+ aliases: {
789
+ explicit: ["sendContacts"],
790
+ namespacedName: "sendContacts"
791
+ }
792
+ },
793
+ input: z.object({
794
+ to: toParam,
795
+ contactIds: z.array(contactIdParam)
796
+ }),
797
+ parameterOrder: ["to", "contactIds"],
798
+ output: MessageIdReturnSchema.or(z.boolean())
799
+ });
800
+ /**
801
+ * Sends button message
802
+ */
803
+ const sendButtons = defineMethodV2("sendButtons", {
804
+ meta: {
805
+ description: "Sends a button message (deprecated)",
806
+ action: "send",
807
+ namespace: "messages",
808
+ license: "insiders",
809
+ functionality: "both",
810
+ httpMethod: "POST"
811
+ },
812
+ input: z.object({
813
+ to: toParam,
814
+ body: z.union([z.string(), z.any()]).describe("Message body or location"),
815
+ buttons: z.array(z.any()).max(3).describe("Array of buttons (max 3)"),
816
+ title: z.string().optional().describe("Message title"),
817
+ footer: z.string().optional().describe("Message footer")
818
+ }),
819
+ parameterOrder: [
820
+ "to",
821
+ "body",
822
+ "buttons",
823
+ "title",
824
+ "footer"
825
+ ],
826
+ output: MessageIdReturnSchema.or(z.boolean())
827
+ });
828
+ /**
829
+ * Sends advanced button message
830
+ */
831
+ const sendAdvancedButtons = defineMethodV2("sendAdvancedButtons", {
832
+ meta: {
833
+ description: "Sends an advanced button message with media (deprecated)",
834
+ action: "send",
835
+ namespace: "messages",
836
+ license: "insiders",
837
+ functionality: "both",
838
+ httpMethod: "POST"
839
+ },
840
+ input: z.object({
841
+ to: toParam,
842
+ body: z.union([z.string(), z.any()]).describe("Message body, location, or media"),
843
+ buttons: z.array(z.any()).max(3).describe("Array of advanced buttons (max 3)"),
844
+ text: z.string().describe("Message text"),
845
+ footer: z.string().describe("Message footer"),
846
+ filename: z.string().describe("Filename if body is a file")
847
+ }),
848
+ parameterOrder: [
849
+ "to",
850
+ "body",
851
+ "buttons",
852
+ "text",
853
+ "footer",
854
+ "filename"
855
+ ],
856
+ output: MessageIdReturnSchema.or(z.boolean())
857
+ });
858
+ /**
859
+ * Sends list message
860
+ */
861
+ const sendListMessage = defineMethodV2("sendListMessage", {
862
+ meta: {
863
+ description: "Sends a list/menu message (deprecated)",
864
+ action: "send",
865
+ namespace: "messages",
866
+ license: "insiders",
867
+ functionality: "both",
868
+ httpMethod: "POST",
869
+ aliases: { explicit: ["sendList"] }
870
+ },
871
+ input: z.object({
872
+ to: toParam,
873
+ sections: z.array(z.any()).describe("List sections"),
874
+ title: z.string().describe("List title"),
875
+ description: z.string().describe("List description"),
876
+ actionText: z.string().describe("Action button text")
877
+ }),
878
+ parameterOrder: [
879
+ "to",
880
+ "sections",
881
+ "title",
882
+ "description",
883
+ "actionText"
884
+ ],
885
+ output: MessageIdReturnSchema.or(z.boolean())
886
+ });
887
+ /**
888
+ * Sends a poll
889
+ */
890
+ const sendPoll = defineMethodV2("sendPoll", {
891
+ meta: {
892
+ description: "Sends a poll message",
893
+ action: "send",
894
+ namespace: "messages",
895
+ license: "none",
896
+ functionality: "both",
897
+ httpMethod: "POST"
898
+ },
899
+ input: z.object({
900
+ to: toParam,
901
+ name: z.string().describe("Poll question"),
902
+ options: z.array(z.string()).min(2).max(12).describe("Poll options (2-12)"),
903
+ selectableCount: z.number().optional().default(1).describe("Number of selectable options")
904
+ }),
905
+ parameterOrder: [
906
+ "to",
907
+ "name",
908
+ "options",
909
+ "selectableCount"
910
+ ],
911
+ output: MessageIdReturnSchema.or(z.boolean())
912
+ });
913
+ /**
914
+ * Sends a banner image
915
+ */
916
+ const sendBanner = defineMethodV2("sendBanner", {
917
+ meta: {
918
+ description: "Sends a banner image",
919
+ action: "send",
920
+ namespace: "messages",
921
+ license: "none",
922
+ functionality: "both",
923
+ httpMethod: "POST"
924
+ },
925
+ input: z.object({
926
+ to: toParam,
927
+ base64: z.string().describe("Base64 encoded JPEG")
928
+ }),
929
+ parameterOrder: ["to", "base64"],
930
+ output: MessageIdReturnSchema.or(z.boolean())
931
+ });
932
+ /**
933
+ * Sends YouTube link with preview
934
+ */
935
+ const sendYouTubeLink = defineMethodV2("sendYouTubeLink", {
936
+ meta: {
937
+ description: "Sends a YouTube link with auto-generated preview",
938
+ action: "send",
939
+ namespace: "messages",
940
+ license: "none",
941
+ functionality: "both",
942
+ httpMethod: "POST",
943
+ aliases: { deprecated: ["sendYoutubeLink"] },
944
+ wapiOverride: "sendYoutubeLink"
945
+ },
946
+ input: z.object({
947
+ to: toParam,
948
+ url: z.string().url().describe("YouTube URL"),
949
+ text: contentParam.optional().default(""),
950
+ thumbnail: z.string().optional().describe("Base64 thumbnail override"),
951
+ quotedMsgId: messageIdParam.optional(),
952
+ customSize: z.object({
953
+ height: z.number(),
954
+ width: z.number()
955
+ }).optional().describe("Custom thumbnail size")
956
+ }),
957
+ parameterOrder: [
958
+ "to",
959
+ "url",
960
+ "text",
961
+ "thumbnail",
962
+ "quotedMsgId",
963
+ "customSize"
964
+ ],
965
+ output: MessageIdReturnSchema.or(z.boolean())
966
+ });
967
+ /**
968
+ * Sends link with auto preview
969
+ */
970
+ const sendLinkWithAutoPreview = defineMethodV2("sendLinkWithAutoPreview", {
971
+ meta: {
972
+ description: "Sends a link with auto-generated preview",
973
+ action: "send",
974
+ namespace: "messages",
975
+ license: "none",
976
+ functionality: "both",
977
+ httpMethod: "POST",
978
+ aliases: { explicit: ["sendLink"] }
979
+ },
980
+ input: z.object({
981
+ to: toParam,
982
+ url: z.string().url().describe("Link URL"),
983
+ text: contentParam.optional(),
984
+ thumbnail: z.string().optional().describe("Base64 thumbnail override"),
985
+ quotedMsgId: messageIdParam.optional(),
986
+ customSize: z.object({
987
+ height: z.number(),
988
+ width: z.number()
989
+ }).optional().describe("Custom thumbnail size")
990
+ }),
991
+ parameterOrder: [
992
+ "to",
993
+ "url",
994
+ "text",
995
+ "thumbnail",
996
+ "quotedMsgId",
997
+ "customSize"
998
+ ],
999
+ output: MessageIdReturnSchema.or(z.boolean())
1000
+ });
1001
+ /**
1002
+ * Sends message with custom thumbnail
1003
+ */
1004
+ const sendMessageWithThumb = defineMethodV2("sendMessageWithThumb", {
1005
+ meta: {
1006
+ description: "Sends a link preview message with custom thumbnail",
1007
+ action: "send",
1008
+ namespace: "messages",
1009
+ license: "none",
1010
+ functionality: "both",
1011
+ httpMethod: "POST",
1012
+ aliases: {
1013
+ explicit: ["sendLinkWithThumbnail"],
1014
+ namespacedName: "sendLinkWithThumbnail"
1015
+ }
1016
+ },
1017
+ input: z.object({
1018
+ thumb: z.string().describe("Base64 thumbnail (max 200x200px)"),
1019
+ url: z.string().url().describe("Link URL"),
1020
+ title: z.string().describe("Link title"),
1021
+ description: z.string().describe("Link description"),
1022
+ content: contentParam,
1023
+ to: toParam,
1024
+ quotedMsgId: messageIdParam.optional(),
1025
+ customSize: z.object({
1026
+ height: z.number(),
1027
+ width: z.number()
1028
+ }).optional().describe("Custom thumbnail size")
1029
+ }),
1030
+ parameterOrder: [
1031
+ "thumb",
1032
+ "url",
1033
+ "title",
1034
+ "description",
1035
+ "content",
1036
+ "to",
1037
+ "quotedMsgId",
1038
+ "customSize"
1039
+ ],
1040
+ output: MessageIdReturnSchema.or(z.boolean())
1041
+ });
1042
+ /**
1043
+ * Forwards messages to a chat
1044
+ */
1045
+ const forwardMessages = defineMethodV2("forwardMessages", {
1046
+ meta: {
1047
+ description: "Forwards messages to a chat",
1048
+ action: "send",
1049
+ namespace: "messages",
1050
+ license: "none",
1051
+ functionality: "both",
1052
+ httpMethod: "POST",
1053
+ aliases: { namespacedName: "forward" }
1054
+ },
1055
+ input: z.object({
1056
+ to: toParam,
1057
+ messages: messageIdsParam,
1058
+ skipMyMessages: skipMyMessagesParam
1059
+ }),
1060
+ parameterOrder: [
1061
+ "to",
1062
+ "messages",
1063
+ "skipMyMessages"
1064
+ ],
1065
+ output: z.array(MessageIdReturnSchema).or(z.boolean())
1066
+ });
1067
+ /**
1068
+ * Deletes a message
1069
+ */
1070
+ const deleteMessage = defineMethodV2("deleteMessage", {
1071
+ meta: {
1072
+ description: "Deletes a message",
1073
+ action: "delete",
1074
+ namespace: "messages",
1075
+ license: "none",
1076
+ functionality: "both",
1077
+ httpMethod: "DELETE",
1078
+ aliases: { namespacedName: "delete" }
1079
+ },
1080
+ input: z.object({
1081
+ chatId: chatIdParam,
1082
+ messageId: messageIdsParam,
1083
+ onlyLocal: z.boolean().optional().default(false).describe("Delete only locally")
1084
+ }),
1085
+ parameterOrder: [
1086
+ "chatId",
1087
+ "messageId",
1088
+ "onlyLocal"
1089
+ ],
1090
+ output: z.boolean()
1091
+ });
1092
+ /**
1093
+ * Retrieves a specific message by ID
1094
+ */
1095
+ const getMessageById = defineMethodV2("getMessageById", {
1096
+ meta: {
1097
+ description: "Retrieves a specific message by ID",
1098
+ action: "read",
1099
+ namespace: "messages",
1100
+ license: "none",
1101
+ functionality: "both",
1102
+ httpMethod: "GET",
1103
+ aliases: {
1104
+ explicit: ["getMessage"],
1105
+ namespacedName: "get"
1106
+ }
1107
+ },
1108
+ input: z.object({ messageId: messageIdParam }),
1109
+ parameterOrder: ["messageId"],
1110
+ output: z.any()
1111
+ });
1112
+ /**
1113
+ * Retrieves all messages in the session
1114
+ */
1115
+ const getAllMessages = defineMethodV2("getAllMessages", {
1116
+ meta: {
1117
+ description: "Retrieves all messages in the session",
1118
+ action: "read",
1119
+ namespace: "messages",
1120
+ license: "none",
1121
+ functionality: "both",
1122
+ httpMethod: "GET"
1123
+ },
1124
+ input: z.object({
1125
+ chatId: chatIdParam.optional(),
1126
+ includeMe: z.boolean().optional().default(true).describe("Include own messages"),
1127
+ includeNotifications: z.boolean().optional().default(false).describe("Include notification messages")
1128
+ }),
1129
+ parameterOrder: [
1130
+ "chatId",
1131
+ "includeMe",
1132
+ "includeNotifications"
1133
+ ],
1134
+ output: z.array(z.any())
1135
+ });
1136
+ const getMyLastMessage = defineMethodV2("getMyLastMessage", {
1137
+ meta: {
1138
+ description: "Get last message sent by host",
1139
+ action: "read",
1140
+ namespace: "messages",
1141
+ license: "none",
1142
+ functionality: "both",
1143
+ httpMethod: "GET"
1144
+ },
1145
+ input: z.object({ chatId: chatIdParam.optional() }),
1146
+ parameterOrder: ["chatId"],
1147
+ output: z.any()
1148
+ });
1149
+ const getStarredMessages = defineMethodV2("getStarredMessages", {
1150
+ meta: {
1151
+ description: "Get starred messages",
1152
+ action: "read",
1153
+ namespace: "messages",
1154
+ license: "insiders",
1155
+ functionality: "both",
1156
+ httpMethod: "GET"
1157
+ },
1158
+ input: z.object({ chatId: chatIdParam.optional() }),
1159
+ parameterOrder: ["chatId"],
1160
+ output: z.array(z.any())
1161
+ });
1162
+ const getUnsentMessages = defineMethodV2("getUnsentMessages", {
1163
+ meta: {
1164
+ description: "Get unsent/pending messages",
1165
+ action: "read",
1166
+ namespace: "messages",
1167
+ license: "none",
1168
+ functionality: "both",
1169
+ httpMethod: "GET"
1170
+ },
1171
+ input: z.object({}),
1172
+ parameterOrder: [],
1173
+ output: z.array(z.any())
1174
+ });
1175
+ const getMessageInfo = defineMethodV2("getMessageInfo", {
1176
+ meta: {
1177
+ description: "Get message delivery info",
1178
+ action: "read",
1179
+ namespace: "messages",
1180
+ license: "none",
1181
+ functionality: "both",
1182
+ httpMethod: "GET"
1183
+ },
1184
+ input: z.object({ messageId: messageIdParam }),
1185
+ parameterOrder: ["messageId"],
1186
+ output: z.any()
1187
+ });
1188
+ const getVCards = defineMethodV2("getVCards", {
1189
+ meta: {
1190
+ description: "Extract vCards from message",
1191
+ action: "read",
1192
+ namespace: "messages",
1193
+ license: "none",
1194
+ functionality: "both",
1195
+ httpMethod: "GET"
1196
+ },
1197
+ input: z.object({ messageId: messageIdParam }),
1198
+ parameterOrder: ["messageId"],
1199
+ output: z.array(z.string())
1200
+ });
1201
+ const getMessagesForLLM = defineMethodV2("getMessagesForLLM", {
1202
+ meta: {
1203
+ description: "Get messages formatted for LLMs",
1204
+ action: "read",
1205
+ namespace: "messages",
1206
+ license: "none",
1207
+ functionality: "both",
1208
+ httpMethod: "GET",
1209
+ aliases: { deprecated: ["getGptArray"] },
1210
+ wapiOverride: "getGptArray"
1211
+ },
1212
+ input: z.object({
1213
+ chatId: chatIdParam,
1214
+ last: z.number().optional().default(10)
1215
+ }),
1216
+ parameterOrder: ["chatId", "last"],
1217
+ output: z.any()
1218
+ });
1219
+ const starMessage = defineMethodV2("starMessage", {
1220
+ meta: {
1221
+ description: "Star a message",
1222
+ action: "update",
1223
+ namespace: "messages",
1224
+ license: "none",
1225
+ functionality: "both",
1226
+ httpMethod: "PUT"
1227
+ },
1228
+ input: z.object({ messageId: messageIdParam }),
1229
+ parameterOrder: ["messageId"],
1230
+ output: z.boolean()
1231
+ });
1232
+ const unstarMessage = defineMethodV2("unstarMessage", {
1233
+ meta: {
1234
+ description: "Unstar a message",
1235
+ action: "update",
1236
+ namespace: "messages",
1237
+ license: "none",
1238
+ functionality: "both",
1239
+ httpMethod: "PUT"
1240
+ },
1241
+ input: z.object({ messageId: messageIdParam }),
1242
+ parameterOrder: ["messageId"],
1243
+ output: z.boolean()
1244
+ });
1245
+ const react = defineMethodV2("react", {
1246
+ meta: {
1247
+ description: "React to message with emoji",
1248
+ action: "send",
1249
+ namespace: "messages",
1250
+ license: "none",
1251
+ functionality: "both",
1252
+ httpMethod: "POST"
1253
+ },
1254
+ input: z.object({
1255
+ messageId: messageIdParam,
1256
+ emoji: z.string().describe("Emoji reaction")
1257
+ }),
1258
+ parameterOrder: ["messageId", "emoji"],
1259
+ output: z.boolean()
1260
+ });
1261
+ const sendSeen = defineMethodV2("sendSeen", {
1262
+ meta: {
1263
+ description: "Mark message as seen",
1264
+ action: "update",
1265
+ namespace: "messages",
1266
+ license: "none",
1267
+ functionality: "both",
1268
+ httpMethod: "PUT"
1269
+ },
1270
+ input: z.object({ chatId: chatIdParam }),
1271
+ parameterOrder: ["chatId"],
1272
+ output: z.boolean()
1273
+ });
1274
+ const loadEarlierMessages = defineMethodV2("loadEarlierMessages", {
1275
+ meta: {
1276
+ description: "Loads earlier messages from a chat",
1277
+ action: "read",
1278
+ namespace: "messages",
1279
+ license: "none",
1280
+ functionality: "both",
1281
+ httpMethod: "POST",
1282
+ aliases: {
1283
+ explicit: ["loadOlderMessages"],
1284
+ namespacedName: "loadEarlier"
1285
+ }
1286
+ },
1287
+ input: z.object({
1288
+ chatId: chatIdParam,
1289
+ count: z.number().positive().optional().describe("Number of messages to load (default: 20)"),
1290
+ includeMe: z.boolean().optional().describe("Whether to include messages from the host account (default: false)")
1291
+ }),
1292
+ parameterOrder: [
1293
+ "chatId",
1294
+ "count",
1295
+ "includeMe"
1296
+ ],
1297
+ output: z.array(z.any())
1298
+ });
1299
+ const sendFileFromUrl = defineMethodV2("sendFileFromUrl", {
1300
+ meta: {
1301
+ description: "Downloads a file from a URL and sends it to a chat",
1302
+ action: "send",
1303
+ namespace: "messages",
1304
+ license: "none",
1305
+ functionality: "both",
1306
+ httpMethod: "POST"
1307
+ },
1308
+ input: z.object({
1309
+ to: toParam,
1310
+ url: z.string().url().describe("URL of the file to download"),
1311
+ filename: z.string().describe("Filename for the sent file"),
1312
+ caption: z.string().optional().describe("Caption for the file"),
1313
+ headers: z.record(z.string(), z.string()).optional().describe("HTTP headers for the download request")
1314
+ }),
1315
+ parameterOrder: [
1316
+ "to",
1317
+ "url",
1318
+ "filename",
1319
+ "caption",
1320
+ "headers"
1321
+ ],
1322
+ output: z.string().or(z.boolean()).describe("Message ID or success status")
1323
+ });
1324
+ //#endregion
1325
+ //#region src/methods/chats.ts
1326
+ const getAllChats = defineMethodV2("getAllChats", {
1327
+ meta: {
1328
+ description: "Retrieves all chats",
1329
+ action: "read",
1330
+ namespace: "chats",
1331
+ license: "none",
1332
+ functionality: "both",
1333
+ httpMethod: "GET"
1334
+ },
1335
+ input: z.object({ withNewMessagesOnly: withNewMessagesOnlyParam }),
1336
+ parameterOrder: ["withNewMessagesOnly"],
1337
+ output: z.array(z.any())
1338
+ });
1339
+ const getAllChatIds = defineMethodV2("getAllChatIds", {
1340
+ meta: {
1341
+ description: "Get all chat IDs",
1342
+ action: "read",
1343
+ namespace: "chatIds",
1344
+ license: "none",
1345
+ functionality: "both",
1346
+ httpMethod: "GET",
1347
+ aliases: { explicit: ["chats.ids"] }
1348
+ },
1349
+ input: z.object({}),
1350
+ parameterOrder: [],
1351
+ output: z.array(z.string())
1352
+ });
1353
+ const getChat = defineMethodV2("getChat", {
1354
+ meta: {
1355
+ description: "Get specific chat by ID",
1356
+ action: "read",
1357
+ namespace: "chats",
1358
+ license: "none",
1359
+ functionality: "both",
1360
+ httpMethod: "GET",
1361
+ aliases: { explicit: ["getChatById"] }
1362
+ },
1363
+ input: z.object({ chatId: chatIdParam }),
1364
+ parameterOrder: ["chatId"],
1365
+ output: z.any()
1366
+ });
1367
+ const getChatWithNonContacts = defineMethodV2("getChatWithNonContacts", {
1368
+ meta: {
1369
+ description: "Get chats with non-contacts",
1370
+ action: "read",
1371
+ namespace: "chats",
1372
+ license: "none",
1373
+ functionality: "both",
1374
+ httpMethod: "GET"
1375
+ },
1376
+ input: z.object({}),
1377
+ parameterOrder: [],
1378
+ output: z.array(z.any())
1379
+ });
1380
+ const archiveChat = defineMethodV2("archiveChat", {
1381
+ meta: {
1382
+ description: "Archive a chat",
1383
+ action: "update",
1384
+ namespace: "chats",
1385
+ license: "none",
1386
+ functionality: "both",
1387
+ httpMethod: "PUT"
1388
+ },
1389
+ input: z.object({ chatId: chatIdParam }),
1390
+ parameterOrder: ["chatId"],
1391
+ output: z.boolean()
1392
+ });
1393
+ const unarchiveChat = defineMethodV2("unarchiveChat", {
1394
+ meta: {
1395
+ description: "Unarchive a chat",
1396
+ action: "update",
1397
+ namespace: "chats",
1398
+ license: "none",
1399
+ functionality: "both",
1400
+ httpMethod: "PUT"
1401
+ },
1402
+ input: z.object({ chatId: chatIdParam }),
1403
+ parameterOrder: ["chatId"],
1404
+ output: z.boolean()
1405
+ });
1406
+ const clearChat = defineMethodV2("clearChat", {
1407
+ meta: {
1408
+ description: "Clear chat history",
1409
+ action: "delete",
1410
+ namespace: "chats",
1411
+ license: "none",
1412
+ functionality: "both",
1413
+ httpMethod: "DELETE"
1414
+ },
1415
+ input: z.object({ chatId: chatIdParam }),
1416
+ parameterOrder: ["chatId"],
1417
+ output: z.boolean()
1418
+ });
1419
+ const deleteChat = defineMethodV2("deleteChat", {
1420
+ meta: {
1421
+ description: "Delete a chat",
1422
+ action: "delete",
1423
+ namespace: "chats",
1424
+ license: "none",
1425
+ functionality: "both",
1426
+ httpMethod: "DELETE"
1427
+ },
1428
+ input: z.object({ chatId: chatIdParam }),
1429
+ parameterOrder: ["chatId"],
1430
+ output: z.boolean()
1431
+ });
1432
+ const pinChat = defineMethodV2("pinChat", {
1433
+ meta: {
1434
+ description: "Pin a chat",
1435
+ action: "update",
1436
+ namespace: "chats",
1437
+ license: "none",
1438
+ functionality: "both",
1439
+ httpMethod: "PUT"
1440
+ },
1441
+ input: z.object({ chatId: chatIdParam }),
1442
+ parameterOrder: ["chatId"],
1443
+ output: z.boolean()
1444
+ });
1445
+ const unpinChat = defineMethodV2("unpinChat", {
1446
+ meta: {
1447
+ description: "Unpin a chat",
1448
+ action: "update",
1449
+ namespace: "chats",
1450
+ license: "none",
1451
+ functionality: "both",
1452
+ httpMethod: "PUT"
1453
+ },
1454
+ input: z.object({ chatId: chatIdParam }),
1455
+ parameterOrder: ["chatId"],
1456
+ output: z.boolean()
1457
+ });
1458
+ const muteChat = defineMethodV2("muteChat", {
1459
+ meta: {
1460
+ description: "Mute a chat",
1461
+ action: "update",
1462
+ namespace: "chats",
1463
+ license: "none",
1464
+ functionality: "both",
1465
+ httpMethod: "PUT"
1466
+ },
1467
+ input: z.object({
1468
+ chatId: chatIdParam,
1469
+ muteDuration: z.union([z.number(), z.string()]).describe("Mute duration")
1470
+ }),
1471
+ parameterOrder: ["chatId", "muteDuration"],
1472
+ output: z.union([
1473
+ z.string(),
1474
+ z.boolean(),
1475
+ z.number()
1476
+ ])
1477
+ });
1478
+ const unmuteChat = defineMethodV2("unmuteChat", {
1479
+ meta: {
1480
+ description: "Unmute a chat",
1481
+ action: "update",
1482
+ namespace: "chats",
1483
+ license: "none",
1484
+ functionality: "both",
1485
+ httpMethod: "PUT"
1486
+ },
1487
+ input: z.object({ chatId: chatIdParam }),
1488
+ parameterOrder: ["chatId"],
1489
+ output: z.union([
1490
+ z.string(),
1491
+ z.boolean(),
1492
+ z.number()
1493
+ ])
1494
+ });
1495
+ const markAsRead = defineMethodV2("markAsRead", {
1496
+ meta: {
1497
+ description: "Mark chat as read",
1498
+ action: "update",
1499
+ namespace: "chats",
1500
+ license: "none",
1501
+ functionality: "both",
1502
+ httpMethod: "PUT",
1503
+ aliases: { namespacedName: "markAsRead" }
1504
+ },
1505
+ input: z.object({ chatId: chatIdParam }),
1506
+ parameterOrder: ["chatId"],
1507
+ output: z.boolean()
1508
+ });
1509
+ const markAsUnread = defineMethodV2("markAsUnread", {
1510
+ meta: {
1511
+ description: "Mark chat as unread",
1512
+ action: "update",
1513
+ namespace: "chats",
1514
+ license: "none",
1515
+ functionality: "both",
1516
+ httpMethod: "PUT",
1517
+ aliases: { namespacedName: "markAsUnread" }
1518
+ },
1519
+ input: z.object({ chatId: chatIdParam }),
1520
+ parameterOrder: ["chatId"],
1521
+ output: z.boolean()
1522
+ });
1523
+ const setChatEphemeral = defineMethodV2("setChatEphemeral", {
1524
+ meta: {
1525
+ description: "Set ephemeral messages for chat",
1526
+ action: "update",
1527
+ namespace: "chats",
1528
+ license: "none",
1529
+ functionality: "both",
1530
+ httpMethod: "PUT"
1531
+ },
1532
+ input: z.object({
1533
+ chatId: chatIdParam,
1534
+ ephemeral: z.union([z.boolean(), z.number()]).describe("Ephemeral setting")
1535
+ }),
1536
+ parameterOrder: ["chatId", "ephemeral"],
1537
+ output: z.boolean()
1538
+ });
1539
+ const isChatOnline = defineMethodV2("isChatOnline", {
1540
+ meta: {
1541
+ description: "Check if chat is online",
1542
+ action: "read",
1543
+ namespace: "chats",
1544
+ license: "none",
1545
+ functionality: "both",
1546
+ httpMethod: "GET"
1547
+ },
1548
+ input: z.object({ chatId: chatIdParam }),
1549
+ parameterOrder: ["chatId"],
1550
+ output: z.union([z.boolean(), z.string()])
1551
+ });
1552
+ //#endregion
1553
+ //#region src/methods/contacts.ts
1554
+ const getAllContacts = defineMethodV2("getAllContacts", {
1555
+ meta: {
1556
+ description: "Retrieves all contacts",
1557
+ action: "read",
1558
+ namespace: "contacts",
1559
+ license: "none",
1560
+ functionality: "both",
1561
+ httpMethod: "GET"
1562
+ },
1563
+ input: z.object({}),
1564
+ parameterOrder: [],
1565
+ output: z.array(z.any())
1566
+ });
1567
+ const getContact = defineMethodV2("getContact", {
1568
+ meta: {
1569
+ description: "Get specific contact",
1570
+ action: "read",
1571
+ namespace: "contacts",
1572
+ license: "none",
1573
+ functionality: "both",
1574
+ httpMethod: "GET"
1575
+ },
1576
+ input: z.object({ contactId: contactIdParam }),
1577
+ parameterOrder: ["contactId"],
1578
+ output: z.any()
1579
+ });
1580
+ const getCommonGroups = defineMethodV2("getCommonGroups", {
1581
+ meta: {
1582
+ description: "Get common groups with contact",
1583
+ action: "read",
1584
+ namespace: "contacts",
1585
+ license: "none",
1586
+ functionality: "both",
1587
+ httpMethod: "GET"
1588
+ },
1589
+ input: z.object({ contactId: contactIdParam }),
1590
+ parameterOrder: ["contactId"],
1591
+ output: z.any()
1592
+ });
1593
+ const getNumberProfile = defineMethodV2("getNumberProfile", {
1594
+ meta: {
1595
+ description: "Get profile of number",
1596
+ action: "read",
1597
+ namespace: "contacts",
1598
+ license: "insiders",
1599
+ functionality: "both",
1600
+ httpMethod: "GET"
1601
+ },
1602
+ input: z.object({ contactId: contactIdParam }),
1603
+ parameterOrder: ["contactId"],
1604
+ output: z.any()
1605
+ });
1606
+ const getBlockedIds = defineMethodV2("getBlockedIds", {
1607
+ meta: {
1608
+ description: "Get blocked contact IDs",
1609
+ action: "read",
1610
+ namespace: "contacts",
1611
+ license: "none",
1612
+ functionality: "both",
1613
+ httpMethod: "GET"
1614
+ },
1615
+ input: z.object({}),
1616
+ parameterOrder: [],
1617
+ output: z.array(z.string())
1618
+ });
1619
+ const blockContact = defineMethodV2("blockContact", {
1620
+ meta: {
1621
+ description: "Block a contact",
1622
+ action: "update",
1623
+ namespace: "contacts",
1624
+ license: "none",
1625
+ functionality: "both",
1626
+ httpMethod: "PUT",
1627
+ aliases: { deprecated: ["contactBlock"] },
1628
+ wapiOverride: "contactBlock"
1629
+ },
1630
+ input: z.object({ contactId: contactIdParam }),
1631
+ parameterOrder: ["contactId"],
1632
+ output: z.boolean()
1633
+ });
1634
+ const unblockContact = defineMethodV2("unblockContact", {
1635
+ meta: {
1636
+ description: "Unblock a contact",
1637
+ action: "update",
1638
+ namespace: "contacts",
1639
+ license: "none",
1640
+ functionality: "both",
1641
+ httpMethod: "PUT",
1642
+ aliases: { deprecated: ["contactUnblock"] },
1643
+ wapiOverride: "contactUnblock"
1644
+ },
1645
+ input: z.object({ contactId: contactIdParam }),
1646
+ parameterOrder: ["contactId"],
1647
+ output: z.boolean()
1648
+ });
1649
+ const checkReadReceipts = defineMethodV2("checkReadReceipts", {
1650
+ meta: {
1651
+ description: "Check read receipts setting",
1652
+ action: "read",
1653
+ namespace: "contacts",
1654
+ license: "none",
1655
+ functionality: "both",
1656
+ httpMethod: "GET",
1657
+ aliases: { explicit: ["getReadReceipts"] }
1658
+ },
1659
+ input: z.object({ contactId: contactIdParam }),
1660
+ parameterOrder: ["contactId"],
1661
+ output: z.union([z.boolean(), z.string()])
1662
+ });
1663
+ const checkNumberStatus = defineMethodV2("checkNumberStatus", {
1664
+ meta: {
1665
+ description: "Check if number is on WhatsApp",
1666
+ action: "read",
1667
+ namespace: "contacts",
1668
+ license: "insiders",
1669
+ functionality: "both",
1670
+ httpMethod: "GET"
1671
+ },
1672
+ input: z.object({ contactId: contactIdParam }),
1673
+ parameterOrder: ["contactId"],
1674
+ output: z.any()
1675
+ });
1676
+ const getProfilePicture = defineMethodV2("getProfilePicture", {
1677
+ meta: {
1678
+ description: "Get profile picture from server",
1679
+ action: "read",
1680
+ namespace: "contacts",
1681
+ license: "none",
1682
+ functionality: "both",
1683
+ httpMethod: "GET",
1684
+ aliases: { deprecated: ["getProfilePicFromServer"] },
1685
+ wapiOverride: "getProfilePicFromServer"
1686
+ },
1687
+ input: z.object({ chatId: chatIdParam }),
1688
+ parameterOrder: ["chatId"],
1689
+ output: z.string()
1690
+ });
1691
+ //#endregion
1692
+ //#region src/methods/groups.ts
1693
+ const getGroupMembers = defineMethodV2("getGroupMembers", {
1694
+ meta: {
1695
+ description: "Retrieves members of a group",
1696
+ action: "read",
1697
+ namespace: "groups",
1698
+ license: "none",
1699
+ functionality: "both",
1700
+ httpMethod: "GET"
1701
+ },
1702
+ input: z.object({ groupId: groupIdParam }),
1703
+ parameterOrder: ["groupId"],
1704
+ output: z.array(z.any())
1705
+ });
1706
+ const getAllGroups = defineMethodV2("getAllGroups", {
1707
+ meta: {
1708
+ description: "Get all groups",
1709
+ action: "read",
1710
+ namespace: "groups",
1711
+ license: "none",
1712
+ functionality: "both",
1713
+ httpMethod: "GET"
1714
+ },
1715
+ input: z.object({ withNewMessagesOnly: withNewMessagesOnlyParam }),
1716
+ parameterOrder: ["withNewMessagesOnly"],
1717
+ output: z.array(z.any())
1718
+ });
1719
+ const getGroupMembersId = defineMethodV2("getGroupMembersId", {
1720
+ meta: {
1721
+ description: "Get group member IDs",
1722
+ action: "read",
1723
+ namespace: "groups",
1724
+ license: "none",
1725
+ functionality: "both",
1726
+ httpMethod: "GET",
1727
+ aliases: {
1728
+ explicit: ["getGroupMemberIds"],
1729
+ namespacedName: "getMemberIds"
1730
+ }
1731
+ },
1732
+ input: z.object({ groupId: groupIdParam }),
1733
+ parameterOrder: ["groupId"],
1734
+ output: z.array(z.string())
1735
+ });
1736
+ const getGroupInfo = defineMethodV2("getGroupInfo", {
1737
+ meta: {
1738
+ description: "Get group metadata",
1739
+ action: "read",
1740
+ namespace: "groups",
1741
+ license: "none",
1742
+ functionality: "both",
1743
+ httpMethod: "GET"
1744
+ },
1745
+ input: z.object({ groupId: groupIdParam }),
1746
+ parameterOrder: ["groupId"],
1747
+ output: z.any()
1748
+ });
1749
+ const getGroupAdmins = defineMethodV2("getGroupAdmins", {
1750
+ meta: {
1751
+ description: "Get group admins",
1752
+ action: "read",
1753
+ namespace: "groups",
1754
+ license: "none",
1755
+ functionality: "both",
1756
+ httpMethod: "GET"
1757
+ },
1758
+ input: z.object({ groupId: groupIdParam }),
1759
+ parameterOrder: ["groupId"],
1760
+ output: z.array(z.any())
1761
+ });
1762
+ const getKickedGroups = defineMethodV2("getKickedGroups", {
1763
+ meta: {
1764
+ description: "Get groups where kicked",
1765
+ action: "read",
1766
+ namespace: "groups",
1767
+ license: "none",
1768
+ functionality: "both",
1769
+ httpMethod: "GET"
1770
+ },
1771
+ input: z.object({}),
1772
+ parameterOrder: [],
1773
+ output: z.array(z.string())
1774
+ });
1775
+ const getGroupInviteLink = defineMethodV2("getGroupInviteLink", {
1776
+ meta: {
1777
+ description: "Get group invite link",
1778
+ action: "read",
1779
+ namespace: "groups",
1780
+ license: "none",
1781
+ functionality: "both",
1782
+ httpMethod: "GET"
1783
+ },
1784
+ input: z.object({ groupId: groupIdParam }),
1785
+ parameterOrder: ["groupId"],
1786
+ output: z.string()
1787
+ });
1788
+ const createGroup = defineMethodV2("createGroup", {
1789
+ meta: {
1790
+ description: "Create new group",
1791
+ action: "send",
1792
+ namespace: "groups",
1793
+ license: "restricted",
1794
+ functionality: "both",
1795
+ httpMethod: "POST"
1796
+ },
1797
+ input: z.object({
1798
+ name: z.string().describe("Group name"),
1799
+ contacts: z.array(contactIdParam).describe("Contact IDs to add")
1800
+ }),
1801
+ parameterOrder: ["name", "contacts"],
1802
+ output: z.any()
1803
+ });
1804
+ const leaveGroup = defineMethodV2("leaveGroup", {
1805
+ meta: {
1806
+ description: "Leave a group",
1807
+ action: "update",
1808
+ namespace: "groups",
1809
+ license: "none",
1810
+ functionality: "both",
1811
+ httpMethod: "PUT"
1812
+ },
1813
+ input: z.object({ groupId: groupIdParam }),
1814
+ parameterOrder: ["groupId"],
1815
+ output: z.any()
1816
+ });
1817
+ const joinGroupViaLink = defineMethodV2("joinGroupViaLink", {
1818
+ meta: {
1819
+ description: "Join group via invite link",
1820
+ action: "send",
1821
+ namespace: "groups",
1822
+ license: "restricted",
1823
+ functionality: "both",
1824
+ httpMethod: "POST",
1825
+ aliases: {
1826
+ explicit: ["joinGroup"],
1827
+ namespacedName: "join"
1828
+ }
1829
+ },
1830
+ input: z.object({
1831
+ link: z.string().url().describe("Group invite link"),
1832
+ returnChatObj: z.boolean().optional().describe("Return chat object")
1833
+ }),
1834
+ parameterOrder: ["link", "returnChatObj"],
1835
+ output: z.union([
1836
+ z.string(),
1837
+ z.boolean(),
1838
+ z.number(),
1839
+ z.any()
1840
+ ])
1841
+ });
1842
+ const revokeGroupInviteLink = defineMethodV2("revokeGroupInviteLink", {
1843
+ meta: {
1844
+ description: "Revoke group invite link",
1845
+ action: "update",
1846
+ namespace: "groups",
1847
+ license: "none",
1848
+ functionality: "both",
1849
+ httpMethod: "PUT"
1850
+ },
1851
+ input: z.object({ groupId: groupIdParam }),
1852
+ parameterOrder: ["groupId"],
1853
+ output: z.union([z.string(), z.boolean()])
1854
+ });
1855
+ const setGroupTitle = defineMethodV2("setGroupTitle", {
1856
+ meta: {
1857
+ description: "Set group title",
1858
+ action: "update",
1859
+ namespace: "groups",
1860
+ license: "none",
1861
+ functionality: "both",
1862
+ httpMethod: "PUT"
1863
+ },
1864
+ input: z.object({
1865
+ groupId: groupIdParam,
1866
+ title: z.string().describe("New group title")
1867
+ }),
1868
+ parameterOrder: ["groupId", "title"],
1869
+ output: z.boolean()
1870
+ });
1871
+ const setGroupDescription = defineMethodV2("setGroupDescription", {
1872
+ meta: {
1873
+ description: "Set group description",
1874
+ action: "update",
1875
+ namespace: "groups",
1876
+ license: "none",
1877
+ functionality: "both",
1878
+ httpMethod: "PUT"
1879
+ },
1880
+ input: z.object({
1881
+ groupId: groupIdParam,
1882
+ description: z.string().describe("New group description")
1883
+ }),
1884
+ parameterOrder: ["groupId", "description"],
1885
+ output: z.boolean()
1886
+ });
1887
+ const setGroupIcon = defineMethodV2("setGroupIcon", {
1888
+ meta: {
1889
+ description: "Set group icon",
1890
+ action: "update",
1891
+ namespace: "groups",
1892
+ license: "none",
1893
+ functionality: "both",
1894
+ httpMethod: "PUT"
1895
+ },
1896
+ input: z.object({
1897
+ groupId: groupIdParam,
1898
+ image: z.string().describe("Image data URL")
1899
+ }),
1900
+ parameterOrder: ["groupId", "image"],
1901
+ output: z.boolean()
1902
+ });
1903
+ const setGroupToAdminsOnly = defineMethodV2("setGroupToAdminsOnly", {
1904
+ meta: {
1905
+ description: "Restrict group to admins only",
1906
+ action: "update",
1907
+ namespace: "groups",
1908
+ license: "none",
1909
+ functionality: "both",
1910
+ httpMethod: "PUT",
1911
+ aliases: { namespacedName: "setAdminsOnly" }
1912
+ },
1913
+ input: z.object({
1914
+ groupId: groupIdParam,
1915
+ onlyAdmins: z.boolean().describe("Admins only setting")
1916
+ }),
1917
+ parameterOrder: ["groupId", "onlyAdmins"],
1918
+ output: z.boolean()
1919
+ });
1920
+ const setGroupEditToAdminsOnly = defineMethodV2("setGroupEditToAdminsOnly", {
1921
+ meta: {
1922
+ description: "Restrict group editing to admins only",
1923
+ action: "update",
1924
+ namespace: "groups",
1925
+ license: "none",
1926
+ functionality: "both",
1927
+ httpMethod: "PUT",
1928
+ aliases: { namespacedName: "setEditAdminsOnly" }
1929
+ },
1930
+ input: z.object({
1931
+ groupId: groupIdParam,
1932
+ onlyAdmins: z.boolean().describe("Admins only setting")
1933
+ }),
1934
+ parameterOrder: ["groupId", "onlyAdmins"],
1935
+ output: z.boolean()
1936
+ });
1937
+ const addParticipant = defineMethodV2("addParticipant", {
1938
+ meta: {
1939
+ description: "Add participant to group",
1940
+ action: "update",
1941
+ namespace: "groups",
1942
+ license: "none",
1943
+ functionality: "both",
1944
+ httpMethod: "PUT",
1945
+ aliases: { explicit: ["addGroupParticipant"] }
1946
+ },
1947
+ input: z.object({
1948
+ groupId: groupIdParam,
1949
+ contactId: contactIdParam
1950
+ }),
1951
+ parameterOrder: ["groupId", "contactId"],
1952
+ output: z.boolean()
1953
+ });
1954
+ const removeParticipant = defineMethodV2("removeParticipant", {
1955
+ meta: {
1956
+ description: "Remove participant from group",
1957
+ action: "update",
1958
+ namespace: "groups",
1959
+ license: "none",
1960
+ functionality: "both",
1961
+ httpMethod: "PUT",
1962
+ aliases: { explicit: ["removeGroupParticipant"] }
1963
+ },
1964
+ input: z.object({
1965
+ groupId: groupIdParam,
1966
+ contactId: contactIdParam
1967
+ }),
1968
+ parameterOrder: ["groupId", "contactId"],
1969
+ output: z.boolean()
1970
+ });
1971
+ const promoteParticipant = defineMethodV2("promoteParticipant", {
1972
+ meta: {
1973
+ description: "Promote participant to admin",
1974
+ action: "update",
1975
+ namespace: "groups",
1976
+ license: "none",
1977
+ functionality: "both",
1978
+ httpMethod: "PUT",
1979
+ aliases: { explicit: ["promoteGroupParticipant"] }
1980
+ },
1981
+ input: z.object({
1982
+ groupId: groupIdParam,
1983
+ contactId: contactIdParam
1984
+ }),
1985
+ parameterOrder: ["groupId", "contactId"],
1986
+ output: z.union([z.boolean(), z.string()])
1987
+ });
1988
+ const demoteParticipant = defineMethodV2("demoteParticipant", {
1989
+ meta: {
1990
+ description: "Demote participant from admin",
1991
+ action: "update",
1992
+ namespace: "groups",
1993
+ license: "none",
1994
+ functionality: "both",
1995
+ httpMethod: "PUT",
1996
+ aliases: { explicit: ["demoteGroupParticipant"] }
1997
+ },
1998
+ input: z.object({
1999
+ groupId: groupIdParam,
2000
+ contactId: contactIdParam
2001
+ }),
2002
+ parameterOrder: ["groupId", "contactId"],
2003
+ output: z.union([z.boolean(), z.string()])
2004
+ });
2005
+ const approveGroupJoinRequest = defineMethodV2("approveGroupJoinRequest", {
2006
+ meta: {
2007
+ description: "Approve group join request",
2008
+ action: "update",
2009
+ namespace: "groups",
2010
+ license: "none",
2011
+ functionality: "both",
2012
+ httpMethod: "PUT"
2013
+ },
2014
+ input: z.object({
2015
+ groupId: groupIdParam,
2016
+ contactId: contactIdParam
2017
+ }),
2018
+ parameterOrder: ["groupId", "contactId"],
2019
+ output: z.union([z.string(), z.boolean()])
2020
+ });
2021
+ const rejectGroupJoinRequest = defineMethodV2("rejectGroupJoinRequest", {
2022
+ meta: {
2023
+ description: "Reject group join request",
2024
+ action: "update",
2025
+ namespace: "groups",
2026
+ license: "none",
2027
+ functionality: "both",
2028
+ httpMethod: "PUT"
2029
+ },
2030
+ input: z.object({
2031
+ groupId: groupIdParam,
2032
+ contactId: contactIdParam
2033
+ }),
2034
+ parameterOrder: ["groupId", "contactId"],
2035
+ output: z.union([z.string(), z.boolean()])
2036
+ });
2037
+ //#endregion
2038
+ //#region src/methods/communities.ts
2039
+ /**
2040
+ * Get all communities
2041
+ */
2042
+ const getAllCommunities = defineMethodV2("getAllCommunities", {
2043
+ meta: {
2044
+ description: "Get all communities",
2045
+ action: "read",
2046
+ namespace: "communities",
2047
+ license: "none",
2048
+ functionality: "both",
2049
+ httpMethod: "GET"
2050
+ },
2051
+ input: z.object({}),
2052
+ parameterOrder: [],
2053
+ output: z.array(z.string())
2054
+ });
2055
+ /**
2056
+ * Get community info
2057
+ */
2058
+ const getCommunityInfo = defineMethodV2("getCommunityInfo", {
2059
+ meta: {
2060
+ description: "Get community metadata",
2061
+ action: "read",
2062
+ namespace: "communities",
2063
+ license: "none",
2064
+ functionality: "both",
2065
+ httpMethod: "GET"
2066
+ },
2067
+ input: z.object({ communityId: communityIdParam }),
2068
+ parameterOrder: ["communityId"],
2069
+ output: z.any()
2070
+ });
2071
+ /**
2072
+ * Get community participant IDs
2073
+ */
2074
+ const getCommunityParticipantIds = defineMethodV2("getCommunityParticipantIds", {
2075
+ meta: {
2076
+ description: "Get community participant IDs",
2077
+ action: "read",
2078
+ namespace: "communities",
2079
+ license: "none",
2080
+ functionality: "both",
2081
+ httpMethod: "GET"
2082
+ },
2083
+ input: z.object({ communityId: communityIdParam }),
2084
+ parameterOrder: ["communityId"],
2085
+ output: z.any()
2086
+ });
2087
+ /**
2088
+ * Get community admin IDs
2089
+ */
2090
+ const getCommunityAdminIds = defineMethodV2("getCommunityAdminIds", {
2091
+ meta: {
2092
+ description: "Get community admin IDs",
2093
+ action: "read",
2094
+ namespace: "communities",
2095
+ license: "none",
2096
+ functionality: "both",
2097
+ httpMethod: "GET"
2098
+ },
2099
+ input: z.object({ communityId: communityIdParam }),
2100
+ parameterOrder: ["communityId"],
2101
+ output: z.any()
2102
+ });
2103
+ /**
2104
+ * Get community participants
2105
+ */
2106
+ const getCommunityParticipants = defineMethodV2("getCommunityParticipants", {
2107
+ meta: {
2108
+ description: "Get community participants",
2109
+ action: "read",
2110
+ namespace: "communities",
2111
+ license: "none",
2112
+ functionality: "both",
2113
+ httpMethod: "GET"
2114
+ },
2115
+ input: z.object({ communityId: communityIdParam }),
2116
+ parameterOrder: ["communityId"],
2117
+ output: z.any()
2118
+ });
2119
+ /**
2120
+ * Get community admins
2121
+ */
2122
+ const getCommunityAdmins = defineMethodV2("getCommunityAdmins", {
2123
+ meta: {
2124
+ description: "Get community admins",
2125
+ action: "read",
2126
+ namespace: "communities",
2127
+ license: "none",
2128
+ functionality: "both",
2129
+ httpMethod: "GET"
2130
+ },
2131
+ input: z.object({ communityId: communityIdParam }),
2132
+ parameterOrder: ["communityId"],
2133
+ output: z.any()
2134
+ });
2135
+ //#endregion
2136
+ //#region src/methods/status.ts
2137
+ const postTextStatus = defineMethodV2("postTextStatus", {
2138
+ meta: {
2139
+ description: "Post text status",
2140
+ action: "send",
2141
+ namespace: "status",
2142
+ license: "insiders",
2143
+ functionality: "both",
2144
+ httpMethod: "POST"
2145
+ },
2146
+ input: z.object({
2147
+ text: z.string().describe("Status text"),
2148
+ backgroundColor: z.string().optional().describe("Background color"),
2149
+ font: z.number().optional().describe("Font style")
2150
+ }),
2151
+ parameterOrder: [
2152
+ "text",
2153
+ "backgroundColor",
2154
+ "font"
2155
+ ],
2156
+ output: z.any()
2157
+ });
2158
+ const postImageStatus = defineMethodV2("postImageStatus", {
2159
+ meta: {
2160
+ description: "Post image status",
2161
+ action: "send",
2162
+ namespace: "status",
2163
+ license: "insiders",
2164
+ functionality: "both",
2165
+ httpMethod: "POST"
2166
+ },
2167
+ input: z.object({
2168
+ image: z.string().describe("Image data URL"),
2169
+ caption: z.string().optional().describe("Status caption")
2170
+ }),
2171
+ parameterOrder: ["image", "caption"],
2172
+ output: z.any()
2173
+ });
2174
+ const postVideoStatus = defineMethodV2("postVideoStatus", {
2175
+ meta: {
2176
+ description: "Post video status",
2177
+ action: "send",
2178
+ namespace: "status",
2179
+ license: "insiders",
2180
+ functionality: "both",
2181
+ httpMethod: "POST"
2182
+ },
2183
+ input: z.object({
2184
+ video: z.string().describe("Video data URL"),
2185
+ caption: z.string().optional().describe("Status caption")
2186
+ }),
2187
+ parameterOrder: ["video", "caption"],
2188
+ output: z.any()
2189
+ });
2190
+ const getStories = defineMethodV2("getStories", {
2191
+ meta: {
2192
+ description: "Get all stories",
2193
+ action: "read",
2194
+ namespace: "status",
2195
+ license: "insiders",
2196
+ functionality: "both",
2197
+ httpMethod: "GET",
2198
+ aliases: {
2199
+ explicit: ["getStatuses"],
2200
+ namespacedName: "getAll"
2201
+ }
2202
+ },
2203
+ input: z.object({}),
2204
+ parameterOrder: [],
2205
+ output: z.array(z.any())
2206
+ });
2207
+ const getStatus = defineMethodV2("getStatus", {
2208
+ meta: {
2209
+ description: "Get specific status",
2210
+ action: "read",
2211
+ namespace: "mystatus",
2212
+ license: "insiders",
2213
+ functionality: "both",
2214
+ httpMethod: "GET"
2215
+ },
2216
+ input: z.object({ contactId: contactIdParam }),
2217
+ parameterOrder: ["contactId"],
2218
+ output: z.any()
2219
+ });
2220
+ const deleteStatus = defineMethodV2("deleteStatus", {
2221
+ meta: {
2222
+ description: "Delete status",
2223
+ action: "delete",
2224
+ namespace: "status",
2225
+ license: "insiders",
2226
+ functionality: "both",
2227
+ httpMethod: "DELETE"
2228
+ },
2229
+ input: z.object({ statusesToDelete: z.union([z.string(), z.array(z.string())]).describe("Status ID(s)") }),
2230
+ parameterOrder: ["statusesToDelete"],
2231
+ output: z.any()
2232
+ });
2233
+ const deleteAllStatus = defineMethodV2("deleteAllStatus", {
2234
+ meta: {
2235
+ description: "Delete all statuses",
2236
+ action: "delete",
2237
+ namespace: "status",
2238
+ license: "insiders",
2239
+ functionality: "both",
2240
+ httpMethod: "DELETE",
2241
+ aliases: { explicit: ["deleteAllStatuses"] }
2242
+ },
2243
+ input: z.object({}),
2244
+ parameterOrder: [],
2245
+ output: z.any()
2246
+ });
2247
+ //#endregion
2248
+ //#region src/methods/labels.ts
2249
+ /**
2250
+ * Get all labels
2251
+ */
2252
+ const getAllLabels = defineMethodV2("getAllLabels", {
2253
+ meta: {
2254
+ description: "Get all labels",
2255
+ action: "read",
2256
+ namespace: "labels",
2257
+ license: "none",
2258
+ functionality: "business-only",
2259
+ httpMethod: "GET"
2260
+ },
2261
+ input: z.object({}),
2262
+ parameterOrder: [],
2263
+ output: z.array(z.any())
2264
+ });
2265
+ /**
2266
+ * Get chats by label
2267
+ */
2268
+ const getChatsByLabel = defineMethodV2("getChatsByLabel", {
2269
+ meta: {
2270
+ description: "Get chats by label",
2271
+ action: "read",
2272
+ namespace: "labels",
2273
+ license: "none",
2274
+ functionality: "business-only",
2275
+ httpMethod: "GET",
2276
+ aliases: { namespacedName: "getChats" }
2277
+ },
2278
+ input: z.object({ label: z.string().describe("Label name") }),
2279
+ parameterOrder: ["label"],
2280
+ output: z.array(z.any())
2281
+ });
2282
+ /**
2283
+ * Add label
2284
+ */
2285
+ const addLabel = defineMethodV2("addLabel", {
2286
+ meta: {
2287
+ description: "Add label to chat",
2288
+ action: "update",
2289
+ namespace: "labels",
2290
+ license: "none",
2291
+ functionality: "business-only",
2292
+ httpMethod: "PUT"
2293
+ },
2294
+ input: z.object({
2295
+ label: z.string().describe("Label ID or name"),
2296
+ chatId: toParam
2297
+ }),
2298
+ parameterOrder: ["label", "chatId"],
2299
+ output: z.boolean()
2300
+ });
2301
+ /**
2302
+ * Remove label
2303
+ */
2304
+ const removeLabel = defineMethodV2("removeLabel", {
2305
+ meta: {
2306
+ description: "Remove label from chat",
2307
+ action: "update",
2308
+ namespace: "labels",
2309
+ license: "none",
2310
+ functionality: "business-only",
2311
+ httpMethod: "PUT"
2312
+ },
2313
+ input: z.object({
2314
+ label: z.string().describe("Label ID or name"),
2315
+ chatId: toParam
2316
+ }),
2317
+ parameterOrder: ["label", "chatId"],
2318
+ output: z.boolean()
2319
+ });
2320
+ //#endregion
2321
+ //#region src/methods/business.ts
2322
+ const getBusinessProfile = defineMethodV2("getBusinessProfile", {
2323
+ meta: {
2324
+ description: "Get business profile",
2325
+ action: "read",
2326
+ namespace: "business",
2327
+ license: "none",
2328
+ functionality: "both",
2329
+ httpMethod: "GET"
2330
+ },
2331
+ input: z.object({ contactId: contactIdParam }),
2332
+ parameterOrder: ["contactId"],
2333
+ output: z.any()
2334
+ });
2335
+ const getBusinessProducts = defineMethodV2("getBusinessProducts", {
2336
+ meta: {
2337
+ description: "Get business products",
2338
+ action: "read",
2339
+ namespace: "business",
2340
+ license: "none",
2341
+ functionality: "both",
2342
+ httpMethod: "GET",
2343
+ aliases: { deprecated: ["getBusinessProfilesProducts"] },
2344
+ wapiOverride: "getBusinessProfilesProducts"
2345
+ },
2346
+ input: z.object({ contactId: contactIdParam }),
2347
+ parameterOrder: ["contactId"],
2348
+ output: z.any()
2349
+ });
2350
+ const getOrder = defineMethodV2("getOrder", {
2351
+ meta: {
2352
+ description: "Get order details",
2353
+ action: "read",
2354
+ namespace: "business",
2355
+ license: "insiders",
2356
+ functionality: "both",
2357
+ httpMethod: "GET"
2358
+ },
2359
+ input: z.object({ id: z.union([messageIdParam, z.string()]).describe("Order or message ID") }),
2360
+ parameterOrder: ["id"],
2361
+ output: z.any()
2362
+ });
2363
+ //#endregion
2364
+ //#region src/methods/session.ts
2365
+ const getMe = defineMethodV2("getMe", {
2366
+ meta: {
2367
+ description: "Get host account info",
2368
+ action: "read",
2369
+ namespace: "session",
2370
+ license: "none",
2371
+ functionality: "both",
2372
+ httpMethod: "GET"
2373
+ },
2374
+ input: z.object({}),
2375
+ parameterOrder: [],
2376
+ output: z.any()
2377
+ });
2378
+ const getHostNumber = defineMethodV2("getHostNumber", {
2379
+ meta: {
2380
+ description: "Get host phone number",
2381
+ action: "read",
2382
+ namespace: "session",
2383
+ license: "none",
2384
+ functionality: "both",
2385
+ httpMethod: "GET"
2386
+ },
2387
+ input: z.object({}),
2388
+ parameterOrder: [],
2389
+ output: z.string()
2390
+ });
2391
+ const getConnectionState = defineMethodV2("getConnectionState", {
2392
+ meta: {
2393
+ description: "Get connection state",
2394
+ action: "read",
2395
+ namespace: "session",
2396
+ license: "none",
2397
+ functionality: "both",
2398
+ httpMethod: "GET"
2399
+ },
2400
+ input: z.object({}),
2401
+ parameterOrder: [],
2402
+ output: z.any()
2403
+ });
2404
+ const getWAVersion = defineMethodV2("getWAVersion", {
2405
+ meta: {
2406
+ description: "Get WhatsApp Web version",
2407
+ action: "read",
2408
+ namespace: "session",
2409
+ license: "none",
2410
+ functionality: "both",
2411
+ httpMethod: "GET",
2412
+ aliases: { explicit: ["getWhatsAppVersion"] }
2413
+ },
2414
+ input: z.object({}),
2415
+ parameterOrder: [],
2416
+ output: z.string()
2417
+ });
2418
+ const getBatteryLevel = defineMethodV2("getBatteryLevel", {
2419
+ meta: {
2420
+ description: "Get phone battery level",
2421
+ action: "read",
2422
+ namespace: "session",
2423
+ license: "none",
2424
+ functionality: "both",
2425
+ httpMethod: "GET"
2426
+ },
2427
+ input: z.object({}),
2428
+ parameterOrder: [],
2429
+ output: z.number()
2430
+ });
2431
+ const isPlugged = defineMethodV2("isPlugged", {
2432
+ meta: {
2433
+ description: "Check if phone is charging",
2434
+ action: "read",
2435
+ namespace: "session",
2436
+ license: "none",
2437
+ functionality: "both",
2438
+ httpMethod: "GET",
2439
+ aliases: { deprecated: ["getIsPlugged"] },
2440
+ wapiOverride: "getIsPlugged"
2441
+ },
2442
+ input: z.object({}),
2443
+ parameterOrder: [],
2444
+ output: z.boolean()
2445
+ });
2446
+ const getFeatures = defineMethodV2("getFeatures", {
2447
+ meta: {
2448
+ description: "Get enabled features",
2449
+ action: "read",
2450
+ namespace: "session",
2451
+ license: "none",
2452
+ functionality: "both",
2453
+ httpMethod: "GET"
2454
+ },
2455
+ input: z.object({}),
2456
+ parameterOrder: [],
2457
+ output: z.any()
2458
+ });
2459
+ const getLicenseType = defineMethodV2("getLicenseType", {
2460
+ meta: {
2461
+ description: "Get license type",
2462
+ action: "read",
2463
+ namespace: "session",
2464
+ license: "none",
2465
+ functionality: "both",
2466
+ httpMethod: "GET"
2467
+ },
2468
+ input: z.object({}),
2469
+ parameterOrder: [],
2470
+ output: z.union([z.any(), z.boolean()])
2471
+ });
2472
+ const getUserAgent = defineMethodV2("getUserAgent", {
2473
+ meta: {
2474
+ description: "Get user agent",
2475
+ action: "read",
2476
+ namespace: "session",
2477
+ license: "none",
2478
+ functionality: "both",
2479
+ httpMethod: "GET",
2480
+ aliases: { deprecated: ["getGeneratedUserAgent"] },
2481
+ wapiOverride: "getGeneratedUserAgent"
2482
+ },
2483
+ input: z.object({ userAgent: userAgentParam }),
2484
+ parameterOrder: ["userAgent"],
2485
+ output: z.string()
2486
+ });
2487
+ const getProcessStats = defineMethodV2("getProcessStats", {
2488
+ meta: {
2489
+ description: "Get process statistics",
2490
+ action: "read",
2491
+ namespace: "session",
2492
+ license: "none",
2493
+ functionality: "both",
2494
+ httpMethod: "GET"
2495
+ },
2496
+ input: z.object({}),
2497
+ parameterOrder: [],
2498
+ output: z.any()
2499
+ });
2500
+ const getLoadedMessageCount = defineMethodV2("getLoadedMessageCount", {
2501
+ meta: {
2502
+ description: "Get loaded message count",
2503
+ action: "read",
2504
+ namespace: "session",
2505
+ license: "none",
2506
+ functionality: "both",
2507
+ httpMethod: "GET",
2508
+ aliases: { deprecated: ["getAmountOfLoadedMessages"] },
2509
+ wapiOverride: "getAmountOfLoadedMessages"
2510
+ },
2511
+ input: z.object({}),
2512
+ parameterOrder: [],
2513
+ output: z.number()
2514
+ });
2515
+ const getSnapshot = defineMethodV2("getSnapshot", {
2516
+ meta: {
2517
+ description: "Take screenshot",
2518
+ action: "read",
2519
+ namespace: "session",
2520
+ license: "none",
2521
+ functionality: "both",
2522
+ httpMethod: "GET",
2523
+ aliases: { explicit: ["takeScreenshot"] }
2524
+ },
2525
+ input: z.object({
2526
+ chatId: chatIdParam.optional(),
2527
+ width: z.number().optional(),
2528
+ height: z.number().optional()
2529
+ }),
2530
+ parameterOrder: [
2531
+ "chatId",
2532
+ "width",
2533
+ "height"
2534
+ ],
2535
+ output: z.string()
2536
+ });
2537
+ const healthCheck = defineMethodV2("healthCheck", {
2538
+ meta: {
2539
+ description: "Health check",
2540
+ action: "read",
2541
+ namespace: "session",
2542
+ license: "none",
2543
+ functionality: "both",
2544
+ httpMethod: "GET"
2545
+ },
2546
+ input: z.object({}),
2547
+ parameterOrder: [],
2548
+ output: z.any()
2549
+ });
2550
+ const setMyName = defineMethodV2("setMyName", {
2551
+ meta: {
2552
+ description: "Set host name",
2553
+ action: "update",
2554
+ namespace: "session",
2555
+ license: "none",
2556
+ functionality: "personal-only",
2557
+ httpMethod: "PUT",
2558
+ aliases: {
2559
+ explicit: ["setDisplayName"],
2560
+ namespacedName: "setName"
2561
+ }
2562
+ },
2563
+ input: z.object({ name: nameParam }),
2564
+ parameterOrder: ["name"],
2565
+ output: z.boolean()
2566
+ });
2567
+ const setMyStatus = defineMethodV2("setMyStatus", {
2568
+ meta: {
2569
+ description: "Set host status",
2570
+ action: "update",
2571
+ namespace: "session",
2572
+ license: "none",
2573
+ functionality: "both",
2574
+ httpMethod: "PUT",
2575
+ aliases: {
2576
+ explicit: ["setStatusText"],
2577
+ namespacedName: "setStatus"
2578
+ }
2579
+ },
2580
+ input: z.object({ statusText: statusTextParam }),
2581
+ parameterOrder: ["statusText"],
2582
+ output: z.boolean()
2583
+ });
2584
+ const setProfilePicture = defineMethodV2("setProfilePicture", {
2585
+ meta: {
2586
+ description: "Set profile picture",
2587
+ action: "update",
2588
+ namespace: "session",
2589
+ license: "insiders",
2590
+ functionality: "both",
2591
+ httpMethod: "PUT",
2592
+ aliases: { deprecated: ["setProfilePic"] },
2593
+ wapiOverride: "setProfilePic"
2594
+ },
2595
+ input: z.object({ image: imageDataParam }),
2596
+ parameterOrder: ["image"],
2597
+ output: z.boolean()
2598
+ });
2599
+ //#endregion
2600
+ //#region src/methods/media.ts
2601
+ const decryptMedia = defineMethodV2("decryptMedia", {
2602
+ meta: {
2603
+ description: "Decrypts media from a message",
2604
+ action: "read",
2605
+ namespace: "media",
2606
+ license: "none",
2607
+ functionality: "both",
2608
+ httpMethod: "POST"
2609
+ },
2610
+ input: z.object({ message: MessageSchema.describe("Message object containing media") }),
2611
+ parameterOrder: ["message"],
2612
+ output: z.string().describe("Base64 encoded decrypted media")
2613
+ });
2614
+ const downloadMedia = defineMethodV2("downloadMedia", {
2615
+ meta: {
2616
+ description: "Downloads and decrypts media from a message to a file",
2617
+ action: "read",
2618
+ namespace: "media",
2619
+ license: "none",
2620
+ functionality: "both",
2621
+ httpMethod: "POST"
2622
+ },
2623
+ input: z.object({
2624
+ message: MessageSchema.describe("Message object containing media"),
2625
+ path: z.string().describe("File path to save the media")
2626
+ }),
2627
+ parameterOrder: ["message", "path"],
2628
+ output: z.string().describe("Path to the saved file")
2629
+ });
2630
+ //#endregion
2631
+ export { rejectGroupJoinRequest as $, GroupIdSchema as $n, sendLinkWithAutoPreview as $t, postImageStatus as A, locationNameParam as An, MessageIdReturnSchema as Ar, unarchiveChat as At, approveGroupJoinRequest as B, stickerDataParam as Bn, getStarredMessages as Bt, getAllLabels as C, fileDataParam as Cn, ChatSchema as Cr, getChatWithNonContacts as Ct, deleteStatus as D, includeMeParam as Dn, IdSchema as Dr, muteChat as Dt, deleteAllStatus as E, imageDataParam as En, GroupMetadataSchema as Er, markAsUnread as Et, getCommunityAdmins as F, messageOptionsParam as Fn, getAllMessages as Ft, getGroupInfo as G, withNewMessagesOnlyParam as Gn, sendAdvancedButtons as Gt, demoteParticipant as H, userAgentParam as Hn, getVCards as Ht, getCommunityInfo as I, nameParam as In, getMessageById as It, getGroupMembersId as J, ChatIdSchema as Jn, sendButtons as Jt, getGroupInviteLink as K, Base64ToDataUrlSchema as Kn, sendAudio as Kt, getCommunityParticipantIds as L, onlyLocalParam as Ln, getMessageInfo as Lt, postVideoStatus as M, mentionedJidListParam as Mn, MessageTypes as Mr, unpinChat as Mt, getAllCommunities as N, messageIdParam as Nn, SimpleListener as Nr, deleteMessage as Nt, getStatus as O, includeNotificationsParam as On, LocationSchema as Or, pinChat as Ot, getCommunityAdminIds as P, messageIdsParam as Pn, forwardMessages as Pt, promoteParticipant as Q, GroupIdCodecSchema as Qn, sendImage as Qt, getCommunityParticipants as R, skipMyMessagesParam as Rn, getMessagesForLLM as Rt, addLabel as S, documentDataParam as Sn, urlToDataUrlCodec as Sr, getChat as St, removeLabel as T, groupIdParam as Tn, GroupChatIdSchema as Tr, markAsRead as Tt, getAllGroups as U, videoDataParam as Un, loadEarlierMessages as Ut, createGroup as V, toParam as Vn, getUnsentMessages as Vt, getGroupAdmins as W, waitForIdParam as Wn, react as Wt, joinGroupViaLink as X, ContactIdSchema as Xn, sendFile as Xt, getKickedGroups as Y, ContactIdCodecSchema as Yn, sendContact as Yt, leaveGroup as Z, FileToDataUrlSchema as Zn, sendFileFromUrl as Zt, setMyStatus as _, captionParam as _n, isoDatetimeToDate as _r, archiveChat as _t, getFeatures as a, sendPoll as an, UnixSecondsToDateSchema as ar, setGroupTitle as at, getBusinessProfile as b, contactIdParam as bn, unixMillisToDate as br, getAllChatIds as bt, getLoadedMessageCount as c, sendSeen as cn, contactIdCodec as cr, checkNumberStatus as ct, getSnapshot as d, sendVCard as dn, fileToBufferCodec as dr, getBlockedIds as dt, sendListMessage as en, HexColorSchema as er, removeParticipant as et, getUserAgent as f, sendVideoAsGif as fn, fileToDataUrlCodec as fr, getCommonGroups as ft, setMyName as g, audioDataParam as gn, hexColorCodec as gr, unblockContact as gt, isPlugged as h, unstarMessage as hn, groupIdCodec as hr, getProfilePicture as ht, getConnectionState as i, sendPaymentRequest as in, UnixMillisToDateSchema as ir, setGroupIcon as it, postTextStatus as j, longitudeParam as jn, MessageSchema as jr, unmuteChat as jt, getStories as k, latitudeParam as kn, MessageAck as kr, setChatEphemeral as kt, getMe as l, sendText as ln, createFileCodec as lr, checkReadReceipts as lt, healthCheck as m, starMessage as mn, fileToTempPathCodec as mr, getNumberProfile as mt, downloadMedia as n, sendMessageWithThumb as nn, MessageIdCodecSchema as nr, setGroupDescription as nt, getHostNumber as o, sendPtt as on, base64ToDataUrlCodec as or, setGroupToAdminsOnly as ot, getWAVersion as p, sendYouTubeLink as pn, fileToStreamCodec as pr, getContact as pt, getGroupMembers as q, ChatIdCodecSchema as qn, sendBanner as qt, getBatteryLevel as r, sendMultipleContacts as rn, MessageIdSchema as rr, setGroupEditToAdminsOnly as rt, getLicenseType as s, sendReplyWithMentions as sn, chatIdCodec as sr, blockContact as st, decryptMedia as t, sendLocation as tn, IsoDatetimeToDateSchema as tr, revokeGroupInviteLink as tt, getProcessStats as u, sendTextWithMentions as un, fileToBase64Codec as ur, getAllContacts as ut, setProfilePicture as v, chatIdParam as vn, jsonStringCodec as vr, clearChat as vt, getChatsByLabel as w, filenameParam as wn, ContactSchema as wr, isChatOnline as wt, getOrder as x, contentParam as xn, unixSecondsToDate as xr, getAllChats as xt, getBusinessProducts as y, communityIdParam as yn, messageIdCodec as yr, deleteChat as yt, addParticipant as z, statusTextParam as zn, getMyLastMessage as zt };
2632
+
2633
+ //# sourceMappingURL=methods-BXZrkKjP.mjs.map