@openclaw/whatsapp 2026.5.22 → 2026.5.24-beta.2

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 (35) hide show
  1. package/dist/{action-runtime-D4UqEXqf.js → action-runtime-DGx8vCsS.js} +1 -1
  2. package/dist/action-runtime-api.js +1 -1
  3. package/dist/action-runtime.runtime.js +1 -1
  4. package/dist/api.js +6 -6
  5. package/dist/approval-handler.runtime-j8U6lgcp.js +171 -0
  6. package/dist/approval-resolver-e1hAVRRy.js +15 -0
  7. package/dist/{auth-store-GTQvJznL.js → auth-store-BrKb0mwT.js} +2 -2
  8. package/dist/{channel-BQqQ-Gp5.js → channel-DOxZCBxE.js} +415 -34
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/{channel-react-action-CHdR3gbn.js → channel-react-action-O7asbQQ1.js} +2 -2
  11. package/dist/{channel.runtime-BZ_ya3mR.js → channel.runtime-B0cFknwD.js} +4 -4
  12. package/dist/{channel.setup-vWI0fm8Y.js → channel.setup-Bk7Hmp4a.js} +2 -2
  13. package/dist/{connection-controller-9TXWZRhx.js → connection-controller-ja6z4F_k.js} +2 -2
  14. package/dist/light-runtime-api.js +1 -1
  15. package/dist/{login-nJwaNuC-.js → login-BEkrpJbZ.js} +3 -3
  16. package/dist/{login-qr-l4UaR8Dj.js → login-qr-BVRx8j_M.js} +3 -3
  17. package/dist/login-qr-runtime.js +1 -1
  18. package/dist/{monitor-ClhD-fQ6.js → monitor-BU1ydkuF.js} +324 -87
  19. package/dist/{outbound-adapter-ltiZkW9L.js → outbound-adapter-BObZXXzU.js} +1 -1
  20. package/dist/outbound-payload-test-api.js +1 -1
  21. package/dist/{runtime-CboC4QhQ.js → runtime-BfAdAEYT.js} +2 -2
  22. package/dist/runtime-api.js +8 -8
  23. package/dist/runtime-setter-api.js +1 -1
  24. package/dist/send-C9jEw6hx.js +625 -0
  25. package/dist/{send-api-CXPUXbUL.js → send-api-CC-vHBWG.js} +2 -2
  26. package/dist/{session-CPsgRMMa.js → session-CDgpDc0l.js} +2 -2
  27. package/dist/{session.runtime-C6uBkEaI.js → session.runtime-LZFdq3yb.js} +1 -1
  28. package/dist/{setup-core-BTDKEc-x.js → setup-core-Ce-b_wzQ.js} +2 -2
  29. package/dist/{setup-finalize-DUYdQs-v.js → setup-finalize-BqOudqJw.js} +2 -2
  30. package/dist/setup-plugin-api.js +1 -1
  31. package/dist/{setup-surface-Uoh9W_29.js → setup-surface-CAchPwW5.js} +2 -2
  32. package/dist/test-api.js +1 -1
  33. package/npm-shrinkwrap.json +3 -3
  34. package/package.json +4 -4
  35. package/dist/send-E_kMiuZP.js +0 -269
@@ -1,7 +1,7 @@
1
1
  import { o as resolveWebCredsBackupPath, s as resolveWebCredsPath, t as assertWebCredsPathRegularFileOrMissing } from "./creds-files-B1kSWtBg.js";
2
2
  import { n as getStatusCode } from "./session-errors-BAj9D2La.js";
3
- import { E as writeWebCredsRawAtomically, S as enqueueCredsSave, T as writeCredsJsonAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, w as waitForCredsSaveQueueWithTimeout, y as resolveDefaultWebAuthDir } from "./auth-store-GTQvJznL.js";
4
- import { i as makeWASocket, n as fetchLatestBaileysVersion, o as useMultiFileAuthState, r as makeCacheableSignalKeyStore, t as DisconnectReason } from "./session.runtime-C6uBkEaI.js";
3
+ import { E as writeWebCredsRawAtomically, S as enqueueCredsSave, T as writeCredsJsonAtomically, b as restoreCredsFromBackupIfNeeded, u as readCredsJsonRaw, w as waitForCredsSaveQueueWithTimeout, y as resolveDefaultWebAuthDir } from "./auth-store-BrKb0mwT.js";
4
+ import { a as makeWASocket, i as makeCacheableSignalKeyStore, n as DisconnectReason, r as fetchLatestBaileysVersion, s as useMultiFileAuthState } from "./session.runtime-LZFdq3yb.js";
5
5
  import { VERSION, formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
6
6
  import { danger, getChildLogger, success, toPinoLikeLogger } from "openclaw/plugin-sdk/runtime-env";
7
7
  import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
@@ -10,4 +10,4 @@ var session_runtime_exports = /* @__PURE__ */ __exportAll({
10
10
  useMultiFileAuthState: () => useMultiFileAuthState
11
11
  });
12
12
  //#endregion
13
- export { session_runtime_exports as a, makeWASocket as i, fetchLatestBaileysVersion as n, useMultiFileAuthState as o, makeCacheableSignalKeyStore as r, DisconnectReason$1 as t };
13
+ export { makeWASocket as a, makeCacheableSignalKeyStore as i, DisconnectReason$1 as n, session_runtime_exports as o, fetchLatestBaileysVersion as r, useMultiFileAuthState as s, BufferJSON as t };
@@ -125,10 +125,10 @@ function resolveWhatsAppConfigPath(params) {
125
125
  return `${resolveWhatsAppGroupScopeBasePath(params)}.${params.field}`;
126
126
  }
127
127
  async function loadWhatsAppChannelRuntime() {
128
- return await import("./channel.runtime-BZ_ya3mR.js");
128
+ return await import("./channel.runtime-B0cFknwD.js");
129
129
  }
130
130
  async function loadWhatsAppSetupSurface() {
131
- return await import("./setup-surface-Uoh9W_29.js");
131
+ return await import("./setup-surface-CAchPwW5.js");
132
132
  }
133
133
  const whatsappSetupWizardProxy = createWhatsAppSetupWizardProxy(async () => (await loadWhatsAppSetupSurface()).whatsappSetupWizard);
134
134
  const whatsappConfigAdapter = createScopedChannelConfigAdapter({
@@ -2,7 +2,7 @@ import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js"
2
2
  import { r as hasWebCredsSync } from "./creds-files-B1kSWtBg.js";
3
3
  import { a as resolveWhatsAppAccount, o as resolveWhatsAppAuthDir } from "./accounts-BPYgj8Fv.js";
4
4
  import { a as normalizeWhatsAppAllowFromEntries, o as normalizeWhatsAppAllowFromEntry } from "./normalize-target-bVWjgftN.js";
5
- import { t as whatsappSetupAdapter } from "./setup-core-BTDKEc-x.js";
5
+ import { t as whatsappSetupAdapter } from "./setup-core-Ce-b_wzQ.js";
6
6
  import { DEFAULT_ACCOUNT_ID, createSetupTranslator, splitSetupEntries } from "openclaw/plugin-sdk/setup";
7
7
  import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools";
8
8
  //#region extensions/whatsapp/src/setup-finalize.ts
@@ -280,7 +280,7 @@ async function finalizeWhatsAppSetup(params) {
280
280
  message: linked ? t("wizard.whatsapp.relinkPrompt") : t("wizard.whatsapp.linkNowPrompt"),
281
281
  initialValue: !linked
282
282
  })) try {
283
- const { loginWeb } = await import("./login-nJwaNuC-.js").then((n) => n.n);
283
+ const { loginWeb } = await import("./login-BEkrpJbZ.js").then((n) => n.n);
284
284
  await loginWeb(false, void 0, params.runtime, accountId);
285
285
  } catch (error) {
286
286
  params.runtime.error(`WhatsApp login failed: ${String(error)}`);
@@ -1,2 +1,2 @@
1
- import { t as whatsappSetupPlugin } from "./channel.setup-vWI0fm8Y.js";
1
+ import { t as whatsappSetupPlugin } from "./channel.setup-Bk7Hmp4a.js";
2
2
  export { whatsappSetupPlugin };
@@ -1,6 +1,6 @@
1
1
  import { t as listAccountIds } from "./account-ids-CB5SOWjc.js";
2
2
  import { o as resolveWhatsAppAuthDir } from "./accounts-BPYgj8Fv.js";
3
- import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-GTQvJznL.js";
3
+ import { a as formatWhatsAppWebAuthStatusState, h as readWebAuthState } from "./auth-store-BrKb0mwT.js";
4
4
  import { DEFAULT_ACCOUNT_ID, createSetupTranslator, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
5
5
  //#region extensions/whatsapp/src/setup-surface.ts
6
6
  const t = createSetupTranslator();
@@ -36,7 +36,7 @@ const whatsappSetupWizard = {
36
36
  },
37
37
  resolveShouldPromptAccountIds: ({ shouldPromptAccountIds }) => shouldPromptAccountIds,
38
38
  credentials: [],
39
- finalize: async (params) => await (await import("./setup-finalize-DUYdQs-v.js")).finalizeWhatsAppSetup(params),
39
+ finalize: async (params) => await (await import("./setup-finalize-BqOudqJw.js")).finalizeWhatsAppSetup(params),
40
40
  disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
41
41
  onAccountRecorded: (accountId, options) => {
42
42
  options?.onAccountId?.(channel, accountId);
package/dist/test-api.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { t as resolveWhatsAppRuntimeGroupPolicy } from "./runtime-group-policy-DeSRFXEV.js";
2
- import { t as whatsappOutbound } from "./outbound-adapter-ltiZkW9L.js";
2
+ import { t as whatsappOutbound } from "./outbound-adapter-BObZXXzU.js";
3
3
  export { resolveWhatsAppRuntimeGroupPolicy, whatsappOutbound };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/whatsapp",
3
- "version": "2026.5.22",
3
+ "version": "2026.5.24-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/whatsapp",
9
- "version": "2026.5.22",
9
+ "version": "2026.5.24-beta.2",
10
10
  "dependencies": {
11
11
  "audio-decode": "2.2.3",
12
12
  "baileys": "7.0.0-rc13",
@@ -15,7 +15,7 @@
15
15
  "typebox": "1.1.38"
16
16
  },
17
17
  "peerDependencies": {
18
- "openclaw": ">=2026.5.22"
18
+ "openclaw": ">=2026.5.24-beta.2"
19
19
  },
20
20
  "peerDependenciesMeta": {
21
21
  "openclaw": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/whatsapp",
3
- "version": "2026.5.22",
3
+ "version": "2026.5.24-beta.2",
4
4
  "description": "OpenClaw WhatsApp channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  "typebox": "1.1.38"
16
16
  },
17
17
  "peerDependencies": {
18
- "openclaw": ">=2026.5.22"
18
+ "openclaw": ">=2026.5.24-beta.2"
19
19
  },
20
20
  "peerDependenciesMeta": {
21
21
  "openclaw": {
@@ -58,10 +58,10 @@
58
58
  "minHostVersion": ">=2026.4.25"
59
59
  },
60
60
  "compat": {
61
- "pluginApi": ">=2026.5.22"
61
+ "pluginApi": ">=2026.5.24-beta.2"
62
62
  },
63
63
  "build": {
64
- "openclawVersion": "2026.5.22"
64
+ "openclawVersion": "2026.5.24-beta.2"
65
65
  },
66
66
  "release": {
67
67
  "publishToClawHub": true,
@@ -1,269 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { r as resolveDefaultWhatsAppAccountId } from "./account-ids-CB5SOWjc.js";
3
- import { a as resolveWhatsAppAccount, s as resolveWhatsAppMediaMaxBytes } from "./accounts-BPYgj8Fv.js";
4
- import { n as isWhatsAppNewsletterJid } from "./normalize-target-bVWjgftN.js";
5
- import { t as getRegisteredWhatsAppConnectionController } from "./connection-controller-registry-TSX_udJp.js";
6
- import { a as resolveWhatsAppOutboundMediaUrls, i as prepareWhatsAppOutboundMedia, n as normalizeWhatsAppPayloadText, s as resolveWhatsAppDocumentFileName } from "./outbound-media-contract-ioTkt8tn.js";
7
- import "./normalize-Bxwqo-bW.js";
8
- import { d as markdownToWhatsApp, p as toWhatsappJid } from "./text-runtime-Dk37KYHj.js";
9
- import { formatCliCommand } from "openclaw/plugin-sdk/cli-runtime";
10
- import { generateSecureUuid } from "openclaw/plugin-sdk/core";
11
- import { redactIdentifier } from "openclaw/plugin-sdk/logging-core";
12
- import { convertMarkdownTables, resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
13
- import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
14
- import { normalizePollInput } from "openclaw/plugin-sdk/poll-runtime";
15
- import { createSubsystemLogger, getChildLogger as getChildLogger$1 } from "openclaw/plugin-sdk/runtime-env";
16
- import { loadWebMedia } from "openclaw/plugin-sdk/web-media";
17
- //#region extensions/whatsapp/src/outbound-media.runtime.ts
18
- async function loadOutboundMediaFromUrl(mediaUrl, options = {}) {
19
- const readFile = options.mediaAccess?.readFile ?? options.mediaReadFile;
20
- const localRoots = options.mediaAccess?.localRoots?.length && options.mediaAccess.localRoots.length > 0 ? options.mediaAccess.localRoots : options.mediaLocalRoots && options.mediaLocalRoots.length > 0 ? options.mediaLocalRoots : void 0;
21
- const sharedOptions = {
22
- ...options.maxBytes !== void 0 ? { maxBytes: options.maxBytes } : {},
23
- ...options.optimizeImages !== void 0 ? { optimizeImages: options.optimizeImages } : {}
24
- };
25
- return await loadWebMedia(mediaUrl, readFile ? {
26
- ...sharedOptions,
27
- localRoots: "any",
28
- readFile,
29
- hostReadCapability: true
30
- } : {
31
- ...sharedOptions,
32
- ...localRoots ? { localRoots } : {}
33
- });
34
- }
35
- //#endregion
36
- //#region extensions/whatsapp/src/send.ts
37
- var send_exports = /* @__PURE__ */ __exportAll({
38
- sendMessageWhatsApp: () => sendMessageWhatsApp,
39
- sendPollWhatsApp: () => sendPollWhatsApp,
40
- sendReactionWhatsApp: () => sendReactionWhatsApp,
41
- sendTypingWhatsApp: () => sendTypingWhatsApp
42
- });
43
- const outboundLog = createSubsystemLogger("gateway/channels/whatsapp").child("outbound");
44
- function supportsForcedDocumentDelivery(kind) {
45
- return kind === "image" || kind === "video";
46
- }
47
- function resolveOutboundWhatsAppAccountId(params) {
48
- const explicitAccountId = params.accountId?.trim();
49
- if (explicitAccountId) return explicitAccountId;
50
- return resolveDefaultWhatsAppAccountId(params.cfg);
51
- }
52
- function requireOutboundActiveWebListener(params) {
53
- const resolvedAccountId = resolveOutboundWhatsAppAccountId(params) ?? resolveDefaultWhatsAppAccountId(params.cfg);
54
- const listener = getRegisteredWhatsAppConnectionController(resolvedAccountId)?.getActiveListener() ?? null;
55
- if (!listener) throw new Error(`No active WhatsApp Web listener (account: ${resolvedAccountId}). Start the gateway, then link WhatsApp with: ${formatCliCommand(`openclaw channels login --channel whatsapp --account ${resolvedAccountId}`)}.`);
56
- return {
57
- accountId: resolvedAccountId,
58
- listener
59
- };
60
- }
61
- async function sendMessageWhatsApp(to, body, options) {
62
- let text = options.preserveLeadingWhitespace ? body : normalizeWhatsAppPayloadText(body);
63
- const jid = toWhatsappJid(to);
64
- const mediaUrls = resolveWhatsAppOutboundMediaUrls(options);
65
- const mediaPayload = options.mediaPayload;
66
- const primaryMediaUrl = mediaUrls[0] ?? mediaPayload?.fileName;
67
- const hasMedia = Boolean(mediaPayload || primaryMediaUrl);
68
- if (!text && !hasMedia) return {
69
- messageId: "",
70
- toJid: jid
71
- };
72
- const correlationId = generateSecureUuid();
73
- const startedAt = Date.now();
74
- const cfg = requireRuntimeConfig(options.cfg, "WhatsApp send");
75
- const { listener: active, accountId: resolvedAccountId } = requireOutboundActiveWebListener({
76
- cfg,
77
- accountId: options.accountId
78
- });
79
- const account = resolveWhatsAppAccount({
80
- cfg,
81
- accountId: resolvedAccountId ?? options.accountId
82
- });
83
- const tableMode = resolveMarkdownTableMode({
84
- cfg,
85
- channel: "whatsapp",
86
- accountId: resolvedAccountId ?? options.accountId
87
- });
88
- text = convertMarkdownTables(text ?? "", tableMode);
89
- text = markdownToWhatsApp(text);
90
- const redactedTo = redactIdentifier(to);
91
- const logger = getChildLogger$1({
92
- module: "web-outbound",
93
- correlationId,
94
- to: redactedTo
95
- });
96
- try {
97
- const redactedJid = redactIdentifier(jid);
98
- let mediaBuffer;
99
- let mediaType;
100
- let documentFileName;
101
- let visibleTextAfterVoice;
102
- let forceDocumentDelivery = false;
103
- if (mediaPayload) {
104
- const media = await prepareWhatsAppOutboundMedia(mediaPayload, primaryMediaUrl);
105
- const caption = text || void 0;
106
- mediaBuffer = media.buffer;
107
- mediaType = media.mimetype;
108
- forceDocumentDelivery = Boolean(options.forceDocument && supportsForcedDocumentDelivery(media.kind));
109
- if (media.kind === "audio" && caption) {
110
- visibleTextAfterVoice = caption;
111
- text = "";
112
- } else if (media.kind === "document") {
113
- text = caption ?? "";
114
- documentFileName = media.fileName;
115
- } else text = caption ?? "";
116
- if (forceDocumentDelivery) documentFileName ??= resolveWhatsAppDocumentFileName({
117
- fileName: media.fileName,
118
- mimetype: media.mimetype
119
- });
120
- } else if (primaryMediaUrl) {
121
- const media = await prepareWhatsAppOutboundMedia(await loadOutboundMediaFromUrl(primaryMediaUrl, {
122
- maxBytes: resolveWhatsAppMediaMaxBytes(account),
123
- optimizeImages: options.forceDocument ? false : void 0,
124
- mediaAccess: options.mediaAccess,
125
- mediaLocalRoots: options.mediaLocalRoots,
126
- mediaReadFile: options.mediaReadFile
127
- }), primaryMediaUrl);
128
- const caption = text || void 0;
129
- mediaBuffer = media.buffer;
130
- mediaType = media.mimetype;
131
- forceDocumentDelivery = Boolean(options.forceDocument && supportsForcedDocumentDelivery(media.kind));
132
- if (media.kind === "audio" && caption) {
133
- visibleTextAfterVoice = caption;
134
- text = "";
135
- } else if (media.kind === "document") {
136
- text = caption ?? "";
137
- documentFileName = media.fileName;
138
- } else text = caption ?? "";
139
- if (forceDocumentDelivery) documentFileName ??= resolveWhatsAppDocumentFileName({
140
- fileName: media.fileName,
141
- mimetype: media.mimetype
142
- });
143
- }
144
- outboundLog.info(`Sending message -> ${redactedJid}${hasMedia ? " (media)" : ""}`);
145
- logger.info({
146
- jid: redactedJid,
147
- hasMedia
148
- }, "sending message");
149
- if (!isWhatsAppNewsletterJid(jid)) await active.sendComposingTo(to);
150
- const accountId = Boolean(options.accountId?.trim()) ? resolvedAccountId : void 0;
151
- const sendOptions = options.gifPlayback || forceDocumentDelivery || accountId || documentFileName || options.quotedMessageKey ? {
152
- ...options.gifPlayback ? { gifPlayback: true } : {},
153
- ...forceDocumentDelivery ? { asDocument: true } : {},
154
- ...documentFileName ? { fileName: documentFileName } : {},
155
- ...options.quotedMessageKey ? { quotedMessageKey: options.quotedMessageKey } : {},
156
- accountId
157
- } : void 0;
158
- const result = sendOptions ? await active.sendMessage(to, text, mediaBuffer, mediaType, sendOptions) : await active.sendMessage(to, text, mediaBuffer, mediaType);
159
- if (visibleTextAfterVoice) if (sendOptions) await active.sendMessage(to, visibleTextAfterVoice, void 0, void 0, sendOptions);
160
- else await active.sendMessage(to, visibleTextAfterVoice, void 0, void 0);
161
- const messageId = result?.messageId ?? "unknown";
162
- const durationMs = Date.now() - startedAt;
163
- outboundLog.info(`Sent message ${messageId} -> ${redactedJid}${hasMedia ? " (media)" : ""} (${durationMs}ms)`);
164
- logger.info({
165
- jid: redactedJid,
166
- messageId
167
- }, "sent message");
168
- return {
169
- messageId,
170
- toJid: jid
171
- };
172
- } catch (err) {
173
- logger.error({
174
- err: String(err),
175
- to: redactedTo,
176
- hasMedia
177
- }, "failed to send via web session");
178
- throw err;
179
- }
180
- }
181
- async function sendTypingWhatsApp(to, options) {
182
- const { listener: active } = requireOutboundActiveWebListener({
183
- cfg: requireRuntimeConfig(options.cfg, "WhatsApp typing send"),
184
- accountId: options.accountId
185
- });
186
- if (!isWhatsAppNewsletterJid(toWhatsappJid(to))) await active.sendComposingTo(to);
187
- }
188
- async function sendReactionWhatsApp(chatJid, messageId, emoji, options) {
189
- const correlationId = generateSecureUuid();
190
- const { listener: active } = requireOutboundActiveWebListener({
191
- cfg: requireRuntimeConfig(options.cfg, "WhatsApp reaction"),
192
- accountId: options.accountId
193
- });
194
- const redactedChatJid = redactIdentifier(chatJid);
195
- const logger = getChildLogger$1({
196
- module: "web-outbound",
197
- correlationId,
198
- chatJid: redactedChatJid,
199
- messageId
200
- });
201
- try {
202
- const redactedJid = redactIdentifier(toWhatsappJid(chatJid));
203
- outboundLog.info(`Sending reaction "${emoji}" -> message ${messageId}`);
204
- logger.info({
205
- chatJid: redactedJid,
206
- messageId,
207
- emoji
208
- }, "sending reaction");
209
- await active.sendReaction(chatJid, messageId, emoji, options.fromMe ?? false, options.participant);
210
- outboundLog.info(`Sent reaction "${emoji}" -> message ${messageId}`);
211
- logger.info({
212
- chatJid: redactedJid,
213
- messageId,
214
- emoji
215
- }, "sent reaction");
216
- } catch (err) {
217
- logger.error({
218
- err: String(err),
219
- chatJid: redactedChatJid,
220
- messageId,
221
- emoji
222
- }, "failed to send reaction via web session");
223
- throw err;
224
- }
225
- }
226
- async function sendPollWhatsApp(to, poll, options) {
227
- const correlationId = generateSecureUuid();
228
- const startedAt = Date.now();
229
- const { listener: active } = requireOutboundActiveWebListener({
230
- cfg: requireRuntimeConfig(options.cfg, "WhatsApp poll"),
231
- accountId: options.accountId
232
- });
233
- const redactedTo = redactIdentifier(to);
234
- const logger = getChildLogger$1({
235
- module: "web-outbound",
236
- correlationId,
237
- to: redactedTo
238
- });
239
- try {
240
- const jid = toWhatsappJid(to);
241
- const redactedJid = redactIdentifier(jid);
242
- const normalized = normalizePollInput(poll, { maxOptions: 12 });
243
- outboundLog.info(`Sending poll -> ${redactedJid}`);
244
- logger.info({
245
- jid: redactedJid,
246
- optionCount: normalized.options.length,
247
- maxSelections: normalized.maxSelections
248
- }, "sending poll");
249
- const messageId = (await active.sendPoll(to, normalized))?.messageId ?? "unknown";
250
- const durationMs = Date.now() - startedAt;
251
- outboundLog.info(`Sent poll ${messageId} -> ${redactedJid} (${durationMs}ms)`);
252
- logger.info({
253
- jid: redactedJid,
254
- messageId
255
- }, "sent poll");
256
- return {
257
- messageId,
258
- toJid: jid
259
- };
260
- } catch (err) {
261
- logger.error({
262
- err: String(err),
263
- to: redactedTo
264
- }, "failed to send poll via web session");
265
- throw err;
266
- }
267
- }
268
- //#endregion
269
- export { send_exports as a, sendTypingWhatsApp as i, sendPollWhatsApp as n, sendReactionWhatsApp as r, sendMessageWhatsApp as t };