@elizaos/plugin-whatsapp 2.0.0-alpha.9 → 2.0.0-beta.1

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 (54) hide show
  1. package/README.md +283 -0
  2. package/auto-enable.ts +21 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/accounts.d.ts +205 -0
  5. package/dist/accounts.d.ts.map +1 -0
  6. package/dist/actions/index.d.ts +1 -0
  7. package/dist/actions/index.d.ts.map +1 -0
  8. package/dist/api/whatsapp-routes.d.ts +53 -0
  9. package/dist/api/whatsapp-routes.d.ts.map +1 -0
  10. package/dist/baileys/auth.d.ts +10 -0
  11. package/dist/baileys/auth.d.ts.map +1 -0
  12. package/dist/baileys/connection.d.ts +19 -0
  13. package/dist/baileys/connection.d.ts.map +1 -0
  14. package/dist/baileys/message-adapter.d.ts +14 -0
  15. package/dist/baileys/message-adapter.d.ts.map +1 -0
  16. package/dist/baileys/qr-code.d.ts +6 -0
  17. package/dist/baileys/qr-code.d.ts.map +1 -0
  18. package/dist/client.d.ts +99 -0
  19. package/dist/client.d.ts.map +1 -0
  20. package/dist/clients/baileys-client.d.ts +18 -0
  21. package/dist/clients/baileys-client.d.ts.map +1 -0
  22. package/dist/clients/factory.d.ts +6 -0
  23. package/dist/clients/factory.d.ts.map +1 -0
  24. package/dist/clients/interface.d.ts +10 -0
  25. package/dist/clients/interface.d.ts.map +1 -0
  26. package/dist/config.d.ts +135 -0
  27. package/dist/config.d.ts.map +1 -0
  28. package/dist/connector-account-provider.d.ts +19 -0
  29. package/dist/connector-account-provider.d.ts.map +1 -0
  30. package/dist/index.d.ts +14 -2
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +2352 -840
  33. package/dist/index.js.map +21 -19
  34. package/dist/normalize.d.ts +69 -0
  35. package/dist/normalize.d.ts.map +1 -0
  36. package/dist/pairing-service.d.ts +41 -0
  37. package/dist/pairing-service.d.ts.map +1 -0
  38. package/dist/runtime-service.d.ts +116 -0
  39. package/dist/runtime-service.d.ts.map +1 -0
  40. package/dist/services/whatsapp-pairing.d.ts +41 -0
  41. package/dist/services/whatsapp-pairing.d.ts.map +1 -0
  42. package/dist/setup-routes.d.ts +26 -0
  43. package/dist/setup-routes.d.ts.map +1 -0
  44. package/dist/types.d.ts +370 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/utils/config-detector.d.ts +3 -0
  47. package/dist/utils/config-detector.d.ts.map +1 -0
  48. package/dist/utils/index.d.ts +3 -0
  49. package/dist/utils/index.d.ts.map +1 -0
  50. package/dist/utils/validators.d.ts +10 -0
  51. package/dist/utils/validators.d.ts.map +1 -0
  52. package/dist/workflow-credential-provider.d.ts +21 -0
  53. package/dist/workflow-credential-provider.d.ts.map +1 -0
  54. package/package.json +137 -131
@@ -0,0 +1,205 @@
1
+ import type { IAgentRuntime } from "@elizaos/core";
2
+ /**
3
+ * Default account identifier used when no specific account is configured
4
+ */
5
+ export declare const DEFAULT_ACCOUNT_ID = "default";
6
+ /**
7
+ * Token source indicator
8
+ */
9
+ export type WhatsAppTokenSource = "config" | "env" | "character" | "none";
10
+ /**
11
+ * Group-specific runtime configuration (for account resolution)
12
+ */
13
+ export interface WhatsAppGroupRuntimeConfig {
14
+ /** If false, ignore messages from this group */
15
+ enabled?: boolean;
16
+ /** Allowlist for users in this group */
17
+ allowFrom?: Array<string | number>;
18
+ /** Require bot mention to respond */
19
+ requireMention?: boolean;
20
+ /** Custom system prompt for this group */
21
+ systemPrompt?: string;
22
+ /** Skills enabled for this group */
23
+ skills?: string[];
24
+ }
25
+ /**
26
+ * Configuration for a single WhatsApp account (runtime resolution)
27
+ */
28
+ export interface WhatsAppAccountRuntimeConfig {
29
+ /** Optional display name for this account */
30
+ name?: string;
31
+ /** If false, do not start this WhatsApp account */
32
+ enabled?: boolean;
33
+ /** Transport implementation for this account */
34
+ transport?: "cloudapi" | "baileys";
35
+ /** Baileys auth/session directory */
36
+ authDir?: string;
37
+ /** WhatsApp Cloud API access token */
38
+ accessToken?: string;
39
+ /** Phone number ID from WhatsApp Business */
40
+ phoneNumberId?: string;
41
+ /** Business account ID */
42
+ businessAccountId?: string;
43
+ /** Webhook verification token */
44
+ webhookVerifyToken?: string;
45
+ /** API version to use */
46
+ apiVersion?: string;
47
+ /** Allowlist for DM senders */
48
+ allowFrom?: Array<string | number>;
49
+ /** Allowlist for groups */
50
+ groupAllowFrom?: Array<string | number>;
51
+ /** DM access policy */
52
+ dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
53
+ /** Group message access policy */
54
+ groupPolicy?: "open" | "allowlist" | "disabled";
55
+ /** Max media size in MB */
56
+ mediaMaxMb?: number;
57
+ /** Text chunk limit for messages */
58
+ textChunkLimit?: number;
59
+ /** Group-specific configurations */
60
+ groups?: Record<string, WhatsAppGroupRuntimeConfig>;
61
+ }
62
+ /**
63
+ * Multi-account WhatsApp configuration structure
64
+ */
65
+ export interface WhatsAppMultiAccountConfig {
66
+ /** Default/base configuration applied to all accounts */
67
+ enabled?: boolean;
68
+ transport?: "cloudapi" | "baileys";
69
+ authDir?: string;
70
+ accessToken?: string;
71
+ phoneNumberId?: string;
72
+ businessAccountId?: string;
73
+ webhookVerifyToken?: string;
74
+ apiVersion?: string;
75
+ dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
76
+ groupPolicy?: "open" | "allowlist" | "disabled";
77
+ mediaMaxMb?: number;
78
+ textChunkLimit?: number;
79
+ /** Per-account configuration overrides */
80
+ accounts?: Record<string, WhatsAppAccountRuntimeConfig>;
81
+ /** Group configurations at base level */
82
+ groups?: Record<string, WhatsAppGroupRuntimeConfig>;
83
+ }
84
+ /**
85
+ * Token resolution result
86
+ */
87
+ export interface WhatsAppTokenResolution {
88
+ token: string;
89
+ source: WhatsAppTokenSource;
90
+ }
91
+ /**
92
+ * Resolved WhatsApp account with all configuration merged
93
+ */
94
+ export interface ResolvedWhatsAppAccount {
95
+ accountId: string;
96
+ enabled: boolean;
97
+ name?: string;
98
+ accessToken: string;
99
+ phoneNumberId: string;
100
+ businessAccountId?: string;
101
+ tokenSource: WhatsAppTokenSource;
102
+ configured: boolean;
103
+ config: WhatsAppAccountRuntimeConfig;
104
+ }
105
+ /**
106
+ * Normalizes an account ID, returning the default if not provided
107
+ */
108
+ export declare function normalizeAccountId(accountId?: string | null): string;
109
+ /**
110
+ * Gets the multi-account configuration from runtime settings
111
+ */
112
+ export declare function getMultiAccountConfig(runtime: IAgentRuntime): WhatsAppMultiAccountConfig;
113
+ /**
114
+ * Lists all configured account IDs
115
+ */
116
+ export declare function listWhatsAppAccountIds(runtime: IAgentRuntime): string[];
117
+ /**
118
+ * Resolves the default account ID to use
119
+ */
120
+ export declare function resolveDefaultWhatsAppAccountId(runtime: IAgentRuntime): string;
121
+ /**
122
+ * Resolves the access token for a WhatsApp account
123
+ */
124
+ export declare function resolveWhatsAppToken(runtime: IAgentRuntime, accountId: string): WhatsAppTokenResolution;
125
+ /**
126
+ * Resolves a complete WhatsApp account configuration
127
+ */
128
+ export declare function resolveWhatsAppAccount(runtime: IAgentRuntime, accountId?: string | null): ResolvedWhatsAppAccount;
129
+ /**
130
+ * Lists all enabled WhatsApp accounts
131
+ */
132
+ export declare function listEnabledWhatsAppAccounts(runtime: IAgentRuntime): ResolvedWhatsAppAccount[];
133
+ /**
134
+ * Checks if multi-account mode is enabled
135
+ */
136
+ export declare function isMultiAccountEnabled(runtime: IAgentRuntime): boolean;
137
+ /**
138
+ * Resolves group configuration for a specific group
139
+ */
140
+ export declare function resolveWhatsAppGroupConfig(runtime: IAgentRuntime, accountId: string, groupId: string): WhatsAppGroupRuntimeConfig | undefined;
141
+ /**
142
+ * Checks if a user is allowed based on policy and allowlist
143
+ */
144
+ export declare function isWhatsAppUserAllowed(params: {
145
+ identifier: string;
146
+ accountConfig: WhatsAppAccountRuntimeConfig;
147
+ isGroup: boolean;
148
+ groupId?: string;
149
+ groupConfig?: WhatsAppGroupRuntimeConfig;
150
+ }): boolean;
151
+ /**
152
+ * Checks if mention is required in a group
153
+ */
154
+ export declare function isWhatsAppMentionRequired(params: {
155
+ accountConfig: WhatsAppAccountRuntimeConfig;
156
+ groupConfig?: WhatsAppGroupRuntimeConfig;
157
+ }): boolean;
158
+ /**
159
+ * Result of an async WhatsApp access check
160
+ */
161
+ export interface WhatsAppAccessCheckResult {
162
+ /** Whether the sender is allowed to proceed */
163
+ allowed: boolean;
164
+ /** If not allowed (pairing policy), the pairing code */
165
+ pairingCode?: string;
166
+ /** Whether a new pairing request was created */
167
+ newPairingRequest?: boolean;
168
+ /** Human-readable message to send to the user when blocked */
169
+ replyMessage?: string;
170
+ }
171
+ /**
172
+ * Checks if a user is allowed based on policy and allowlist, with async pairing support.
173
+ *
174
+ * For non-pairing policies, this behaves identically to `isWhatsAppUserAllowed`.
175
+ * For the "pairing" policy, this actually checks the PairingService allowlist
176
+ * and creates pairing requests when needed.
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * const result = await checkWhatsAppUserAccess({
181
+ * runtime,
182
+ * identifier: message.from,
183
+ * accountConfig,
184
+ * isGroup: false,
185
+ * metadata: { name: contact.name },
186
+ * });
187
+ *
188
+ * if (!result.allowed) {
189
+ * if (result.replyMessage) {
190
+ * await sendMessage(result.replyMessage);
191
+ * }
192
+ * return; // Block message processing
193
+ * }
194
+ * ```
195
+ */
196
+ export declare function checkWhatsAppUserAccess(params: {
197
+ runtime: IAgentRuntime;
198
+ identifier: string;
199
+ accountConfig: WhatsAppAccountRuntimeConfig;
200
+ isGroup: boolean;
201
+ groupId?: string;
202
+ groupConfig?: WhatsAppGroupRuntimeConfig;
203
+ metadata?: Record<string, string>;
204
+ }): Promise<WhatsAppAccessCheckResult>;
205
+ //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD;;G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AC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,0BAA0B,CAAC;CAC1C,GAAG,OAAO,CA8CV;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,aAAa,EAAE,4BAA4B,CAAC;IAC5C,WAAW,CAAC,EAAE,0BAA0B,CAAC;CAC1C,GAAG,OAAO,CAGV;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,4BAA4B,CAAC;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,0BAA0B,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAkErC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import type { WhatsAppPairingEvent } from "../services/whatsapp-pairing.js";
3
+ export type WhatsAppPairingEventLike = WhatsAppPairingEvent;
4
+ export interface WhatsAppPairingSessionLike {
5
+ start(): Promise<void>;
6
+ stop(): void;
7
+ getStatus(): string;
8
+ }
9
+ export interface WhatsAppRouteState {
10
+ whatsappPairingSessions: Map<string, WhatsAppPairingSessionLike>;
11
+ broadcastWs?: (data: object) => void;
12
+ config: WhatsAppPluginConfig;
13
+ runtime?: {
14
+ getService(type: string): unknown | null;
15
+ };
16
+ saveConfig: () => void;
17
+ workspaceDir: string;
18
+ }
19
+ type OwnerContactEntry = {
20
+ entityId?: string;
21
+ channelId?: string;
22
+ roomId?: string;
23
+ };
24
+ type WhatsAppPluginConfig = Record<string, unknown> & {
25
+ connectors?: Record<string, unknown>;
26
+ agents?: {
27
+ defaults?: {
28
+ ownerContacts?: Record<string, OwnerContactEntry>;
29
+ [key: string]: unknown;
30
+ };
31
+ [key: string]: unknown;
32
+ };
33
+ };
34
+ export interface WhatsAppRouteDeps {
35
+ sanitizeAccountId: (accountId: string) => string;
36
+ whatsappAuthExists: (workspaceDir: string, accountId: string) => boolean;
37
+ whatsappLogout: (workspaceDir: string, accountId: string) => Promise<void>;
38
+ createWhatsAppPairingSession: (options: {
39
+ authDir: string;
40
+ accountId: string;
41
+ onEvent: (event: WhatsAppPairingEventLike) => void;
42
+ }) => WhatsAppPairingSessionLike;
43
+ }
44
+ export declare const MAX_PAIRING_SESSIONS = 10;
45
+ export declare function handleWhatsAppRoute(req: IncomingMessage, res: ServerResponse, pathname: string, method: string, state: WhatsAppRouteState, deps: WhatsAppRouteDeps): Promise<boolean>;
46
+ export declare function applyWhatsAppQrOverride(plugins: {
47
+ id: string;
48
+ validationErrors: unknown[];
49
+ configured: boolean;
50
+ qrConnected?: boolean;
51
+ }[], workspaceDir: string): void;
52
+ export {};
53
+ //# sourceMappingURL=whatsapp-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-routes.d.ts","sourceRoot":"","sources":["../../src/api/whatsapp-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,KAAK,EA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,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACzE,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,4BAA4B,EAAE,CAAC,OAAO,EAAE;QACtC,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;KACpD,KAAK,0BAA0B,CAAC;CAClC;AAWD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAiHvC,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,kBAAkB,EACzB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,OAAO,CAAC,CA6QlB;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE;IACP,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,EAAE,EACH,YAAY,EAAE,MAAM,GACnB,IAAI,CAcN"}
@@ -0,0 +1,10 @@
1
+ import type { AuthenticationState } from "@whiskeysockets/baileys";
2
+ export declare class BaileysAuthManager {
3
+ private readonly authDir;
4
+ private state?;
5
+ private saveCreds?;
6
+ constructor(authDir: string);
7
+ initialize(): Promise<AuthenticationState>;
8
+ save(): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/baileys/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,KAAK,CAAC,CAAsB;IACpC,OAAO,CAAC,SAAS,CAAC,CAAsB;gBAE5B,OAAO,EAAE,MAAM;IAIrB,UAAU,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAO1C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5B"}
@@ -0,0 +1,19 @@
1
+ import { EventEmitter } from "node:events";
2
+ import { type WASocket } from "@whiskeysockets/baileys";
3
+ import type { ConnectionStatus } from "../types";
4
+ import type { BaileysAuthManager } from "./auth";
5
+ export declare class BaileysConnection extends EventEmitter {
6
+ private socket?;
7
+ private readonly authManager;
8
+ private connectionStatus;
9
+ private reconnecting;
10
+ private reconnectAttempts;
11
+ private readonly maxReconnectAttempts;
12
+ constructor(authManager: BaileysAuthManager);
13
+ connect(): Promise<WASocket>;
14
+ private setupEventHandlers;
15
+ getSocket(): WASocket | undefined;
16
+ getStatus(): ConnectionStatus;
17
+ disconnect(): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/baileys/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAqB,EAAoB,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,OAAO,CAAC,MAAM,CAAC,CAAW;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAM;gBAE/B,WAAW,EAAE,kBAAkB;IAKrC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;IAgBlC,OAAO,CAAC,kBAAkB;IAsE1B,SAAS,IAAI,QAAQ,GAAG,SAAS;IAIjC,SAAS,IAAI,gBAAgB;IAIvB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAelC"}
@@ -0,0 +1,14 @@
1
+ import type { proto } from "@whiskeysockets/baileys";
2
+ import type { NormalizedMessage, WhatsAppMessage } from "../types";
3
+ export declare class MessageAdapter {
4
+ toNormalized(msg: proto.IWebMessageInfo): NormalizedMessage;
5
+ toBaileys(msg: WhatsAppMessage): Record<string, unknown>;
6
+ private mediaWithCaption;
7
+ private mediaNoCaption;
8
+ private mediaWithFilename;
9
+ private detectType;
10
+ private extractContent;
11
+ private extractReplyToId;
12
+ private renderTemplate;
13
+ }
14
+ //# sourceMappingURL=message-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-adapter.d.ts","sourceRoot":"","sources":["../../src/baileys/message-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EACV,iBAAiB,EAEjB,eAAe,EAEhB,MAAM,UAAU,CAAC;AAElB,qBAAa,cAAc;IACzB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,eAAe,GAAG,iBAAiB;IAgB3D,SAAS,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAmBxD,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,UAAU;IAqBlB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,cAAc;CAMvB"}
@@ -0,0 +1,6 @@
1
+ import type { QRCodeData } from "../types";
2
+ export declare class QRCodeGenerator {
3
+ generate(qrString: string): Promise<QRCodeData>;
4
+ private generateTerminal;
5
+ }
6
+ //# sourceMappingURL=qr-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qr-code.d.ts","sourceRoot":"","sources":["../../src/baileys/qr-code.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,qBAAa,eAAe;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;YAQvC,gBAAgB;CAO/B"}
@@ -0,0 +1,99 @@
1
+ import { EventEmitter } from "node:events";
2
+ import type { IWhatsAppClient } from "./clients/interface";
3
+ import type { CloudAPIConfig, ConnectionStatus, SendReactionParams, SendReactionResult, WhatsAppMessage, WhatsAppMessageResponse } from "./types";
4
+ interface WhatsAppApiResponse<T> {
5
+ data: T;
6
+ status: number;
7
+ statusText: string;
8
+ headers: Headers;
9
+ }
10
+ export declare class WhatsAppClient extends EventEmitter implements IWhatsAppClient {
11
+ private baseUrl;
12
+ private headers;
13
+ private config;
14
+ private connectionStatus;
15
+ constructor(config: CloudAPIConfig);
16
+ start(): Promise<void>;
17
+ stop(): Promise<void>;
18
+ getConnectionStatus(): ConnectionStatus;
19
+ /**
20
+ * Get the configured phone number ID.
21
+ */
22
+ getPhoneNumberId(): string;
23
+ /**
24
+ * Send a message of any supported type.
25
+ */
26
+ sendMessage(message: WhatsAppMessage): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
27
+ /**
28
+ * Send a text message.
29
+ */
30
+ sendTextMessage(to: string, text: string, _previewUrl?: boolean): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
31
+ /**
32
+ * Send a reaction to a message.
33
+ */
34
+ sendReaction(params: SendReactionParams): Promise<SendReactionResult>;
35
+ /**
36
+ * Remove a reaction from a message (send empty emoji).
37
+ */
38
+ removeReaction(to: string, messageId: string): Promise<SendReactionResult>;
39
+ /**
40
+ * Send an image message.
41
+ */
42
+ sendImage(to: string, imageUrl: string, caption?: string): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
43
+ /**
44
+ * Send a video message.
45
+ */
46
+ sendVideo(to: string, videoUrl: string, caption?: string): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
47
+ /**
48
+ * Send an audio message.
49
+ */
50
+ sendAudio(to: string, audioUrl: string): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
51
+ /**
52
+ * Send a document message.
53
+ */
54
+ sendDocument(to: string, documentUrl: string, filename?: string, caption?: string): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
55
+ /**
56
+ * Send a location message.
57
+ */
58
+ sendLocation(to: string, latitude: number, longitude: number, name?: string, address?: string): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
59
+ /**
60
+ * Send an interactive button message.
61
+ */
62
+ sendButtonMessage(to: string, bodyText: string, buttons: Array<{
63
+ id: string;
64
+ title: string;
65
+ }>, headerText?: string, footerText?: string): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
66
+ /**
67
+ * Send an interactive list message.
68
+ */
69
+ sendListMessage(to: string, bodyText: string, buttonText: string, sections: Array<{
70
+ title?: string;
71
+ rows: Array<{
72
+ id: string;
73
+ title: string;
74
+ description?: string;
75
+ }>;
76
+ }>, headerText?: string, footerText?: string): Promise<WhatsAppApiResponse<WhatsAppMessageResponse>>;
77
+ /**
78
+ * Mark a message as read.
79
+ */
80
+ markMessageAsRead(messageId: string): Promise<boolean>;
81
+ /**
82
+ * Download media by ID.
83
+ */
84
+ getMediaUrl(mediaId: string): Promise<string | null>;
85
+ /**
86
+ * Verify webhook token.
87
+ */
88
+ verifyWebhook(token: string): Promise<boolean>;
89
+ private get;
90
+ private post;
91
+ private request;
92
+ private parseResponseBody;
93
+ /**
94
+ * Build the message payload based on message type.
95
+ */
96
+ private buildMessagePayload;
97
+ }
98
+ export {};
99
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +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,EAClB,QAAQ,EAAE,KAAK,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAClE,CAAC,EACF,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAwBxD;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB5D;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAS1D;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIpD,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,IAAI;YAOE,OAAO;IA6BrB,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAoH5B"}
@@ -0,0 +1,18 @@
1
+ import { EventEmitter } from "node:events";
2
+ import type { BaileysConfig, ConnectionStatus, WhatsAppMessage, WhatsAppMessageResponse } from "../types";
3
+ import type { IWhatsAppClient } from "./interface";
4
+ export declare class BaileysClient extends EventEmitter implements IWhatsAppClient {
5
+ private readonly config;
6
+ private readonly authManager;
7
+ private readonly connection;
8
+ private readonly qrGenerator;
9
+ private readonly adapter;
10
+ constructor(config: BaileysConfig);
11
+ private setupEventForwarding;
12
+ start(): Promise<void>;
13
+ stop(): Promise<void>;
14
+ sendMessage(message: WhatsAppMessage): Promise<WhatsAppMessageResponse>;
15
+ getConnectionStatus(): ConnectionStatus;
16
+ getPhoneNumber(): string | null;
17
+ }
18
+ //# sourceMappingURL=baileys-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baileys-client.d.ts","sourceRoot":"","sources":["../../src/clients/baileys-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,qBAAa,aAAc,SAAQ,YAAa,YAAW,eAAe;IACxE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;gBAE7B,MAAM,EAAE,aAAa;IAUjC,OAAO,CAAC,oBAAoB;IAyCtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAoB7E,mBAAmB,IAAI,gBAAgB;IAIvC,cAAc,IAAI,MAAM,GAAG,IAAI;CAGhC"}
@@ -0,0 +1,6 @@
1
+ import type { WhatsAppConfig } from "../types";
2
+ import type { IWhatsAppClient } from "./interface";
3
+ export declare const ClientFactory: {
4
+ create(config: WhatsAppConfig): IWhatsAppClient;
5
+ };
6
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/clients/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiC,cAAc,EAAE,MAAM,UAAU,CAAC;AAG9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,aAAa;mBACT,cAAc,GAAG,eAAe;CAOhD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { EventEmitter } from "node:events";
2
+ import type { ConnectionStatus, WhatsAppMessage } from "../types";
3
+ export interface IWhatsAppClient extends EventEmitter {
4
+ start(): Promise<void>;
5
+ stop(): Promise<void>;
6
+ sendMessage(message: WhatsAppMessage): Promise<unknown>;
7
+ verifyWebhook?(token: string): Promise<boolean>;
8
+ getConnectionStatus(): ConnectionStatus;
9
+ }
10
+ //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/clients/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAElE,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,mBAAmB,IAAI,gBAAgB,CAAC;CACzC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * WhatsApp plugin configuration types.
3
+ *
4
+ * These types define the configuration schema for the WhatsApp plugin.
5
+ * Shared base types are imported from @elizaos/core.
6
+ */
7
+ import type { BlockStreamingCoalesceConfig, ChannelHeartbeatVisibilityConfig, DmConfig, DmPolicy, GroupPolicy, GroupToolPolicyBySenderConfig, GroupToolPolicyConfig, MarkdownConfig } from "@elizaos/core";
8
+ export type WhatsAppActionConfig = {
9
+ reactions?: boolean;
10
+ sendMessage?: boolean;
11
+ polls?: boolean;
12
+ };
13
+ export type WhatsAppAckReactionConfig = {
14
+ /** Emoji to use for acknowledgment (e.g., "👀"). Empty = disabled. */
15
+ emoji?: string;
16
+ /** Send reactions in direct chats. Default: true. */
17
+ direct?: boolean;
18
+ /**
19
+ * Send reactions in group chats:
20
+ * - "always": react to all group messages
21
+ * - "mentions": react only when bot is mentioned
22
+ * - "never": never react in groups
23
+ * Default: "mentions"
24
+ */
25
+ group?: "always" | "mentions" | "never";
26
+ };
27
+ export type WhatsAppGroupConfig = {
28
+ requireMention?: boolean;
29
+ tools?: GroupToolPolicyConfig;
30
+ toolsBySender?: GroupToolPolicyBySenderConfig;
31
+ };
32
+ export type WhatsAppAccountConfig = {
33
+ /** Optional display name for this account (used in CLI/UI lists). */
34
+ name?: string;
35
+ /** Optional provider capability tags used for agent/runtime guidance. */
36
+ capabilities?: string[];
37
+ /** Markdown formatting overrides (tables). */
38
+ markdown?: MarkdownConfig;
39
+ /** Allow channel-initiated config writes (default: true). */
40
+ configWrites?: boolean;
41
+ /** If false, do not start this WhatsApp account provider. Default: true. */
42
+ enabled?: boolean;
43
+ /** Send read receipts for incoming messages (default true). */
44
+ sendReadReceipts?: boolean;
45
+ /** Inbound message prefix override for this account (WhatsApp only). */
46
+ messagePrefix?: string;
47
+ /** Override auth directory (Baileys multi-file auth state). */
48
+ authDir?: string;
49
+ /** Direct message access policy (default: pairing). */
50
+ dmPolicy?: DmPolicy;
51
+ /** Same-phone setup for this account (bot uses your personal WhatsApp number). */
52
+ selfChatMode?: boolean;
53
+ allowFrom?: string[];
54
+ groupAllowFrom?: string[];
55
+ groupPolicy?: GroupPolicy;
56
+ /** Max group messages to keep as history context (0 disables). */
57
+ historyLimit?: number;
58
+ /** Max DM turns to keep as history context. */
59
+ dmHistoryLimit?: number;
60
+ /** Per-DM config overrides keyed by user ID. */
61
+ dms?: Record<string, DmConfig>;
62
+ textChunkLimit?: number;
63
+ /** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
64
+ chunkMode?: "length" | "newline";
65
+ mediaMaxMb?: number;
66
+ blockStreaming?: boolean;
67
+ /** Merge streamed block replies before sending. */
68
+ blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
69
+ groups?: Record<string, WhatsAppGroupConfig>;
70
+ /** Acknowledgment reaction sent immediately upon message receipt. */
71
+ ackReaction?: WhatsAppAckReactionConfig;
72
+ /** Debounce window (ms) for batching rapid consecutive messages from the same sender (0 to disable). */
73
+ debounceMs?: number;
74
+ /** Heartbeat visibility settings for this account. */
75
+ heartbeat?: ChannelHeartbeatVisibilityConfig;
76
+ };
77
+ export type WhatsAppChannelConfig = {
78
+ /** Optional per-account WhatsApp configuration (multi-account). */
79
+ accounts?: Record<string, WhatsAppAccountConfig>;
80
+ /** Optional provider capability tags used for agent/runtime guidance. */
81
+ capabilities?: string[];
82
+ /** Markdown formatting overrides (tables). */
83
+ markdown?: MarkdownConfig;
84
+ /** Allow channel-initiated config writes (default: true). */
85
+ configWrites?: boolean;
86
+ /** Send read receipts for incoming messages (default true). */
87
+ sendReadReceipts?: boolean;
88
+ /**
89
+ * Inbound message prefix (WhatsApp only).
90
+ * Default: `[{agents.list[].identity.name}]` (or `[otto]`) when allowFrom is empty, else `""`.
91
+ */
92
+ messagePrefix?: string;
93
+ /** Direct message access policy (default: pairing). */
94
+ dmPolicy?: DmPolicy;
95
+ /** Same-phone setup (bot uses your personal WhatsApp number). */
96
+ selfChatMode?: boolean;
97
+ /** Optional allowlist for WhatsApp direct chats (E.164). */
98
+ allowFrom?: string[];
99
+ /** Optional allowlist for WhatsApp group senders (E.164). */
100
+ groupAllowFrom?: string[];
101
+ /**
102
+ * Controls how group messages are handled:
103
+ * - "open": groups bypass allowFrom, only mention-gating applies
104
+ * - "disabled": block all group messages entirely
105
+ * - "allowlist": only allow group messages from senders in groupAllowFrom/allowFrom
106
+ */
107
+ groupPolicy?: GroupPolicy;
108
+ /** Max group messages to keep as history context (0 disables). */
109
+ historyLimit?: number;
110
+ /** Max DM turns to keep as history context. */
111
+ dmHistoryLimit?: number;
112
+ /** Per-DM config overrides keyed by user ID. */
113
+ dms?: Record<string, DmConfig>;
114
+ /** Outbound text chunk size (chars). Default: 4000. */
115
+ textChunkLimit?: number;
116
+ /** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
117
+ chunkMode?: "length" | "newline";
118
+ /** Maximum media file size in MB. Default: 50. */
119
+ mediaMaxMb?: number;
120
+ /** Disable block streaming for this account. */
121
+ blockStreaming?: boolean;
122
+ /** Merge streamed block replies before sending. */
123
+ blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
124
+ /** Per-action tool gating (default: true for all). */
125
+ actions?: WhatsAppActionConfig;
126
+ groups?: Record<string, WhatsAppGroupConfig>;
127
+ /** Acknowledgment reaction sent immediately upon message receipt. */
128
+ ackReaction?: WhatsAppAckReactionConfig;
129
+ /** Debounce window (ms) for batching rapid consecutive messages from the same sender (0 to disable). */
130
+ debounceMs?: number;
131
+ /** Heartbeat visibility settings for this channel. */
132
+ heartbeat?: ChannelHeartbeatVisibilityConfig;
133
+ };
134
+ export type { WhatsAppChannelConfig as WhatsAppConfig };
135
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,4BAA4B,EAC5B,gCAAgC,EAChC,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,6BAA6B,EAC7B,qBAAqB,EACrB,cAAc,EACf,MAAM,eAAe,CAAC;AAMvB,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAMF,MAAM,MAAM,yBAAyB,GAAG;IACtC,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH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