@open-wa/schema 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calling-media--BLrFrPc.cjs +113 -0
- package/dist/calling-media--BLrFrPc.cjs.map +1 -0
- package/dist/calling-media-BNTYvogE.mjs +60 -0
- package/dist/calling-media-BNTYvogE.mjs.map +1 -0
- package/dist/calling-media-CeGgSzhw.d.cts +48 -0
- package/dist/calling-media-CeGgSzhw.d.cts.map +1 -0
- package/dist/calling-media-CeGgSzhw.d.mts +48 -0
- package/dist/calling-media-CeGgSzhw.d.mts.map +1 -0
- package/dist/calling-media.cjs +8 -0
- package/dist/calling-media.d.cts +2 -0
- package/dist/calling-media.d.mts +2 -0
- package/dist/calling-media.mjs +2 -0
- package/dist/generated/index.cjs +94 -3
- package/dist/generated/index.cjs.map +1 -1
- package/dist/generated/index.d.cts +2328 -133
- package/dist/generated/index.d.cts.map +1 -1
- package/dist/generated/index.d.mts +2328 -133
- package/dist/generated/index.d.mts.map +1 -1
- package/dist/generated/index.mjs +94 -3
- package/dist/generated/index.mjs.map +1 -1
- package/dist/{index-C9Ad0lEr.d.cts → index-BWvNXopK.d.cts} +2375 -41
- package/dist/index-BWvNXopK.d.cts.map +1 -0
- package/dist/{index-D0QN2PaW.d.mts → index-Co8HQxm8.d.mts} +2375 -41
- package/dist/index-Co8HQxm8.d.mts.map +1 -0
- package/dist/index.cjs +191 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +105 -21
- package/dist/index.mjs.map +1 -1
- package/dist/methods/index.cjs +34 -1
- package/dist/methods/index.d.cts +2 -2
- package/dist/methods/index.d.mts +2 -2
- package/dist/methods/index.mjs +2 -2
- package/dist/{methods-BhLsQNtL.mjs → methods-BH7nDC3z.mjs} +816 -51
- package/dist/methods-BH7nDC3z.mjs.map +1 -0
- package/dist/{methods-BGmdzjd3.cjs → methods-DpDzgsbe.cjs} +1284 -63
- package/dist/methods-DpDzgsbe.cjs.map +1 -0
- package/package.json +15 -4
- package/src/calling-media.ts +64 -0
- package/src/calling-wire.ts +17 -0
- package/src/calling.ts +61 -0
- package/src/common-types.ts +16 -0
- package/src/effect-projection.ts +67 -0
- package/src/events/calls.ts +12 -0
- package/src/events/groups.ts +30 -6
- package/src/events/index.ts +4 -0
- package/src/events/messaging.ts +7 -7
- package/src/events/polls.ts +11 -0
- package/src/events/registry.ts +2 -1
- package/src/events/whatsapp-events.ts +13 -0
- package/src/generated/AliasMap.ts +30 -1
- package/src/generated/BaseClient.ts +153 -8
- package/src/generated/BaseNamespacedClient.ts +36 -1
- package/src/generated/openapi.json +22999 -12765
- package/src/generated/types.ts +87 -0
- package/src/index.ts +10 -0
- package/src/license.ts +10 -0
- package/src/media-options.ts +46 -0
- package/src/methods/calls.ts +23 -0
- package/src/methods/contacts.ts +10 -1
- package/src/methods/groups.ts +9 -3
- package/src/methods/index.ts +2 -0
- package/src/methods/messaging.ts +159 -45
- package/src/methods/session.ts +10 -0
- package/src/methods/whatsapp-events.ts +35 -0
- package/src/polls.ts +37 -0
- package/src/session-refresh.ts +15 -0
- package/src/whatsapp-event-registry.ts +17 -0
- package/src/whatsapp-events.ts +91 -0
- package/dist/index-C9Ad0lEr.d.cts.map +0 -1
- package/dist/index-D0QN2PaW.d.mts.map +0 -1
- package/dist/methods-BGmdzjd3.cjs.map +0 -1
- package/dist/methods-BhLsQNtL.mjs.map +0 -1
|
@@ -1,6 +1,185 @@
|
|
|
1
1
|
import { d as parameterRegistry, o as defineMethodV2 } from "./registry-BIddXpin.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { Schema } from "effect";
|
|
3
4
|
import { assertFile, getDUrl } from "@open-wa/utils";
|
|
5
|
+
//#region src/effect-projection.ts
|
|
6
|
+
/** Project Effect contracts into the serving method and listener registry. */
|
|
7
|
+
function projectEffectSchema(schema) {
|
|
8
|
+
if ("fields" in schema) {
|
|
9
|
+
const fields = schema.fields;
|
|
10
|
+
const shape = Object.fromEntries(Object.entries(fields).map(([name, field]) => {
|
|
11
|
+
const optional = field.ast.context?.isOptional === true;
|
|
12
|
+
const hasUndefined = field.ast._tag === "Union" && field.ast.types.some((member) => member._tag === "Undefined");
|
|
13
|
+
const value = projectEffectSchema(!optional ? field : hasUndefined ? Schema.required(field) : Schema.requiredKey(field));
|
|
14
|
+
return [name, optional ? value.optional() : value];
|
|
15
|
+
}));
|
|
16
|
+
return z.object(shape);
|
|
17
|
+
}
|
|
18
|
+
const document = Schema.toJsonSchemaDocument(schema);
|
|
19
|
+
const project = (node) => {
|
|
20
|
+
if (node.$ref) {
|
|
21
|
+
const key = node.$ref.split("/").at(-1);
|
|
22
|
+
return project(document.definitions[key]);
|
|
23
|
+
}
|
|
24
|
+
if ("const" in node) return z.literal(node.const);
|
|
25
|
+
if (node.enum) return z.union(node.enum.map((value) => z.literal(value)));
|
|
26
|
+
const members = node.anyOf ?? node.oneOf;
|
|
27
|
+
if (members) return z.union(members.map(project));
|
|
28
|
+
switch (node.type) {
|
|
29
|
+
case "string": {
|
|
30
|
+
let value = z.string();
|
|
31
|
+
if (node.minLength !== void 0) value = value.min(node.minLength);
|
|
32
|
+
if (node.maxLength !== void 0) value = value.max(node.maxLength);
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
case "number":
|
|
36
|
+
case "integer": {
|
|
37
|
+
let value = node.type === "integer" ? z.number().int() : z.number();
|
|
38
|
+
if (node.minimum !== void 0) value = value.min(node.minimum);
|
|
39
|
+
if (node.maximum !== void 0) value = value.max(node.maximum);
|
|
40
|
+
if (node.exclusiveMinimum !== void 0) value = value.gt(node.exclusiveMinimum);
|
|
41
|
+
if (node.exclusiveMaximum !== void 0) value = value.lt(node.exclusiveMaximum);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
case "boolean": return z.boolean();
|
|
45
|
+
case "null": return z.null();
|
|
46
|
+
case "array": return z.array(project(node.items ?? {}));
|
|
47
|
+
case "object": {
|
|
48
|
+
const properties = node.properties ?? {};
|
|
49
|
+
const values = typeof node.additionalProperties === "object" ? project(node.additionalProperties) : node.additionalProperties ? z.unknown() : void 0;
|
|
50
|
+
if (!Object.keys(properties).length && values) return z.record(z.string(), values);
|
|
51
|
+
const required = new Set(node.required ?? []);
|
|
52
|
+
const object = z.object(Object.fromEntries(Object.entries(properties).map(([key, value]) => {
|
|
53
|
+
const field = project(value);
|
|
54
|
+
return [key, required.has(key) ? field : field.optional()];
|
|
55
|
+
})));
|
|
56
|
+
return values ? object.catchall(values) : object;
|
|
57
|
+
}
|
|
58
|
+
default: return z.unknown();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return project(document.schema);
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/whatsapp-events.ts
|
|
65
|
+
const id$1 = Schema.String.check(Schema.isMinLength(1));
|
|
66
|
+
const seconds = Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(2147483647));
|
|
67
|
+
const milliseconds = Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0));
|
|
68
|
+
/** Native WhatsApp event input. All event times are Unix seconds. */
|
|
69
|
+
const EventInputSchema = Schema.Struct({
|
|
70
|
+
name: Schema.String.check(Schema.isMinLength(1)),
|
|
71
|
+
startTime: seconds,
|
|
72
|
+
endTime: Schema.optional(seconds),
|
|
73
|
+
description: Schema.optional(Schema.String),
|
|
74
|
+
location: Schema.optional(Schema.String),
|
|
75
|
+
extraGuestsAllowed: Schema.optional(Schema.Boolean),
|
|
76
|
+
callType: Schema.optional(Schema.Literals(["voice", "video"])),
|
|
77
|
+
isScheduledCall: Schema.optional(Schema.Boolean),
|
|
78
|
+
requireApproval: Schema.optional(Schema.Boolean),
|
|
79
|
+
quotedMsgId: Schema.optional(id$1)
|
|
80
|
+
});
|
|
81
|
+
function validateEventInput(input) {
|
|
82
|
+
const event = Schema.decodeUnknownSync(EventInputSchema)(input);
|
|
83
|
+
if (!event.name.trim()) throw new Error("An event needs a name.");
|
|
84
|
+
if (event.endTime !== void 0 && event.endTime < event.startTime) throw new Error("Event endTime must be at or after startTime.");
|
|
85
|
+
if (event.isScheduledCall && !event.callType) throw new Error("A scheduled call needs a callType.");
|
|
86
|
+
return event;
|
|
87
|
+
}
|
|
88
|
+
const EventUpdateSchema = Schema.Struct({
|
|
89
|
+
name: Schema.optional(Schema.String.check(Schema.isMinLength(1))),
|
|
90
|
+
startTime: Schema.optional(seconds),
|
|
91
|
+
endTime: Schema.optional(Schema.NullOr(seconds)),
|
|
92
|
+
description: Schema.optional(Schema.String),
|
|
93
|
+
location: Schema.optional(Schema.String)
|
|
94
|
+
});
|
|
95
|
+
function validateEventUpdate(input) {
|
|
96
|
+
const changes = Schema.decodeUnknownSync(EventUpdateSchema)(input);
|
|
97
|
+
if (changes.name !== void 0 && !changes.name.trim()) throw new Error("An event needs a name.");
|
|
98
|
+
if (changes.startTime !== void 0 && changes.endTime != null && changes.endTime < changes.startTime) throw new Error("Event endTime must be at or after startTime.");
|
|
99
|
+
return changes;
|
|
100
|
+
}
|
|
101
|
+
/** A JSON-safe event snapshot. Message secrets and encrypted RSVP data stay private. */
|
|
102
|
+
const WhatsAppEventSchema = Schema.Struct({
|
|
103
|
+
id: id$1,
|
|
104
|
+
chatId: id$1,
|
|
105
|
+
creatorId: id$1,
|
|
106
|
+
name: Schema.String,
|
|
107
|
+
startTime: seconds,
|
|
108
|
+
endTime: Schema.optional(seconds),
|
|
109
|
+
description: Schema.optional(Schema.String),
|
|
110
|
+
location: Schema.optional(Schema.Struct({
|
|
111
|
+
name: Schema.optional(Schema.String),
|
|
112
|
+
latitude: Schema.optional(Schema.Number.check(Schema.isGreaterThanOrEqualTo(-90), Schema.isLessThanOrEqualTo(90))),
|
|
113
|
+
longitude: Schema.optional(Schema.Number.check(Schema.isGreaterThanOrEqualTo(-180), Schema.isLessThanOrEqualTo(180)))
|
|
114
|
+
})),
|
|
115
|
+
joinLink: Schema.optional(Schema.String),
|
|
116
|
+
isScheduledCall: Schema.optional(Schema.Boolean),
|
|
117
|
+
extraGuestsAllowed: Schema.optional(Schema.Boolean),
|
|
118
|
+
isCanceled: Schema.Boolean,
|
|
119
|
+
fromMe: Schema.Boolean,
|
|
120
|
+
timestamp: seconds
|
|
121
|
+
});
|
|
122
|
+
const EventResponseTypeSchema = Schema.Literals([
|
|
123
|
+
"going",
|
|
124
|
+
"notGoing",
|
|
125
|
+
"maybe",
|
|
126
|
+
"unknown"
|
|
127
|
+
]);
|
|
128
|
+
const EventResponseSchema = Schema.Struct({
|
|
129
|
+
id: id$1,
|
|
130
|
+
eventId: id$1,
|
|
131
|
+
chatId: id$1,
|
|
132
|
+
senderId: id$1,
|
|
133
|
+
response: EventResponseTypeSchema,
|
|
134
|
+
/** Sender's monotonically increasing RSVP timestamp, in milliseconds. */
|
|
135
|
+
timestamp: milliseconds,
|
|
136
|
+
fromMe: Schema.Boolean
|
|
137
|
+
});
|
|
138
|
+
const EventListOptionsSchema = Schema.Struct({
|
|
139
|
+
limit: Schema.optional(Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(100))),
|
|
140
|
+
before: Schema.optional(id$1)
|
|
141
|
+
});
|
|
142
|
+
const EventPageSchema = Schema.Struct({
|
|
143
|
+
events: Schema.Array(WhatsAppEventSchema),
|
|
144
|
+
nextCursor: Schema.NullOr(id$1)
|
|
145
|
+
});
|
|
146
|
+
const decodeWhatsAppEvent = Schema.decodeUnknownSync(WhatsAppEventSchema);
|
|
147
|
+
const decodeEventResponse = Schema.decodeUnknownSync(EventResponseSchema);
|
|
148
|
+
const serializeWhatsAppEvent = (event) => JSON.stringify(Schema.encodeSync(WhatsAppEventSchema)(event));
|
|
149
|
+
const deserializeWhatsAppEvent = (json) => decodeWhatsAppEvent(JSON.parse(json));
|
|
150
|
+
const serializeEventResponse = (response) => JSON.stringify(Schema.encodeSync(EventResponseSchema)(response));
|
|
151
|
+
const deserializeEventResponse = (json) => decodeEventResponse(JSON.parse(json));
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/whatsapp-event-registry.ts
|
|
154
|
+
const EventInputRegistrySchema = projectEffectSchema(EventInputSchema).superRefine((value, ctx) => {
|
|
155
|
+
try {
|
|
156
|
+
validateEventInput(value);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
ctx.addIssue({
|
|
159
|
+
code: "custom",
|
|
160
|
+
message: String(error)
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}).meta({ examples: [{
|
|
164
|
+
name: "Community meetup",
|
|
165
|
+
startTime: 1893456e3,
|
|
166
|
+
description: "Meet the community"
|
|
167
|
+
}] });
|
|
168
|
+
const EventUpdateRegistrySchema = projectEffectSchema(EventUpdateSchema).superRefine((value, ctx) => {
|
|
169
|
+
try {
|
|
170
|
+
validateEventUpdate(value);
|
|
171
|
+
} catch (error) {
|
|
172
|
+
ctx.addIssue({
|
|
173
|
+
code: "custom",
|
|
174
|
+
message: String(error)
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}).meta({ examples: [{ description: "Updated meetup details" }] });
|
|
178
|
+
const WhatsAppEventRegistrySchema = projectEffectSchema(WhatsAppEventSchema);
|
|
179
|
+
const EventResponseRegistrySchema = projectEffectSchema(EventResponseSchema);
|
|
180
|
+
const EventListOptionsRegistrySchema = projectEffectSchema(EventListOptionsSchema);
|
|
181
|
+
const EventPageRegistrySchema = projectEffectSchema(EventPageSchema);
|
|
182
|
+
//#endregion
|
|
4
183
|
//#region src/common-types.ts
|
|
5
184
|
const ContactIdSchema$1 = z.string().brand("ContactId").describe("Opaque WhatsApp contact identifier. Preserve the exact value returned by the API.");
|
|
6
185
|
const ChatIdSchema$1 = z.string().brand("ChatId").describe("Opaque conversation identifier. Use the exact value returned by a message event or chat lookup.");
|
|
@@ -40,6 +219,9 @@ let MessageTypes = /* @__PURE__ */ function(MessageTypes) {
|
|
|
40
219
|
MessageTypes["VOICE"] = "ptt";
|
|
41
220
|
MessageTypes["IMAGE"] = "image";
|
|
42
221
|
MessageTypes["VIDEO"] = "video";
|
|
222
|
+
MessageTypes["ALBUM"] = "album";
|
|
223
|
+
MessageTypes["EVENT_CREATION"] = "event_creation";
|
|
224
|
+
MessageTypes["EVENT_RESPONSE"] = "event_response";
|
|
43
225
|
MessageTypes["DOCUMENT"] = "document";
|
|
44
226
|
MessageTypes["STICKER"] = "sticker";
|
|
45
227
|
MessageTypes["LOCATION"] = "location";
|
|
@@ -65,6 +247,8 @@ let MessageAck = /* @__PURE__ */ function(MessageAck) {
|
|
|
65
247
|
* 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.
|
|
66
248
|
*/
|
|
67
249
|
let SimpleListener = /* @__PURE__ */ function(SimpleListener) {
|
|
250
|
+
SimpleListener["Event"] = "onEvent";
|
|
251
|
+
SimpleListener["EventResponse"] = "onEventResponse";
|
|
68
252
|
/**
|
|
69
253
|
* Represents [[onMessage]]
|
|
70
254
|
*/
|
|
@@ -165,6 +349,12 @@ const MessageSchemaBase = z.object({
|
|
|
165
349
|
labels: z.array(z.string()).optional(),
|
|
166
350
|
mentionedJidList: z.array(ContactIdSchema$1).optional(),
|
|
167
351
|
caption: z.string().optional(),
|
|
352
|
+
event: WhatsAppEventRegistrySchema.optional(),
|
|
353
|
+
expectedImageCount: z.number().int().nonnegative().nullable().optional().describe("Number of image messages declared by an album container; not a received-media count."),
|
|
354
|
+
expectedVideoCount: z.number().int().nonnegative().nullable().optional().describe("Number of video messages declared by an album container, including GIF videos."),
|
|
355
|
+
parentMsgKey: MessageIdSchema$1.nullable().optional().describe("Serialized parent message ID for associated media."),
|
|
356
|
+
associationType: z.string().nullable().optional().describe("WhatsApp association type. Album media uses MEDIA_ALBUM."),
|
|
357
|
+
isGif: z.boolean().optional(),
|
|
168
358
|
sender: z.any(),
|
|
169
359
|
timestamp: z.number(),
|
|
170
360
|
content: z.string(),
|
|
@@ -434,6 +624,117 @@ const StorySchema = MessageSchema.omit({
|
|
|
434
624
|
sender: ContactSchema.nullable().optional()
|
|
435
625
|
}).describe("Message-shaped status entry, based on the legacy story API. Chat and sender may be absent or null. The licensed getStories payload has not been verified against this model.");
|
|
436
626
|
//#endregion
|
|
627
|
+
//#region src/media-options.ts
|
|
628
|
+
const quote = { quotedMsgId: MessageIdSchema$1.optional().describe("A message in the destination chat to quote") };
|
|
629
|
+
const caption = { caption: z.string().optional().describe("Caption for the attachment") };
|
|
630
|
+
const viewOnce = { viewOnce: z.boolean().optional().describe("Use WhatsApp view-once media") };
|
|
631
|
+
const ImageSendOptionsSchema = z.strictObject({
|
|
632
|
+
type: z.literal("image"),
|
|
633
|
+
...caption,
|
|
634
|
+
...quote,
|
|
635
|
+
...viewOnce
|
|
636
|
+
});
|
|
637
|
+
const VideoSendOptionsSchema = z.strictObject({
|
|
638
|
+
type: z.literal("video"),
|
|
639
|
+
...caption,
|
|
640
|
+
...quote,
|
|
641
|
+
...viewOnce,
|
|
642
|
+
isGif: z.boolean().optional().describe("Loop an MP4 as a WhatsApp GIF"),
|
|
643
|
+
videoNote: z.boolean().optional().describe("Send a square MP4, at most 60 seconds, as a circular video note (PTV)")
|
|
644
|
+
}).superRefine((options, ctx) => {
|
|
645
|
+
if (options.videoNote && options.isGif) ctx.addIssue({
|
|
646
|
+
code: "custom",
|
|
647
|
+
path: ["isGif"],
|
|
648
|
+
message: "A video note cannot also be a GIF"
|
|
649
|
+
});
|
|
650
|
+
if (options.isGif && options.viewOnce) ctx.addIssue({
|
|
651
|
+
code: "custom",
|
|
652
|
+
path: ["viewOnce"],
|
|
653
|
+
message: "A GIF cannot be view once"
|
|
654
|
+
});
|
|
655
|
+
if (options.videoNote && options.caption) ctx.addIssue({
|
|
656
|
+
code: "custom",
|
|
657
|
+
path: ["caption"],
|
|
658
|
+
message: "Video notes do not support captions"
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
const AudioSendOptionsSchema = z.strictObject({
|
|
662
|
+
type: z.literal("audio"),
|
|
663
|
+
...quote,
|
|
664
|
+
...viewOnce,
|
|
665
|
+
ptt: z.boolean().optional().describe("Send audio as a voice note; does not transcode it")
|
|
666
|
+
}).refine((options) => !options.viewOnce || options.ptt === true, {
|
|
667
|
+
path: ["viewOnce"],
|
|
668
|
+
message: "View-once audio must be a voice note (ptt: true)"
|
|
669
|
+
});
|
|
670
|
+
const DocumentSendOptionsSchema = z.strictObject({
|
|
671
|
+
type: z.literal("document"),
|
|
672
|
+
...caption,
|
|
673
|
+
...quote
|
|
674
|
+
}).describe("Force document presentation, even for an image, video or audio file");
|
|
675
|
+
const AutoMediaSendOptionsSchema = z.strictObject({
|
|
676
|
+
type: z.literal("auto").optional(),
|
|
677
|
+
...caption,
|
|
678
|
+
...quote,
|
|
679
|
+
...viewOnce
|
|
680
|
+
}).describe("Detect presentation from the file MIME type; view once requires an image or video");
|
|
681
|
+
const MediaSendOptionsSchema = z.discriminatedUnion("type", [
|
|
682
|
+
AutoMediaSendOptionsSchema,
|
|
683
|
+
ImageSendOptionsSchema,
|
|
684
|
+
VideoSendOptionsSchema,
|
|
685
|
+
AudioSendOptionsSchema,
|
|
686
|
+
DocumentSendOptionsSchema
|
|
687
|
+
]);
|
|
688
|
+
const AudioAttachmentOptionsSchema = z.strictObject({ ...quote });
|
|
689
|
+
const VoiceNoteOptionsSchema = z.strictObject({
|
|
690
|
+
...quote,
|
|
691
|
+
...viewOnce
|
|
692
|
+
});
|
|
693
|
+
const GifSendOptionsSchema = z.strictObject({
|
|
694
|
+
...caption,
|
|
695
|
+
...quote
|
|
696
|
+
});
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/polls.ts
|
|
699
|
+
const PollSendOptionsSchema = z.strictObject({
|
|
700
|
+
selectableCount: z.number().int().min(0).optional().describe("Selection limit; default 1, zero allows all options"),
|
|
701
|
+
quotedMsgId: MessageIdSchema$1.optional(),
|
|
702
|
+
endTime: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional().describe("Closing time as Unix milliseconds; must be in the future"),
|
|
703
|
+
hideVoterNames: z.boolean().optional().describe("Hide voter names in WhatsApp; not a cryptographic anonymity guarantee")
|
|
704
|
+
});
|
|
705
|
+
const PollVoteSchema = z.strictObject({
|
|
706
|
+
pollId: MessageIdSchema$1,
|
|
707
|
+
chatId: ChatIdSchema$1,
|
|
708
|
+
id: MessageIdSchema$1.optional().describe("Omitted when the poll hides voter names"),
|
|
709
|
+
senderId: ContactIdSchema$1.optional().describe("Omitted when the poll hides voter names"),
|
|
710
|
+
selectedOptionIds: z.array(z.number().int().nonnegative()),
|
|
711
|
+
timestamp: z.number().int().nonnegative().describe("Native vote timestamp in Unix milliseconds"),
|
|
712
|
+
fromMe: z.boolean(),
|
|
713
|
+
hideVoterNames: z.boolean()
|
|
714
|
+
});
|
|
715
|
+
const PollResultsSchema = z.strictObject({
|
|
716
|
+
pollId: MessageIdSchema$1,
|
|
717
|
+
chatId: ChatIdSchema$1,
|
|
718
|
+
name: z.string(),
|
|
719
|
+
selectableCount: z.number().int().nonnegative(),
|
|
720
|
+
endTime: z.number().int().nonnegative().optional(),
|
|
721
|
+
isClosed: z.boolean(),
|
|
722
|
+
hideVoterNames: z.boolean(),
|
|
723
|
+
options: z.array(z.strictObject({
|
|
724
|
+
id: z.number().int().nonnegative(),
|
|
725
|
+
name: z.string(),
|
|
726
|
+
count: z.number().int().nonnegative()
|
|
727
|
+
})),
|
|
728
|
+
voterCount: z.number().int().nonnegative(),
|
|
729
|
+
votes: z.array(PollVoteSchema).optional().describe("Omitted for hidden-voter polls"),
|
|
730
|
+
scope: z.literal("synced").describe("Hydrated local WhatsApp data, which may not include unsynced votes")
|
|
731
|
+
});
|
|
732
|
+
const PinDurationSchema = z.enum([
|
|
733
|
+
"OneDay",
|
|
734
|
+
"SevenDays",
|
|
735
|
+
"ThirtyDays"
|
|
736
|
+
]);
|
|
737
|
+
//#endregion
|
|
437
738
|
//#region src/codecs.ts
|
|
438
739
|
const chatIdPattern = /^\d+(-\d+)?@(c|g)\.us$|^\d+@lid$/;
|
|
439
740
|
const contactIdPattern = /^\d+@c\.us$/;
|
|
@@ -655,6 +956,84 @@ const messageOptionsParam = z.unknown().optional().describe("Reserved for compat
|
|
|
655
956
|
//#region src/methods/messaging.ts
|
|
656
957
|
/** The normalized serialized message key returned by the public sendText client. */
|
|
657
958
|
const SendTextResultSchema = z.string().regex(/^(true|false)_[^\s_]+@[^\s_]+_[^\s]+$/).brand("MessageId").describe("Validated serialized message ID. This confirms the send returned an ID, not delivery or reading.");
|
|
959
|
+
const StickerJobSchema = z.object({
|
|
960
|
+
effects: z.array(z.union([z.string(), z.object({
|
|
961
|
+
name: z.string(),
|
|
962
|
+
options: z.record(z.string(), z.unknown()).optional()
|
|
963
|
+
}).strict()])).max(8).optional(),
|
|
964
|
+
backend: z.enum([
|
|
965
|
+
"auto",
|
|
966
|
+
"browser",
|
|
967
|
+
"standalone"
|
|
968
|
+
]).optional().describe("Defaults to browser when it supports the entire job; otherwise the entire job runs standalone."),
|
|
969
|
+
quality: z.number().min(.01).max(1).optional().describe("Maximum encoding quality; encoding can reduce quality to meet sticker byte limits."),
|
|
970
|
+
fit: z.enum(["contain", "cover"]).optional(),
|
|
971
|
+
circle: z.boolean().optional(),
|
|
972
|
+
background: z.string().max(64).optional(),
|
|
973
|
+
trim: z.tuple([z.number().nonnegative(), z.number().positive()]).refine(([start, end]) => end > start).optional(),
|
|
974
|
+
fps: z.number().int().min(1).max(30).optional(),
|
|
975
|
+
loopCount: z.number().int().min(0).max(65535).optional(),
|
|
976
|
+
author: z.string().max(128).optional(),
|
|
977
|
+
pack: z.string().max(128).optional(),
|
|
978
|
+
quotedMsgId: messageIdParam.optional().describe("Reply with the sticker to a loaded message in the destination chat.")
|
|
979
|
+
}).strict();
|
|
980
|
+
const sendSticker = defineMethodV2("sendSticker", {
|
|
981
|
+
meta: {
|
|
982
|
+
description: "Render a sticker locally using automatic whole-job backend selection and ordered effects, then submit through the private donor finalizer. Author and pack labels are configurable; donor app links are owned by the installed patch. Returns a submitted message ID, not a delivery receipt. Unknown send outcomes must be reconciled before retrying.",
|
|
983
|
+
action: "send",
|
|
984
|
+
namespace: "messages",
|
|
985
|
+
license: "none",
|
|
986
|
+
functionality: "both",
|
|
987
|
+
httpMethod: "POST",
|
|
988
|
+
wapiOverride: "sendStickerJob"
|
|
989
|
+
},
|
|
990
|
+
input: z.object({
|
|
991
|
+
to: toParam,
|
|
992
|
+
input: z.string().regex(/^(?:data:(?:image|video)\/[^;,]+;base64,[A-Za-z0-9+/]+={0,2}|https?:\/\/\S+)$/).describe("A media data URL or HTTP(S) URL. The local library additionally accepts bytes, Blob and local filenames."),
|
|
993
|
+
job: StickerJobSchema.optional()
|
|
994
|
+
}),
|
|
995
|
+
parameterOrder: [
|
|
996
|
+
"to",
|
|
997
|
+
"input",
|
|
998
|
+
"job"
|
|
999
|
+
],
|
|
1000
|
+
output: SendTextResultSchema
|
|
1001
|
+
});
|
|
1002
|
+
const AlbumMediaSchema = z.object({
|
|
1003
|
+
file: z.string().regex(/^data:(image|video)\/[^;,]+;base64,[A-Za-z0-9+/]+={0,2}$/).describe("Image or video as a base64 data URL. For a WhatsApp GIF, supply an MP4 video and set isGif to true."),
|
|
1004
|
+
filename: z.string().min(1).describe("Filename including its extension"),
|
|
1005
|
+
isGif: z.boolean().optional().describe("Send an MP4 video as a looping WhatsApp GIF")
|
|
1006
|
+
}).refine((media) => !media.isGif || media.file.startsWith("data:video/mp4;base64,"), {
|
|
1007
|
+
message: "GIF album items require MP4 video data",
|
|
1008
|
+
path: ["file"]
|
|
1009
|
+
});
|
|
1010
|
+
const AlbumSendResultSchema = z.object({
|
|
1011
|
+
albumId: MessageIdSchema$1,
|
|
1012
|
+
messageIds: z.array(MessageIdSchema$1).min(2)
|
|
1013
|
+
}).describe("Submitted album parent and child message IDs, in input order. Submission does not confirm recipient delivery. Runtime failures include the album ID and submitted child IDs when available. A lost connection can leave the send outcome unknown; inspect the chat before retrying.");
|
|
1014
|
+
const sendAlbum = defineMethodV2("sendAlbum", {
|
|
1015
|
+
meta: {
|
|
1016
|
+
description: "Sends images and videos together as a native WhatsApp album with one caption on its first item. GIFs use MP4 video data with isGif: true. Documents are rejected. Phone-number IDs are resolved to LIDs; the destination chat must already be loaded and allow sending. WhatsApp controls the minimum item count and upload limits. Runtime failures include the parent and submitted child IDs when available; inspect the chat before retrying.",
|
|
1017
|
+
action: "send",
|
|
1018
|
+
namespace: "messages",
|
|
1019
|
+
license: "none",
|
|
1020
|
+
functionality: "both",
|
|
1021
|
+
httpMethod: "POST"
|
|
1022
|
+
},
|
|
1023
|
+
input: z.object({
|
|
1024
|
+
to: toParam,
|
|
1025
|
+
media: z.array(AlbumMediaSchema).min(2).describe("Album items in send order"),
|
|
1026
|
+
caption: captionParam.optional().default(""),
|
|
1027
|
+
quotedMsgId: messageIdParam.optional().describe("Message to quote on the first album item")
|
|
1028
|
+
}),
|
|
1029
|
+
parameterOrder: [
|
|
1030
|
+
"to",
|
|
1031
|
+
"media",
|
|
1032
|
+
"caption",
|
|
1033
|
+
"quotedMsgId"
|
|
1034
|
+
],
|
|
1035
|
+
output: AlbumSendResultSchema
|
|
1036
|
+
});
|
|
658
1037
|
/**
|
|
659
1038
|
* Sends a text message to a chat
|
|
660
1039
|
*/
|
|
@@ -764,7 +1143,7 @@ const sendPaymentRequest = defineMethodV2("sendPaymentRequest", {
|
|
|
764
1143
|
*/
|
|
765
1144
|
const sendImage = defineMethodV2("sendImage", {
|
|
766
1145
|
meta: {
|
|
767
|
-
description: "Sends
|
|
1146
|
+
description: "Sends media through the native attachment pipeline, including images and videos. Options select presentation, view once, GIF playback or circular video notes; media is not transcoded. Returns submission status, not a delivery receipt.",
|
|
768
1147
|
action: "send",
|
|
769
1148
|
namespace: "messages",
|
|
770
1149
|
license: "none",
|
|
@@ -773,28 +1152,24 @@ const sendImage = defineMethodV2("sendImage", {
|
|
|
773
1152
|
},
|
|
774
1153
|
input: z.object({
|
|
775
1154
|
to: toParam,
|
|
776
|
-
|
|
777
|
-
filename: filenameParam,
|
|
778
|
-
|
|
779
|
-
id: messageIdParam.optional(),
|
|
780
|
-
waitForId: waitForIdParam
|
|
1155
|
+
file: fileDataParam,
|
|
1156
|
+
filename: filenameParam.optional(),
|
|
1157
|
+
options: MediaSendOptionsSchema.optional().default({})
|
|
781
1158
|
}),
|
|
782
1159
|
parameterOrder: [
|
|
783
1160
|
"to",
|
|
784
|
-
"
|
|
1161
|
+
"file",
|
|
785
1162
|
"filename",
|
|
786
|
-
"
|
|
787
|
-
"id",
|
|
788
|
-
"waitForId"
|
|
1163
|
+
"options"
|
|
789
1164
|
],
|
|
790
|
-
output: MessageIdReturnSchema.or(z.boolean())
|
|
1165
|
+
output: MessageIdReturnSchema.or(z.boolean())
|
|
791
1166
|
});
|
|
792
1167
|
/**
|
|
793
1168
|
* Sends a file/document
|
|
794
1169
|
*/
|
|
795
1170
|
const sendFile = defineMethodV2("sendFile", {
|
|
796
1171
|
meta: {
|
|
797
|
-
description: "Sends
|
|
1172
|
+
description: "Sends an image, video, audio file or document using MIME detection or an explicit typed presentation. Incompatible options are rejected before sending. Media is not transcoded.",
|
|
798
1173
|
action: "send",
|
|
799
1174
|
namespace: "messages",
|
|
800
1175
|
license: "none",
|
|
@@ -804,23 +1179,23 @@ const sendFile = defineMethodV2("sendFile", {
|
|
|
804
1179
|
input: z.object({
|
|
805
1180
|
to: toParam,
|
|
806
1181
|
file: fileDataParam,
|
|
807
|
-
filename: filenameParam,
|
|
808
|
-
|
|
1182
|
+
filename: filenameParam.optional(),
|
|
1183
|
+
options: MediaSendOptionsSchema.optional().default({})
|
|
809
1184
|
}),
|
|
810
1185
|
parameterOrder: [
|
|
811
1186
|
"to",
|
|
812
1187
|
"file",
|
|
813
1188
|
"filename",
|
|
814
|
-
"
|
|
1189
|
+
"options"
|
|
815
1190
|
],
|
|
816
|
-
output: MessageIdReturnSchema.or(z.
|
|
1191
|
+
output: MessageIdReturnSchema.or(z.boolean())
|
|
817
1192
|
});
|
|
818
1193
|
/**
|
|
819
1194
|
* Sends an audio file
|
|
820
1195
|
*/
|
|
821
1196
|
const sendAudio = defineMethodV2("sendAudio", {
|
|
822
1197
|
meta: {
|
|
823
|
-
description: "Sends an audio
|
|
1198
|
+
description: "Sends an audio attachment with an optional quoted message. Use sendPtt for voice notes and view-once audio.",
|
|
824
1199
|
action: "send",
|
|
825
1200
|
namespace: "messages",
|
|
826
1201
|
license: "none",
|
|
@@ -830,14 +1205,14 @@ const sendAudio = defineMethodV2("sendAudio", {
|
|
|
830
1205
|
input: z.object({
|
|
831
1206
|
to: toParam,
|
|
832
1207
|
file: audioDataParam,
|
|
833
|
-
filename: filenameParam,
|
|
834
|
-
|
|
1208
|
+
filename: filenameParam.optional(),
|
|
1209
|
+
options: AudioAttachmentOptionsSchema.optional().default({})
|
|
835
1210
|
}),
|
|
836
1211
|
parameterOrder: [
|
|
837
1212
|
"to",
|
|
838
1213
|
"file",
|
|
839
1214
|
"filename",
|
|
840
|
-
"
|
|
1215
|
+
"options"
|
|
841
1216
|
],
|
|
842
1217
|
output: MessageIdReturnSchema.or(z.boolean())
|
|
843
1218
|
});
|
|
@@ -846,7 +1221,7 @@ const sendAudio = defineMethodV2("sendAudio", {
|
|
|
846
1221
|
*/
|
|
847
1222
|
const sendPtt = defineMethodV2("sendPtt", {
|
|
848
1223
|
meta: {
|
|
849
|
-
description: "Sends a voice note
|
|
1224
|
+
description: "Sends prepared audio as a voice note, optionally view once. It does not transcode the input; use suitable voice-note audio such as Ogg Opus.",
|
|
850
1225
|
action: "send",
|
|
851
1226
|
namespace: "messages",
|
|
852
1227
|
license: "none",
|
|
@@ -857,12 +1232,12 @@ const sendPtt = defineMethodV2("sendPtt", {
|
|
|
857
1232
|
input: z.object({
|
|
858
1233
|
to: toParam,
|
|
859
1234
|
file: audioDataParam,
|
|
860
|
-
|
|
1235
|
+
options: VoiceNoteOptionsSchema.optional().default({})
|
|
861
1236
|
}),
|
|
862
1237
|
parameterOrder: [
|
|
863
1238
|
"to",
|
|
864
1239
|
"file",
|
|
865
|
-
"
|
|
1240
|
+
"options"
|
|
866
1241
|
],
|
|
867
1242
|
output: MessageIdReturnSchema.or(z.boolean())
|
|
868
1243
|
});
|
|
@@ -871,7 +1246,7 @@ const sendPtt = defineMethodV2("sendPtt", {
|
|
|
871
1246
|
*/
|
|
872
1247
|
const sendVideoAsGif = defineMethodV2("sendVideoAsGif", {
|
|
873
1248
|
meta: {
|
|
874
|
-
description: "Sends a video
|
|
1249
|
+
description: "Sends MP4 video with WhatsApp GIF playback. GIF is a video presentation flag; this method does not convert a GIF image or transcode video.",
|
|
875
1250
|
action: "send",
|
|
876
1251
|
namespace: "messages",
|
|
877
1252
|
license: "none",
|
|
@@ -881,16 +1256,14 @@ const sendVideoAsGif = defineMethodV2("sendVideoAsGif", {
|
|
|
881
1256
|
input: z.object({
|
|
882
1257
|
to: toParam,
|
|
883
1258
|
file: videoDataParam,
|
|
884
|
-
filename: filenameParam,
|
|
885
|
-
|
|
886
|
-
quotedMsgId: messageIdParam.optional()
|
|
1259
|
+
filename: filenameParam.optional(),
|
|
1260
|
+
options: GifSendOptionsSchema.optional().default({})
|
|
887
1261
|
}),
|
|
888
1262
|
parameterOrder: [
|
|
889
1263
|
"to",
|
|
890
1264
|
"file",
|
|
891
1265
|
"filename",
|
|
892
|
-
"
|
|
893
|
-
"quotedMsgId"
|
|
1266
|
+
"options"
|
|
894
1267
|
],
|
|
895
1268
|
output: MessageIdReturnSchema.or(z.boolean())
|
|
896
1269
|
});
|
|
@@ -948,7 +1321,7 @@ const sendVCard = defineMethodV2("sendVCard", {
|
|
|
948
1321
|
"contactName",
|
|
949
1322
|
"contactNumber"
|
|
950
1323
|
],
|
|
951
|
-
output: z.boolean()
|
|
1324
|
+
output: MessageIdReturnSchema.or(z.boolean())
|
|
952
1325
|
});
|
|
953
1326
|
/**
|
|
954
1327
|
* Sends a contact
|
|
@@ -967,7 +1340,7 @@ const sendContact = defineMethodV2("sendContact", {
|
|
|
967
1340
|
contactId: contactIdParam.or(z.array(contactIdParam))
|
|
968
1341
|
}),
|
|
969
1342
|
parameterOrder: ["to", "contactId"],
|
|
970
|
-
output: MessageIdReturnSchema.or(z.boolean()).or(z.
|
|
1343
|
+
output: MessageIdReturnSchema.or(z.boolean()).or(z.array(MessageIdReturnSchema.or(z.boolean())))
|
|
971
1344
|
});
|
|
972
1345
|
/**
|
|
973
1346
|
* Sends multiple contacts
|
|
@@ -987,7 +1360,7 @@ const sendMultipleContacts = defineMethodV2("sendMultipleContacts", {
|
|
|
987
1360
|
},
|
|
988
1361
|
input: z.object({
|
|
989
1362
|
to: toParam,
|
|
990
|
-
contactIds: z.array(contactIdParam)
|
|
1363
|
+
contactIds: z.array(contactIdParam).min(1)
|
|
991
1364
|
}),
|
|
992
1365
|
parameterOrder: ["to", "contactIds"],
|
|
993
1366
|
output: MessageIdReturnSchema.or(z.boolean())
|
|
@@ -1084,7 +1457,7 @@ const sendListMessage = defineMethodV2("sendListMessage", {
|
|
|
1084
1457
|
*/
|
|
1085
1458
|
const sendPoll = defineMethodV2("sendPoll", {
|
|
1086
1459
|
meta: {
|
|
1087
|
-
description: "Sends a poll
|
|
1460
|
+
description: "Sends a text poll with a selection limit, quote, optional closing time in Unix milliseconds and hidden voter names. Closing time and hidden names require native WhatsApp support for the sending account/chat. These fields select the native V6 poll payload.",
|
|
1088
1461
|
action: "send",
|
|
1089
1462
|
namespace: "messages",
|
|
1090
1463
|
license: "none",
|
|
@@ -1093,18 +1466,85 @@ const sendPoll = defineMethodV2("sendPoll", {
|
|
|
1093
1466
|
},
|
|
1094
1467
|
input: z.object({
|
|
1095
1468
|
to: toParam,
|
|
1096
|
-
name: z.string().describe("Poll question"),
|
|
1097
|
-
options: z.array(z.string()).min(2).max(
|
|
1098
|
-
|
|
1469
|
+
name: z.string().trim().min(1).max(500).describe("Poll question"),
|
|
1470
|
+
options: z.array(z.string().trim().min(1).max(255)).min(2).max(20).describe("Poll choices; the account may have a lower native limit"),
|
|
1471
|
+
config: PollSendOptionsSchema.optional().default({})
|
|
1472
|
+
}).refine((input) => (input.config.selectableCount ?? 1) <= input.options.length, {
|
|
1473
|
+
path: ["config", "selectableCount"],
|
|
1474
|
+
message: "Selection limit cannot exceed the number of poll options"
|
|
1475
|
+
}).refine((input) => new Set(input.options).size === input.options.length, {
|
|
1476
|
+
path: ["options"],
|
|
1477
|
+
message: "Poll choices must be unique"
|
|
1099
1478
|
}),
|
|
1100
1479
|
parameterOrder: [
|
|
1101
1480
|
"to",
|
|
1102
1481
|
"name",
|
|
1103
1482
|
"options",
|
|
1104
|
-
"
|
|
1483
|
+
"config"
|
|
1105
1484
|
],
|
|
1106
1485
|
output: MessageIdReturnSchema.or(z.boolean())
|
|
1107
1486
|
});
|
|
1487
|
+
const voteOnPoll = defineMethodV2("voteOnPoll", {
|
|
1488
|
+
meta: {
|
|
1489
|
+
description: "Votes using option IDs returned by getPollResults; an empty array removes the current vote. The poll must be open and allow this account to vote.",
|
|
1490
|
+
action: "send",
|
|
1491
|
+
namespace: "messages",
|
|
1492
|
+
license: "none",
|
|
1493
|
+
functionality: "both",
|
|
1494
|
+
httpMethod: "POST"
|
|
1495
|
+
},
|
|
1496
|
+
input: z.object({
|
|
1497
|
+
messageId: messageIdParam,
|
|
1498
|
+
optionIds: z.array(z.number().int().nonnegative()).max(20)
|
|
1499
|
+
}).refine((input) => new Set(input.optionIds).size === input.optionIds.length, {
|
|
1500
|
+
path: ["optionIds"],
|
|
1501
|
+
message: "Duplicate poll choices are not allowed"
|
|
1502
|
+
}),
|
|
1503
|
+
parameterOrder: ["messageId", "optionIds"],
|
|
1504
|
+
output: z.boolean()
|
|
1505
|
+
});
|
|
1506
|
+
const getPollResults = defineMethodV2("getPollResults", {
|
|
1507
|
+
meta: {
|
|
1508
|
+
description: "Hydrates the local poll vote store and returns synced counts, choices and votes. Hidden-voter polls omit voter identities and the votes array. Unsynced votes may be absent.",
|
|
1509
|
+
action: "get",
|
|
1510
|
+
namespace: "messages",
|
|
1511
|
+
license: "none",
|
|
1512
|
+
functionality: "both",
|
|
1513
|
+
httpMethod: "POST"
|
|
1514
|
+
},
|
|
1515
|
+
input: z.object({ messageId: messageIdParam }),
|
|
1516
|
+
parameterOrder: ["messageId"],
|
|
1517
|
+
output: PollResultsSchema
|
|
1518
|
+
});
|
|
1519
|
+
const pinMessage = defineMethodV2("pinMessage", {
|
|
1520
|
+
meta: {
|
|
1521
|
+
description: "Pins a message in its chat for everyone, subject to native permissions. This differs from pinChat, which changes the current account chat list.",
|
|
1522
|
+
action: "set",
|
|
1523
|
+
namespace: "messages",
|
|
1524
|
+
license: "none",
|
|
1525
|
+
functionality: "both",
|
|
1526
|
+
httpMethod: "POST"
|
|
1527
|
+
},
|
|
1528
|
+
input: z.object({
|
|
1529
|
+
messageId: messageIdParam,
|
|
1530
|
+
duration: PinDurationSchema.optional().default("SevenDays")
|
|
1531
|
+
}),
|
|
1532
|
+
parameterOrder: ["messageId", "duration"],
|
|
1533
|
+
output: z.boolean()
|
|
1534
|
+
});
|
|
1535
|
+
const unpinMessage = defineMethodV2("unpinMessage", {
|
|
1536
|
+
meta: {
|
|
1537
|
+
description: "Removes a message pin for everyone, subject to native chat permissions.",
|
|
1538
|
+
action: "set",
|
|
1539
|
+
namespace: "messages",
|
|
1540
|
+
license: "none",
|
|
1541
|
+
functionality: "both",
|
|
1542
|
+
httpMethod: "POST"
|
|
1543
|
+
},
|
|
1544
|
+
input: z.object({ messageId: messageIdParam }),
|
|
1545
|
+
parameterOrder: ["messageId"],
|
|
1546
|
+
output: z.boolean()
|
|
1547
|
+
});
|
|
1108
1548
|
/**
|
|
1109
1549
|
* Sends a banner image
|
|
1110
1550
|
*/
|
|
@@ -1304,6 +1744,19 @@ const getMessageById = defineMethodV2("getMessageById", {
|
|
|
1304
1744
|
parameterOrder: ["messageId"],
|
|
1305
1745
|
output: MessageSchema.nullable().or(z.literal(false))
|
|
1306
1746
|
});
|
|
1747
|
+
const getAlbumMessages = defineMethodV2("getAlbumMessages", {
|
|
1748
|
+
meta: {
|
|
1749
|
+
description: "Returns currently loaded image and video messages associated with an album, including GIF videos. The album can arrive before its media, so the array may be incomplete. Returns false if the album is not loaded or the ID belongs to another message type.",
|
|
1750
|
+
action: "read",
|
|
1751
|
+
namespace: "messages",
|
|
1752
|
+
license: "none",
|
|
1753
|
+
functionality: "both",
|
|
1754
|
+
httpMethod: "GET"
|
|
1755
|
+
},
|
|
1756
|
+
input: z.object({ messageId: messageIdParam.describe("Album container message ID") }),
|
|
1757
|
+
parameterOrder: ["messageId"],
|
|
1758
|
+
output: z.array(MessageSchema).or(z.literal(false)).describe("A snapshot of currently loaded album media. An empty or partial array does not mean that the sender sent an empty or partial album. Each item retains its caption and can be passed to decryptMedia or downloadMedia.")
|
|
1759
|
+
});
|
|
1307
1760
|
/**
|
|
1308
1761
|
* Retrieves all messages in the session
|
|
1309
1762
|
*/
|
|
@@ -1437,6 +1890,22 @@ const unstarMessage = defineMethodV2("unstarMessage", {
|
|
|
1437
1890
|
parameterOrder: ["messageId"],
|
|
1438
1891
|
output: z.boolean()
|
|
1439
1892
|
});
|
|
1893
|
+
const editMessage = defineMethodV2("editMessage", {
|
|
1894
|
+
meta: {
|
|
1895
|
+
description: "Edits the text of a message through the installed private patch",
|
|
1896
|
+
action: "update",
|
|
1897
|
+
namespace: "messages",
|
|
1898
|
+
license: "none",
|
|
1899
|
+
functionality: "both",
|
|
1900
|
+
httpMethod: "PUT"
|
|
1901
|
+
},
|
|
1902
|
+
input: z.object({
|
|
1903
|
+
messageId: messageIdParam,
|
|
1904
|
+
newContent: z.string().describe("Replacement message text")
|
|
1905
|
+
}),
|
|
1906
|
+
parameterOrder: ["messageId", "newContent"],
|
|
1907
|
+
output: z.boolean()
|
|
1908
|
+
});
|
|
1440
1909
|
const react = defineMethodV2("react", {
|
|
1441
1910
|
meta: {
|
|
1442
1911
|
description: "React to message with emoji",
|
|
@@ -1493,7 +1962,7 @@ const loadEarlierMessages = defineMethodV2("loadEarlierMessages", {
|
|
|
1493
1962
|
});
|
|
1494
1963
|
const sendFileFromUrl = defineMethodV2("sendFileFromUrl", {
|
|
1495
1964
|
meta: {
|
|
1496
|
-
description: "Downloads
|
|
1965
|
+
description: "Downloads media and sends it through sendFile with the same typed presentation options.",
|
|
1497
1966
|
action: "send",
|
|
1498
1967
|
namespace: "messages",
|
|
1499
1968
|
license: "none",
|
|
@@ -1503,18 +1972,18 @@ const sendFileFromUrl = defineMethodV2("sendFileFromUrl", {
|
|
|
1503
1972
|
input: z.object({
|
|
1504
1973
|
to: toParam,
|
|
1505
1974
|
url: z.string().url().describe("URL of the file to download"),
|
|
1506
|
-
filename:
|
|
1507
|
-
|
|
1975
|
+
filename: filenameParam.optional(),
|
|
1976
|
+
options: MediaSendOptionsSchema.optional().default({}),
|
|
1508
1977
|
headers: z.record(z.string(), z.string()).optional().describe("HTTP headers for the download request")
|
|
1509
1978
|
}),
|
|
1510
1979
|
parameterOrder: [
|
|
1511
1980
|
"to",
|
|
1512
1981
|
"url",
|
|
1513
1982
|
"filename",
|
|
1514
|
-
"
|
|
1983
|
+
"options",
|
|
1515
1984
|
"headers"
|
|
1516
1985
|
],
|
|
1517
|
-
output: z.string().or(z.boolean()).describe("Message ID or success status")
|
|
1986
|
+
output: MessageIdReturnSchema.or(z.string()).or(z.boolean()).describe("Message ID or success status")
|
|
1518
1987
|
});
|
|
1519
1988
|
//#endregion
|
|
1520
1989
|
//#region src/methods/chats.ts
|
|
@@ -1746,6 +2215,32 @@ const isChatOnline = defineMethodV2("isChatOnline", {
|
|
|
1746
2215
|
});
|
|
1747
2216
|
//#endregion
|
|
1748
2217
|
//#region src/methods/contacts.ts
|
|
2218
|
+
const requestPhoneNumber = defineMethodV2("requestPhoneNumber", {
|
|
2219
|
+
meta: {
|
|
2220
|
+
description: "Ask a direct LID chat to voluntarily share their phone number. A submitted request does not confirm sharing.",
|
|
2221
|
+
action: "send",
|
|
2222
|
+
namespace: "contacts",
|
|
2223
|
+
license: "none",
|
|
2224
|
+
functionality: "both",
|
|
2225
|
+
httpMethod: "POST"
|
|
2226
|
+
},
|
|
2227
|
+
input: z.object({ to: toParam }),
|
|
2228
|
+
parameterOrder: ["to"],
|
|
2229
|
+
output: messageIdParam
|
|
2230
|
+
});
|
|
2231
|
+
const sharePhoneNumber = defineMethodV2("sharePhoneNumber", {
|
|
2232
|
+
meta: {
|
|
2233
|
+
description: "Share the signed-in account’s own phone number with a direct LID chat using WhatsApp’s native protocol. No arbitrary phone number is accepted.",
|
|
2234
|
+
action: "send",
|
|
2235
|
+
namespace: "contacts",
|
|
2236
|
+
license: "none",
|
|
2237
|
+
functionality: "both",
|
|
2238
|
+
httpMethod: "POST"
|
|
2239
|
+
},
|
|
2240
|
+
input: z.object({ to: toParam }),
|
|
2241
|
+
parameterOrder: ["to"],
|
|
2242
|
+
output: messageIdParam
|
|
2243
|
+
});
|
|
1749
2244
|
const getAllContacts = defineMethodV2("getAllContacts", {
|
|
1750
2245
|
meta: {
|
|
1751
2246
|
description: "Retrieves all contacts",
|
|
@@ -1928,9 +2423,13 @@ const getGroupMembersId = defineMethodV2("getGroupMembersId", {
|
|
|
1928
2423
|
parameterOrder: ["groupId"],
|
|
1929
2424
|
output: z.array(ContactIdSchema$1)
|
|
1930
2425
|
});
|
|
2426
|
+
const GroupInfoSchema = z.object({
|
|
2427
|
+
title: z.string(),
|
|
2428
|
+
description: z.string().nullish()
|
|
2429
|
+
}).passthrough().describe("Group title and description returned by the private getGroupInfo patch.");
|
|
1931
2430
|
const getGroupInfo = defineMethodV2("getGroupInfo", {
|
|
1932
2431
|
meta: {
|
|
1933
|
-
description: "Get group
|
|
2432
|
+
description: "Get the group title and description through the installed private patch",
|
|
1934
2433
|
action: "read",
|
|
1935
2434
|
namespace: "groups",
|
|
1936
2435
|
license: "none",
|
|
@@ -1939,7 +2438,7 @@ const getGroupInfo = defineMethodV2("getGroupInfo", {
|
|
|
1939
2438
|
},
|
|
1940
2439
|
input: z.object({ groupId: groupIdParam }),
|
|
1941
2440
|
parameterOrder: ["groupId"],
|
|
1942
|
-
output:
|
|
2441
|
+
output: GroupInfoSchema.or(z.string()).nullable()
|
|
1943
2442
|
});
|
|
1944
2443
|
const getGroupAdmins = defineMethodV2("getGroupAdmins", {
|
|
1945
2444
|
meta: {
|
|
@@ -2556,6 +3055,21 @@ const getOrder = defineMethodV2("getOrder", {
|
|
|
2556
3055
|
output: OrderSchema
|
|
2557
3056
|
});
|
|
2558
3057
|
//#endregion
|
|
3058
|
+
//#region src/license.ts
|
|
3059
|
+
/** Licence access selected by the server, distinct from WhatsApp feature flags. */
|
|
3060
|
+
const LicenseFeaturesSchema = Schema.Struct({
|
|
3061
|
+
status: Schema.Literals([
|
|
3062
|
+
"valid",
|
|
3063
|
+
"missing",
|
|
3064
|
+
"invalid",
|
|
3065
|
+
"expired",
|
|
3066
|
+
"metadata_only"
|
|
3067
|
+
]),
|
|
3068
|
+
keyType: Schema.NullOr(Schema.String),
|
|
3069
|
+
expiresAt: Schema.NullOr(Schema.Number),
|
|
3070
|
+
features: Schema.Record(Schema.String, Schema.Boolean)
|
|
3071
|
+
});
|
|
3072
|
+
//#endregion
|
|
2559
3073
|
//#region src/methods/session.ts
|
|
2560
3074
|
const getMe = defineMethodV2("getMe", {
|
|
2561
3075
|
meta: {
|
|
@@ -2664,6 +3178,19 @@ const getLicenseType = defineMethodV2("getLicenseType", {
|
|
|
2664
3178
|
parameterOrder: [],
|
|
2665
3179
|
output: LicenseTypeSchema.or(z.literal(false))
|
|
2666
3180
|
});
|
|
3181
|
+
const getLicenseFeatures = defineMethodV2("getLicenseFeatures", {
|
|
3182
|
+
meta: {
|
|
3183
|
+
description: "Get enabled and disabled licensed features from the accepted licence patch. This reports licence access; actions check runtime availability automatically.",
|
|
3184
|
+
action: "read",
|
|
3185
|
+
namespace: "session",
|
|
3186
|
+
license: "none",
|
|
3187
|
+
functionality: "both",
|
|
3188
|
+
httpMethod: "GET"
|
|
3189
|
+
},
|
|
3190
|
+
input: z.object({}),
|
|
3191
|
+
parameterOrder: [],
|
|
3192
|
+
output: projectEffectSchema(LicenseFeaturesSchema)
|
|
3193
|
+
});
|
|
2667
3194
|
const getUserAgent = defineMethodV2("getUserAgent", {
|
|
2668
3195
|
meta: {
|
|
2669
3196
|
description: "Get user agent",
|
|
@@ -2883,7 +3410,7 @@ const actions = z.array(InteractiveActionSchema).min(1).superRefine((items, ctx)
|
|
|
2883
3410
|
ids.add(item.id);
|
|
2884
3411
|
});
|
|
2885
3412
|
});
|
|
2886
|
-
const media = {
|
|
3413
|
+
const media$1 = {
|
|
2887
3414
|
source: text.describe("HTTP(S) URL, local file path or base64 data URL; resolved by the client before sending"),
|
|
2888
3415
|
filename: text.optional(),
|
|
2889
3416
|
title: z.string().optional()
|
|
@@ -2895,15 +3422,15 @@ const InteractiveHeaderSchema = z.discriminatedUnion("type", [
|
|
|
2895
3422
|
}).strict(),
|
|
2896
3423
|
z.object({
|
|
2897
3424
|
type: z.literal("image"),
|
|
2898
|
-
...media
|
|
3425
|
+
...media$1
|
|
2899
3426
|
}).strict(),
|
|
2900
3427
|
z.object({
|
|
2901
3428
|
type: z.literal("video"),
|
|
2902
|
-
...media
|
|
3429
|
+
...media$1
|
|
2903
3430
|
}).strict(),
|
|
2904
3431
|
z.object({
|
|
2905
3432
|
type: z.literal("document"),
|
|
2906
|
-
...media
|
|
3433
|
+
...media$1
|
|
2907
3434
|
}).strict()
|
|
2908
3435
|
]);
|
|
2909
3436
|
const base = {
|
|
@@ -2952,7 +3479,7 @@ const CarouselCardSchema = z.object({
|
|
|
2952
3479
|
body: text,
|
|
2953
3480
|
header: z.object({
|
|
2954
3481
|
type: z.literal("image"),
|
|
2955
|
-
...media
|
|
3482
|
+
...media$1
|
|
2956
3483
|
}).strict(),
|
|
2957
3484
|
actions
|
|
2958
3485
|
}).strict();
|
|
@@ -3138,6 +3665,244 @@ const sendRawMessage = defineMethodV2("sendRawMessage", {
|
|
|
3138
3665
|
output: z.string()
|
|
3139
3666
|
});
|
|
3140
3667
|
//#endregion
|
|
3141
|
-
|
|
3668
|
+
//#region src/calling.ts
|
|
3669
|
+
const RawAudioFormatSchema = Schema.Struct({
|
|
3670
|
+
encoding: Schema.Literals(["pcm16le", "float32le"]),
|
|
3671
|
+
sampleRate: Schema.Number,
|
|
3672
|
+
channels: Schema.Literals([1, 2])
|
|
3673
|
+
});
|
|
3674
|
+
const MediaDescriptorSchema = Schema.Struct({
|
|
3675
|
+
kind: Schema.Literals([
|
|
3676
|
+
"file",
|
|
3677
|
+
"url",
|
|
3678
|
+
"device",
|
|
3679
|
+
"remote"
|
|
3680
|
+
]),
|
|
3681
|
+
path: Schema.optional(Schema.String),
|
|
3682
|
+
url: Schema.optional(Schema.String),
|
|
3683
|
+
deviceId: Schema.optional(Schema.String),
|
|
3684
|
+
raw: Schema.optional(RawAudioFormatSchema),
|
|
3685
|
+
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
3686
|
+
overwrite: Schema.optional(Schema.Boolean),
|
|
3687
|
+
loop: Schema.optional(Schema.Boolean),
|
|
3688
|
+
remoteId: Schema.optional(Schema.String)
|
|
3689
|
+
});
|
|
3690
|
+
const CallMediaOptionsSchema = Schema.Struct({
|
|
3691
|
+
microphone: Schema.optional(Schema.Unknown),
|
|
3692
|
+
speaker: Schema.optional(Schema.Unknown),
|
|
3693
|
+
camera: Schema.optional(Schema.Unknown),
|
|
3694
|
+
onMediaFailure: Schema.optional(Schema.Literals(["end", "keep-open"]))
|
|
3695
|
+
});
|
|
3696
|
+
const CallIdentitySchema = Schema.Struct({
|
|
3697
|
+
id: Schema.String,
|
|
3698
|
+
sessionId: Schema.String,
|
|
3699
|
+
generation: Schema.String
|
|
3700
|
+
});
|
|
3701
|
+
const CallEndReasonSchema = Schema.Struct({
|
|
3702
|
+
code: Schema.String,
|
|
3703
|
+
message: Schema.String,
|
|
3704
|
+
source: Schema.Literals([
|
|
3705
|
+
"local",
|
|
3706
|
+
"media",
|
|
3707
|
+
"license",
|
|
3708
|
+
"session",
|
|
3709
|
+
"whatsapp"
|
|
3710
|
+
])
|
|
3711
|
+
});
|
|
3712
|
+
const CallSnapshotSchema = Schema.Struct({
|
|
3713
|
+
...CallIdentitySchema.fields,
|
|
3714
|
+
peer: Schema.String,
|
|
3715
|
+
state: Schema.String,
|
|
3716
|
+
direction: Schema.Literals(["incoming", "outgoing"]),
|
|
3717
|
+
video: Schema.Boolean,
|
|
3718
|
+
terminal: Schema.Boolean,
|
|
3719
|
+
observedAt: Schema.Number,
|
|
3720
|
+
endReason: Schema.optional(CallEndReasonSchema),
|
|
3721
|
+
media: Schema.optional(Schema.Struct({
|
|
3722
|
+
state: Schema.Literals(["attached", "ended"]),
|
|
3723
|
+
reason: Schema.optional(Schema.String)
|
|
3724
|
+
}))
|
|
3725
|
+
});
|
|
3726
|
+
const CallReasonSchema = Schema.Struct({
|
|
3727
|
+
code: Schema.String,
|
|
3728
|
+
message: Schema.String,
|
|
3729
|
+
status: Schema.Number
|
|
3730
|
+
});
|
|
3731
|
+
const CallActionResultSchema = Schema.Union([Schema.Struct({
|
|
3732
|
+
ok: Schema.Literal(true),
|
|
3733
|
+
status: Schema.Literal("requested"),
|
|
3734
|
+
callId: Schema.optional(Schema.String)
|
|
3735
|
+
}), Schema.Struct({
|
|
3736
|
+
ok: Schema.Literal(false),
|
|
3737
|
+
status: Schema.Literals([
|
|
3738
|
+
"unavailable",
|
|
3739
|
+
"failed",
|
|
3740
|
+
"unknown"
|
|
3741
|
+
]),
|
|
3742
|
+
reason: CallReasonSchema,
|
|
3743
|
+
callId: Schema.optional(Schema.String)
|
|
3744
|
+
})]);
|
|
3745
|
+
const CallCapabilitiesSchema = Schema.Struct({
|
|
3746
|
+
control: Schema.Boolean,
|
|
3747
|
+
audio: Schema.Boolean,
|
|
3748
|
+
video: Schema.Boolean,
|
|
3749
|
+
reason: Schema.optional(CallReasonSchema)
|
|
3750
|
+
});
|
|
3751
|
+
//#endregion
|
|
3752
|
+
//#region src/methods/calls.ts
|
|
3753
|
+
const media = Schema.optional(Schema.Unknown);
|
|
3754
|
+
const actionInput = Schema.Struct({
|
|
3755
|
+
call: CallIdentitySchema,
|
|
3756
|
+
media: Schema.optional(CallMediaOptionsSchema)
|
|
3757
|
+
});
|
|
3758
|
+
const register = (name, input, output, parameters, description) => defineMethodV2(name, {
|
|
3759
|
+
meta: {
|
|
3760
|
+
namespace: "calls",
|
|
3761
|
+
action: "update",
|
|
3762
|
+
httpMethod: "POST",
|
|
3763
|
+
license: name === "getCallCapabilities" ? "none" : "restricted",
|
|
3764
|
+
functionality: "both",
|
|
3765
|
+
description
|
|
3766
|
+
},
|
|
3767
|
+
input: projectEffectSchema(input),
|
|
3768
|
+
parameterOrder: parameters,
|
|
3769
|
+
output: projectEffectSchema(output)
|
|
3770
|
+
});
|
|
3771
|
+
const getCallCapabilities = register("getCallCapabilities", Schema.Struct({}), CallCapabilitiesSchema, [], "Optional calling availability for UI and diagnostics. Actions perform admission automatically.");
|
|
3772
|
+
const getActiveCall = register("getActiveCall", Schema.Struct({}), Schema.NullOr(CallSnapshotSchema), [], "Get the current call snapshot. SDK clients hydrate its bound methods.");
|
|
3773
|
+
const acceptCall = register("acceptCall", actionInput, CallActionResultSchema, ["call", "media"], "Prepare media and accept this incoming call.");
|
|
3774
|
+
const startCall = register("startCall", Schema.Struct({
|
|
3775
|
+
to: Schema.String,
|
|
3776
|
+
microphone: media,
|
|
3777
|
+
speaker: media,
|
|
3778
|
+
camera: media
|
|
3779
|
+
}), CallActionResultSchema, [
|
|
3780
|
+
"to",
|
|
3781
|
+
"microphone",
|
|
3782
|
+
"speaker",
|
|
3783
|
+
"camera"
|
|
3784
|
+
], "Prepare media and place an outgoing audio or video call.");
|
|
3785
|
+
const rejectCall = register("rejectCall", Schema.Struct({ call: CallIdentitySchema }), CallActionResultSchema, ["call"], "Reject this call with native state confirmation.");
|
|
3786
|
+
const endCall = register("endCall", Schema.Struct({ call: CallIdentitySchema }), CallActionResultSchema, ["call"], "Request hangup for this call.");
|
|
3787
|
+
const muteCall = register("muteCall", Schema.Struct({
|
|
3788
|
+
call: CallIdentitySchema,
|
|
3789
|
+
muted: Schema.Boolean
|
|
3790
|
+
}), CallActionResultSchema, ["call", "muted"], "Mute or unmute the microphone without ending reception.");
|
|
3791
|
+
const clearCallAudio = register("clearCallAudio", Schema.Struct({ call: CallIdentitySchema }), CallActionResultSchema, ["call"], "Discard queued outgoing audio.");
|
|
3792
|
+
const setCallMedia = register("setCallMedia", actionInput, CallActionResultSchema, ["call", "media"], "Prepare a replacement before releasing the working media.");
|
|
3793
|
+
const observeCallAudio = register("observeCallAudio", Schema.Struct({
|
|
3794
|
+
call: CallIdentitySchema,
|
|
3795
|
+
speaker: Schema.Unknown
|
|
3796
|
+
}), Schema.Union([Schema.Struct({
|
|
3797
|
+
ok: Schema.Literal(true),
|
|
3798
|
+
status: Schema.Literal("requested"),
|
|
3799
|
+
observerId: Schema.String
|
|
3800
|
+
}), CallActionResultSchema]), ["call", "speaker"], "Attach an isolated receive-only audio sink. Its failure does not interrupt the call owner.");
|
|
3801
|
+
const stopCallAudioObserver = register("stopCallAudioObserver", Schema.Struct({
|
|
3802
|
+
call: CallIdentitySchema,
|
|
3803
|
+
observerId: Schema.String
|
|
3804
|
+
}), CallActionResultSchema, ["call", "observerId"], "Stop an audio observer and finalize its sink.");
|
|
3805
|
+
//#endregion
|
|
3806
|
+
//#region src/methods/whatsapp-events.ts
|
|
3807
|
+
const meta = {
|
|
3808
|
+
namespace: "events",
|
|
3809
|
+
license: "none",
|
|
3810
|
+
functionality: "both"
|
|
3811
|
+
};
|
|
3812
|
+
const sendEvent = defineMethodV2("sendEvent", {
|
|
3813
|
+
meta: {
|
|
3814
|
+
...meta,
|
|
3815
|
+
action: "send",
|
|
3816
|
+
httpMethod: "POST",
|
|
3817
|
+
description: "Send a native WhatsApp event with Unix-second times. Returns its submitted message ID; delivery is observed through ACKs."
|
|
3818
|
+
},
|
|
3819
|
+
input: z.object({
|
|
3820
|
+
to: toParam,
|
|
3821
|
+
event: EventInputRegistrySchema
|
|
3822
|
+
}),
|
|
3823
|
+
parameterOrder: ["to", "event"],
|
|
3824
|
+
output: messageIdParam
|
|
3825
|
+
});
|
|
3826
|
+
const getEvent = defineMethodV2("getEvent", {
|
|
3827
|
+
meta: {
|
|
3828
|
+
...meta,
|
|
3829
|
+
action: "read",
|
|
3830
|
+
httpMethod: "GET",
|
|
3831
|
+
description: "Retrieve an event by message ID from WhatsApp local history. Returns null when absent."
|
|
3832
|
+
},
|
|
3833
|
+
input: z.object({ eventId: messageIdParam }),
|
|
3834
|
+
parameterOrder: ["eventId"],
|
|
3835
|
+
output: WhatsAppEventRegistrySchema.nullable()
|
|
3836
|
+
});
|
|
3837
|
+
const getEvents = defineMethodV2("getEvents", {
|
|
3838
|
+
meta: {
|
|
3839
|
+
...meta,
|
|
3840
|
+
action: "read",
|
|
3841
|
+
httpMethod: "GET",
|
|
3842
|
+
description: "Page through a chat’s locally synced event history, newest first. Pass nextCursor as options.before to retrieve the next page."
|
|
3843
|
+
},
|
|
3844
|
+
input: z.object({
|
|
3845
|
+
chatId: toParam,
|
|
3846
|
+
options: EventListOptionsRegistrySchema.optional()
|
|
3847
|
+
}),
|
|
3848
|
+
parameterOrder: ["chatId", "options"],
|
|
3849
|
+
output: EventPageRegistrySchema
|
|
3850
|
+
});
|
|
3851
|
+
const getEventResponses = defineMethodV2("getEventResponses", {
|
|
3852
|
+
meta: {
|
|
3853
|
+
...meta,
|
|
3854
|
+
action: "read",
|
|
3855
|
+
httpMethod: "GET",
|
|
3856
|
+
description: "Get the latest decrypted RSVP per participant, including responses persisted in WhatsApp local history."
|
|
3857
|
+
},
|
|
3858
|
+
input: z.object({ eventId: messageIdParam }),
|
|
3859
|
+
parameterOrder: ["eventId"],
|
|
3860
|
+
output: EventResponseRegistrySchema.array()
|
|
3861
|
+
});
|
|
3862
|
+
const editEvent = defineMethodV2("editEvent", {
|
|
3863
|
+
meta: {
|
|
3864
|
+
...meta,
|
|
3865
|
+
action: "update",
|
|
3866
|
+
httpMethod: "POST",
|
|
3867
|
+
description: "Edit an event created by this account. Unspecified fields retain their current values; endTime: null removes the end time."
|
|
3868
|
+
},
|
|
3869
|
+
input: z.object({
|
|
3870
|
+
eventId: messageIdParam,
|
|
3871
|
+
changes: EventUpdateRegistrySchema
|
|
3872
|
+
}),
|
|
3873
|
+
parameterOrder: ["eventId", "changes"],
|
|
3874
|
+
output: z.boolean()
|
|
3875
|
+
});
|
|
3876
|
+
const cancelEvent = defineMethodV2("cancelEvent", {
|
|
3877
|
+
meta: {
|
|
3878
|
+
...meta,
|
|
3879
|
+
action: "update",
|
|
3880
|
+
httpMethod: "POST",
|
|
3881
|
+
description: "Cancel an event created by this account using WhatsApp’s encrypted event edit action."
|
|
3882
|
+
},
|
|
3883
|
+
input: z.object({ eventId: messageIdParam }),
|
|
3884
|
+
parameterOrder: ["eventId"],
|
|
3885
|
+
output: z.boolean()
|
|
3886
|
+
});
|
|
3887
|
+
const respondToEvent = defineMethodV2("respondToEvent", {
|
|
3888
|
+
meta: {
|
|
3889
|
+
...meta,
|
|
3890
|
+
action: "send",
|
|
3891
|
+
httpMethod: "POST",
|
|
3892
|
+
description: "RSVP through WhatsApp’s native encrypted event-response action."
|
|
3893
|
+
},
|
|
3894
|
+
input: z.object({
|
|
3895
|
+
eventId: messageIdParam,
|
|
3896
|
+
response: z.enum([
|
|
3897
|
+
"going",
|
|
3898
|
+
"notGoing",
|
|
3899
|
+
"maybe"
|
|
3900
|
+
]).meta({ examples: ["going"] })
|
|
3901
|
+
}),
|
|
3902
|
+
parameterOrder: ["eventId", "response"],
|
|
3903
|
+
output: z.boolean()
|
|
3904
|
+
});
|
|
3905
|
+
//#endregion
|
|
3906
|
+
export { defineInteractiveMessage as $, validateEventUpdate as $a, CartItemSchema as $i, getVCards as $n, onlyLocalParam as $r, leaveGroup as $t, sendInteractive as A, LocationSchema as Aa, fileToTempPathCodec as Ai, markAsUnread as An, unstarMessage as Ar, getStories as At, FormResponseSchema as B, EventListOptionsSchema as Ba, PollResultsSchema as Bi, StickerJobSchema as Bn, filenameParam as Br, GroupInfoSchema as Bt, CallMediaOptionsSchema as C, ContactIdSchema$1 as Ca, chatIdCodec as Ci, deleteChat as Cn, sendText as Cr, addLabel as Ct, RawAudioFormatSchema as D, GroupIdSchema$1 as Da, fileToBufferCodec as Di, getChatWithNonContacts as Dn, sendYouTubeLink as Dr, deleteAllStatus as Dt, MediaDescriptorSchema as E, GroupChatIdSchema as Ea, fileToBase64Codec as Ei, getChat as En, sendVideoAsGif as Er, removeLabel as Et, CarouselCardSchema as F, SerializedMessageIdSchema as Fa, messageIdCodec as Fi, unmuteChat as Fn, communityIdParam as Fr, getCommunityAdminIds as Ft, JsonObjectSchema as G, WhatsAppEventSchema as Ga, AutoMediaSendOptionsSchema as Gi, getAllMessages as Gn, latitudeParam as Gr, getAllGroups as Gt, InteractiveContentSchema as H, EventResponseSchema as Ha, PollVoteSchema as Hi, editMessage as Hn, imageDataParam as Hr, approveGroupJoinRequest as Ht, CarouselContentSchema as I, SimpleListener as Ia, unixMillisToDate as Ii, unpinChat as In, contactIdParam as Ir, getCommunityAdmins as It, ListContentSchema as J, deserializeEventResponse as Ja, ImageSendOptionsSchema as Ji, getMessagesForLLM as Jn, mentionedJidListParam as Jr, getGroupInviteLink as Jt, JsonValueSchema as K, decodeEventResponse as Ka, DocumentSendOptionsSchema as Ki, getMessageById as Kn, locationNameParam as Kr, getGroupAdmins as Kt, CopyActionSchema as L, EventResponseRegistrySchema as La, unixSecondsToDate as Li, AlbumMediaSchema as Ln, contentParam as Lr, getCommunityInfo as Lt, BookingContentSchema as M, MessageIdReturnSchema as Ma, hexColorCodec as Mi, pinChat as Mn, audioDataParam as Mr, postTextStatus as Mt, ButtonsContentSchema as N, MessageSchema as Na, isoDatetimeToDate as Ni, setChatEphemeral as Nn, captionParam as Nr, postVideoStatus as Nt, SendInteractiveInputSchema as O, GroupMetadataSchema as Oa, fileToDataUrlCodec as Oi, isChatOnline as On, starMessage as Or, deleteStatus as Ot, CallActionSchema as P, MessageTypes as Pa, jsonStringCodec as Pi, unarchiveChat as Pn, chatIdParam as Pr, getAllCommunities as Pt, ReplyActionSchema as Q, validateEventInput as Qa, BusinessProfileSchema as Qi, getUnsentMessages as Qn, nameParam as Qr, joinGroupViaLink as Qt, FormContentSchema as R, WhatsAppEventRegistrySchema as Ra, urlToDataUrlCodec as Ri, AlbumSendResultSchema as Rn, documentDataParam as Rr, getCommunityParticipantIds as Rt, CallIdentitySchema as S, ChatSchema as Sa, base64ToDataUrlCodec as Si, clearChat as Sn, sendSticker as Sr, getOrder as St, CallSnapshotSchema as T, DataURLSchema as Ta, createFileCodec as Ti, getAllChats as Tn, sendVCard as Tr, getChatsByLabel as Tt, InteractiveHeaderSchema as U, EventResponseTypeSchema as Ua, AudioAttachmentOptionsSchema as Ui, forwardMessages as Un, includeMeParam as Ur, createGroup as Ut, InteractiveActionSchema as V, EventPageSchema as Va, PollSendOptionsSchema as Vi, deleteMessage as Vn, groupIdParam as Vr, addParticipant as Vt, InteractiveResponseSchema as W, EventUpdateSchema as Wa, AudioSendOptionsSchema as Wi, getAlbumMessages as Wn, includeNotificationsParam as Wr, demoteParticipant as Wt, NativeActionSchema as X, serializeEventResponse as Xa, VideoSendOptionsSchema as Xi, getPollResults as Xn, messageIdsParam as Xr, getGroupMembersId as Xt, ListRowSchema as Y, deserializeWhatsAppEvent as Ya, MediaSendOptionsSchema as Yi, getMyLastMessage as Yn, messageIdParam as Yr, getGroupMembers as Yt, NativeContentSchema as Z, serializeWhatsAppEvent as Za, VoiceNoteOptionsSchema as Zi, getStarredMessages as Zn, messageOptionsParam as Zr, getKickedGroups as Zt, startCall as _, NumberProfileSchema as _a, IsoDatetimeToDateSchema as _i, getProfilePicture as _n, sendPaymentRequest as _r, setMyStatus as _t, getEvents as a, CommunityParticipantsSchema as aa, videoDataParam as ai, setGroupEditToAdminsOnly as an, sendAudio as ar, getHostNumber as at, CallCapabilitiesSchema as b, ProductSchema as ba, UnixMillisToDateSchema as bi, unblockContact as bn, sendReplyWithMentions as br, getBusinessProducts as bt, acceptCall as c, GroupCreationResultSchema as ca, Base64ToDataUrlSchema as ci, setGroupToAdminsOnly as cn, sendContact as cr, getLoadedMessageCount as ct, getActiveCall as d, LLMMessageSchema as da, ContactIdCodecSchema as di, checkReadReceipts as dn, sendImage as dr, getSnapshot as dt, CommonGroupSchema as ea, skipMyMessagesParam as ei, promoteParticipant as en, projectEffectSchema as eo, loadEarlierMessages as er, decryptMedia as et, getCallCapabilities as f, LabelSchema as fa, ContactIdSchema as fi, getAllContacts as fn, sendLinkWithAutoPreview as fr, getUserAgent as ft, setCallMedia as g, NumberCheckSchema as ga, HexColorSchema as gi, getNumberProfile as gn, sendMultipleContacts as gr, setMyName as gt, rejectCall as h, MessageInteractionSchema as ha, GroupIdSchema as hi, getContact as hn, sendMessageWithThumb as hr, isPlugged as ht, getEventResponses as i, CommunityParticipantIdsSchema as ia, userAgentParam as ii, setGroupDescription as in, sendAlbum as ir, getFeatures as it, sendRawMessage as j, MessageAck as ja, groupIdCodec as ji, muteChat as jn, voteOnPoll as jr, postImageStatus as jt, SendRawMessageInputSchema as k, IdSchema as ka, fileToStreamCodec as ki, markAsRead as kn, unpinMessage as kr, getStatus as kt, clearCallAudio as l, HealthCheckSchema as la, ChatIdCodecSchema as li, blockContact as ln, sendFile as lr, getMe as lt, observeCallAudio as m, MessageInfoSchema as ma, GroupIdCodecSchema as mi, getCommonGroups as mn, sendLocation as mr, healthCheck as mt, editEvent as n, CommunityAdminsSchema as na, stickerDataParam as ni, removeParticipant as nn, react as nr, getBatteryLevel as nt, respondToEvent as o, ContactStatusSchema as oa, waitForIdParam as oi, setGroupIcon as on, sendBanner as or, getLicenseFeatures as ot, muteCall as p, LicenseTypeSchema as pa, FileToDataUrlSchema as pi, getBlockedIds as pn, sendListMessage as pr, getWAVersion as pt, LinkActionSchema as q, decodeWhatsAppEvent as qa, GifSendOptionsSchema as qi, getMessageInfo as qn, longitudeParam as qr, getGroupInfo as qt, getEvent as r, CommunityMetadataSchema as ra, toParam as ri, revokeGroupInviteLink as rn, sendAdvancedButtons as rr, getConnectionState as rt, sendEvent as s, FeatureFlagsSchema as sa, withNewMessagesOnlyParam as si, setGroupTitle as sn, sendButtons as sr, getLicenseType as st, cancelEvent as t, CommunityAdminIdsSchema as ta, statusTextParam as ti, rejectGroupJoinRequest as tn, pinMessage as tr, downloadMedia as tt, endCall as u, HostAccountSchema as ua, ChatIdSchema as ui, checkNumberStatus as un, sendFileFromUrl as ur, getProcessStats as ut, stopCallAudioObserver as v, OrderSchema as va, MessageIdCodecSchema as vi, requestPhoneNumber as vn, sendPoll as vr, setProfilePicture as vt, CallReasonSchema as w, ContactSchema as wa, contactIdCodec as wi, getAllChatIds as wn, sendTextWithMentions as wr, getAllLabels as wt, CallEndReasonSchema as x, StorySchema as xa, UnixSecondsToDateSchema as xi, archiveChat as xn, sendSeen as xr, getBusinessProfile as xt, CallActionResultSchema as y, ProcessStatsSchema as ya, MessageIdSchema as yi, sharePhoneNumber as yn, sendPtt as yr, LicenseFeaturesSchema as yt, FormQuestionSchema as z, EventInputSchema as za, PinDurationSchema as zi, SendTextResultSchema as zn, fileDataParam as zr, getCommunityParticipants as zt };
|
|
3142
3907
|
|
|
3143
|
-
//# sourceMappingURL=methods-
|
|
3908
|
+
//# sourceMappingURL=methods-BH7nDC3z.mjs.map
|