@elizaos/plugin-whatsapp 2.0.0-alpha.4 → 2.0.0-alpha.537

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 (62) hide show
  1. package/README.md +278 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/index.js +2298 -0
  4. package/dist/index.js.map +26 -0
  5. package/dist/src/accounts.d.ts +217 -0
  6. package/dist/src/accounts.d.ts.map +1 -0
  7. package/dist/src/actions/index.d.ts +6 -0
  8. package/dist/src/actions/index.d.ts.map +1 -0
  9. package/dist/src/actions/sendMessage.d.ts +4 -0
  10. package/dist/src/actions/sendMessage.d.ts.map +1 -0
  11. package/dist/src/actions/sendReaction.d.ts +4 -0
  12. package/dist/src/actions/sendReaction.d.ts.map +1 -0
  13. package/dist/src/baileys/auth.d.ts +10 -0
  14. package/dist/src/baileys/auth.d.ts.map +1 -0
  15. package/dist/src/baileys/connection.d.ts +19 -0
  16. package/dist/src/baileys/connection.d.ts.map +1 -0
  17. package/dist/src/baileys/index.d.ts +5 -0
  18. package/dist/src/baileys/index.d.ts.map +1 -0
  19. package/dist/src/baileys/message-adapter.d.ts +14 -0
  20. package/dist/src/baileys/message-adapter.d.ts.map +1 -0
  21. package/dist/src/baileys/qr-code.d.ts +6 -0
  22. package/dist/src/baileys/qr-code.d.ts.map +1 -0
  23. package/dist/src/client.d.ts +139 -0
  24. package/dist/src/client.d.ts.map +1 -0
  25. package/dist/src/clients/baileys-client.d.ts +26 -0
  26. package/dist/src/clients/baileys-client.d.ts.map +1 -0
  27. package/dist/src/clients/factory.d.ts +6 -0
  28. package/dist/src/clients/factory.d.ts.map +1 -0
  29. package/dist/src/clients/index.d.ts +4 -0
  30. package/dist/src/clients/index.d.ts.map +1 -0
  31. package/dist/src/clients/interface.d.ts +10 -0
  32. package/dist/src/clients/interface.d.ts.map +1 -0
  33. package/dist/src/config.d.ts +144 -0
  34. package/dist/src/config.d.ts.map +1 -0
  35. package/dist/src/handlers/index.d.ts +3 -0
  36. package/dist/src/handlers/index.d.ts.map +1 -0
  37. package/dist/src/handlers/message.handler.d.ts +8 -0
  38. package/dist/src/handlers/message.handler.d.ts.map +1 -0
  39. package/dist/src/handlers/webhook.handler.d.ts +7 -0
  40. package/dist/src/handlers/webhook.handler.d.ts.map +1 -0
  41. package/dist/src/index.d.ts +62 -0
  42. package/dist/src/index.d.ts.map +1 -0
  43. package/dist/src/normalize.d.ts +72 -0
  44. package/dist/src/normalize.d.ts.map +1 -0
  45. package/dist/src/pairing-service.d.ts +54 -0
  46. package/dist/src/pairing-service.d.ts.map +1 -0
  47. package/dist/src/runtime-service.d.ts +50 -0
  48. package/dist/src/runtime-service.d.ts.map +1 -0
  49. package/dist/src/service.d.ts +157 -0
  50. package/dist/src/service.d.ts.map +1 -0
  51. package/dist/src/setup-routes.d.ts +26 -0
  52. package/dist/src/setup-routes.d.ts.map +1 -0
  53. package/dist/src/types.d.ts +396 -0
  54. package/dist/src/types.d.ts.map +1 -0
  55. package/dist/src/utils/config-detector.d.ts +5 -0
  56. package/dist/src/utils/config-detector.d.ts.map +1 -0
  57. package/dist/src/utils/index.d.ts +3 -0
  58. package/dist/src/utils/index.d.ts.map +1 -0
  59. package/dist/src/utils/validators.d.ts +14 -0
  60. package/dist/src/utils/validators.d.ts.map +1 -0
  61. package/package.json +84 -14
  62. package/dist/index.d.ts +0 -2
@@ -0,0 +1,144 @@
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 {
8
+ BlockStreamingCoalesceConfig,
9
+ ChannelHeartbeatVisibilityConfig,
10
+ DmConfig,
11
+ DmPolicy,
12
+ GroupPolicy,
13
+ GroupToolPolicyBySenderConfig,
14
+ GroupToolPolicyConfig,
15
+ MarkdownConfig,
16
+ } from "@elizaos/core";
17
+ export type WhatsAppActionConfig = {
18
+ reactions?: boolean;
19
+ sendMessage?: boolean;
20
+ polls?: boolean;
21
+ };
22
+ export type WhatsAppAckReactionConfig = {
23
+ /** Emoji to use for acknowledgment (e.g., "👀"). Empty = disabled. */
24
+ emoji?: string;
25
+ /** Send reactions in direct chats. Default: true. */
26
+ direct?: boolean;
27
+ /**
28
+ * Send reactions in group chats:
29
+ * - "always": react to all group messages
30
+ * - "mentions": react only when bot is mentioned
31
+ * - "never": never react in groups
32
+ * Default: "mentions"
33
+ */
34
+ group?: "always" | "mentions" | "never";
35
+ };
36
+ export type WhatsAppGroupConfig = {
37
+ requireMention?: boolean;
38
+ tools?: GroupToolPolicyConfig;
39
+ toolsBySender?: GroupToolPolicyBySenderConfig;
40
+ };
41
+ export type WhatsAppAccountConfig = {
42
+ /** Optional display name for this account (used in CLI/UI lists). */
43
+ name?: string;
44
+ /** Optional provider capability tags used for agent/runtime guidance. */
45
+ capabilities?: string[];
46
+ /** Markdown formatting overrides (tables). */
47
+ markdown?: MarkdownConfig;
48
+ /** Allow channel-initiated config writes (default: true). */
49
+ configWrites?: boolean;
50
+ /** If false, do not start this WhatsApp account provider. Default: true. */
51
+ enabled?: boolean;
52
+ /** Send read receipts for incoming messages (default true). */
53
+ sendReadReceipts?: boolean;
54
+ /** Inbound message prefix override for this account (WhatsApp only). */
55
+ messagePrefix?: string;
56
+ /** Override auth directory (Baileys multi-file auth state). */
57
+ authDir?: string;
58
+ /** Direct message access policy (default: pairing). */
59
+ dmPolicy?: DmPolicy;
60
+ /** Same-phone setup for this account (bot uses your personal WhatsApp number). */
61
+ selfChatMode?: boolean;
62
+ allowFrom?: string[];
63
+ groupAllowFrom?: string[];
64
+ groupPolicy?: GroupPolicy;
65
+ /** Max group messages to keep as history context (0 disables). */
66
+ historyLimit?: number;
67
+ /** Max DM turns to keep as history context. */
68
+ dmHistoryLimit?: number;
69
+ /** Per-DM config overrides keyed by user ID. */
70
+ dms?: Record<string, DmConfig>;
71
+ textChunkLimit?: number;
72
+ /** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
73
+ chunkMode?: "length" | "newline";
74
+ mediaMaxMb?: number;
75
+ blockStreaming?: boolean;
76
+ /** Merge streamed block replies before sending. */
77
+ blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
78
+ groups?: Record<string, WhatsAppGroupConfig>;
79
+ /** Acknowledgment reaction sent immediately upon message receipt. */
80
+ ackReaction?: WhatsAppAckReactionConfig;
81
+ /** Debounce window (ms) for batching rapid consecutive messages from the same sender (0 to disable). */
82
+ debounceMs?: number;
83
+ /** Heartbeat visibility settings for this account. */
84
+ heartbeat?: ChannelHeartbeatVisibilityConfig;
85
+ };
86
+ export type WhatsAppChannelConfig = {
87
+ /** Optional per-account WhatsApp configuration (multi-account). */
88
+ accounts?: Record<string, WhatsAppAccountConfig>;
89
+ /** Optional provider capability tags used for agent/runtime guidance. */
90
+ capabilities?: string[];
91
+ /** Markdown formatting overrides (tables). */
92
+ markdown?: MarkdownConfig;
93
+ /** Allow channel-initiated config writes (default: true). */
94
+ configWrites?: boolean;
95
+ /** Send read receipts for incoming messages (default true). */
96
+ sendReadReceipts?: boolean;
97
+ /**
98
+ * Inbound message prefix (WhatsApp only).
99
+ * Default: `[{agents.list[].identity.name}]` (or `[otto]`) when allowFrom is empty, else `""`.
100
+ */
101
+ messagePrefix?: string;
102
+ /** Direct message access policy (default: pairing). */
103
+ dmPolicy?: DmPolicy;
104
+ /** Same-phone setup (bot uses your personal WhatsApp number). */
105
+ selfChatMode?: boolean;
106
+ /** Optional allowlist for WhatsApp direct chats (E.164). */
107
+ allowFrom?: string[];
108
+ /** Optional allowlist for WhatsApp group senders (E.164). */
109
+ groupAllowFrom?: string[];
110
+ /**
111
+ * Controls how group messages are handled:
112
+ * - "open": groups bypass allowFrom, only mention-gating applies
113
+ * - "disabled": block all group messages entirely
114
+ * - "allowlist": only allow group messages from senders in groupAllowFrom/allowFrom
115
+ */
116
+ groupPolicy?: GroupPolicy;
117
+ /** Max group messages to keep as history context (0 disables). */
118
+ historyLimit?: number;
119
+ /** Max DM turns to keep as history context. */
120
+ dmHistoryLimit?: number;
121
+ /** Per-DM config overrides keyed by user ID. */
122
+ dms?: Record<string, DmConfig>;
123
+ /** Outbound text chunk size (chars). Default: 4000. */
124
+ textChunkLimit?: number;
125
+ /** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
126
+ chunkMode?: "length" | "newline";
127
+ /** Maximum media file size in MB. Default: 50. */
128
+ mediaMaxMb?: number;
129
+ /** Disable block streaming for this account. */
130
+ blockStreaming?: boolean;
131
+ /** Merge streamed block replies before sending. */
132
+ blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
133
+ /** Per-action tool gating (default: true for all). */
134
+ actions?: WhatsAppActionConfig;
135
+ groups?: Record<string, WhatsAppGroupConfig>;
136
+ /** Acknowledgment reaction sent immediately upon message receipt. */
137
+ ackReaction?: WhatsAppAckReactionConfig;
138
+ /** Debounce window (ms) for batching rapid consecutive messages from the same sender (0 to disable). */
139
+ debounceMs?: number;
140
+ /** Heartbeat visibility settings for this channel. */
141
+ heartbeat?: ChannelHeartbeatVisibilityConfig;
142
+ };
143
+ export type { WhatsAppChannelConfig as WhatsAppConfig };
144
+ //# 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;IAC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,CAAC;IAC/B,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,SAAS,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACjC,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,sBAAsB,CAAC,EAAE,4BAA4B,CAAC;IACtD,sDAAsD;IACtD,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC7C,qEAAqE;IACrE,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,SAAS,CAAC,EAAE,gCAAgC,CAAC;CAC9C,CAAC;AAGF,YAAY,EAAE,qBAAqB,IAAI,cAAc,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./message.handler";
2
+ export * from "./webhook.handler";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { IWhatsAppClient } from "../clients/interface";
2
+ import type { WhatsAppMessage, WhatsAppMessageResponse } from "../types";
3
+ export declare class MessageHandler {
4
+ private client;
5
+ constructor(client: IWhatsAppClient);
6
+ send(message: WhatsAppMessage): Promise<WhatsAppMessageResponse>;
7
+ }
8
+ //# sourceMappingURL=message.handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/message.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEzE,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAErC,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAcvE"}
@@ -0,0 +1,7 @@
1
+ import type { WhatsAppWebhookEvent } from "../types";
2
+ export declare class WebhookHandler {
3
+ handle(event: WhatsAppWebhookEvent): Promise<void>;
4
+ private handleMessage;
5
+ private handleStatus;
6
+ }
7
+ //# sourceMappingURL=webhook.handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/webhook.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiD,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEpG,qBAAa,cAAc;IACnB,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;YAyB1C,aAAa;YAMb,YAAY;CAK3B"}
@@ -0,0 +1,62 @@
1
+ import type { Plugin } from "@elizaos/core";
2
+ declare const whatsappPlugin: Plugin;
3
+ export default whatsappPlugin;
4
+ export {
5
+ checkWhatsAppUserAccess,
6
+ DEFAULT_ACCOUNT_ID,
7
+ isMultiAccountEnabled,
8
+ isWhatsAppMentionRequired,
9
+ isWhatsAppUserAllowed,
10
+ listEnabledWhatsAppAccounts,
11
+ listWhatsAppAccountIds,
12
+ normalizeAccountId,
13
+ type ResolvedWhatsAppAccount,
14
+ resolveDefaultWhatsAppAccountId,
15
+ resolveWhatsAppAccount,
16
+ resolveWhatsAppGroupConfig,
17
+ resolveWhatsAppToken,
18
+ type WhatsAppAccessCheckResult,
19
+ type WhatsAppAccountRuntimeConfig,
20
+ type WhatsAppGroupRuntimeConfig,
21
+ type WhatsAppMultiAccountConfig,
22
+ type WhatsAppTokenResolution,
23
+ type WhatsAppTokenSource,
24
+ } from "./accounts";
25
+ export { ClientFactory } from "./clients/factory";
26
+ export type {
27
+ WhatsAppAccountConfig,
28
+ WhatsAppAckReactionConfig,
29
+ WhatsAppActionConfig,
30
+ WhatsAppChannelConfig,
31
+ WhatsAppGroupConfig,
32
+ } from "./config";
33
+ export {
34
+ buildWhatsAppUserJid,
35
+ type ChunkWhatsAppTextOpts,
36
+ chunkWhatsAppText,
37
+ formatWhatsAppId,
38
+ formatWhatsAppPhoneNumber,
39
+ getWhatsAppChatType,
40
+ isValidWhatsAppNumber,
41
+ isWhatsAppGroup,
42
+ isWhatsAppGroupJid,
43
+ isWhatsAppUserTarget,
44
+ normalizeE164,
45
+ normalizeWhatsAppTarget,
46
+ resolveWhatsAppSystemLocation,
47
+ truncateText,
48
+ WHATSAPP_TEXT_CHUNK_LIMIT,
49
+ } from "./normalize";
50
+ export {
51
+ sanitizeAccountId as sanitizeWhatsAppAccountId,
52
+ type WhatsAppPairingEvent,
53
+ type WhatsAppPairingOptions,
54
+ WhatsAppPairingSession,
55
+ type WhatsAppPairingStatus,
56
+ whatsappAuthExists,
57
+ whatsappLogout,
58
+ } from "./pairing-service";
59
+ export { WhatsAppConnectorService } from "./runtime-service";
60
+ export { stopAllPairingSessions, whatsappSetupRoutes } from "./setup-routes";
61
+ export * from "./types";
62
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,QAAA,MAAM,cAAc,EAAE,MAMrB,CAAC;AAEF,eAAe,cAAc,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,+BAA+B,EAC/B,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,6BAA6B,EAC7B,YAAY,EACZ,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,IAAI,yBAAyB,EAC9C,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,kBAAkB,EAClB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,cAAc,SAAS,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * WhatsApp text chunk limit
3
+ */
4
+ export declare const WHATSAPP_TEXT_CHUNK_LIMIT = 4096;
5
+ /**
6
+ * Normalizes a phone number to E.164 format
7
+ */
8
+ export declare function normalizeE164(input: string): string;
9
+ /**
10
+ * Checks if a value is a WhatsApp group JID (e.g., "123456789-987654321@g.us")
11
+ */
12
+ export declare function isWhatsAppGroupJid(value: string): boolean;
13
+ /**
14
+ * Checks if a value looks like a WhatsApp user target
15
+ * (e.g., "41796666864:0@s.whatsapp.net" or "123@lid")
16
+ */
17
+ export declare function isWhatsAppUserTarget(value: string): boolean;
18
+ /**
19
+ * Normalizes a WhatsApp target (phone number, user JID, or group JID)
20
+ * Returns null if the target is invalid
21
+ */
22
+ export declare function normalizeWhatsAppTarget(value: string): string | null;
23
+ /**
24
+ * Formats a WhatsApp ID for display
25
+ */
26
+ export declare function formatWhatsAppId(id: string): string;
27
+ /**
28
+ * Checks if a WhatsApp ID is a group
29
+ */
30
+ export declare function isWhatsAppGroup(id: string): boolean;
31
+ /**
32
+ * Gets the chat type from a WhatsApp ID
33
+ */
34
+ export declare function getWhatsAppChatType(id: string): "group" | "user";
35
+ /**
36
+ * Builds a WhatsApp JID from a phone number
37
+ */
38
+ export declare function buildWhatsAppUserJid(phoneNumber: string): string;
39
+ /**
40
+ * Options for text chunking
41
+ */
42
+ export interface ChunkWhatsAppTextOpts {
43
+ limit?: number;
44
+ }
45
+ /**
46
+ * Chunks text for WhatsApp messages
47
+ */
48
+ export declare function chunkWhatsAppText(
49
+ text: string,
50
+ opts?: ChunkWhatsAppTextOpts,
51
+ ): string[];
52
+ /**
53
+ * Truncates text to a maximum length with ellipsis
54
+ */
55
+ export declare function truncateText(text: string, maxLength: number): string;
56
+ /**
57
+ * Resolves the system location string for logging
58
+ */
59
+ export declare function resolveWhatsAppSystemLocation(params: {
60
+ chatType: "group" | "user";
61
+ chatId: string;
62
+ chatName?: string;
63
+ }): string;
64
+ /**
65
+ * Validates a WhatsApp phone number
66
+ */
67
+ export declare function isValidWhatsAppNumber(value: string): boolean;
68
+ /**
69
+ * Formats a phone number for WhatsApp display
70
+ */
71
+ export declare function formatWhatsAppPhoneNumber(phoneNumber: string): string;
72
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/normalize.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;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B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAcrE"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * WhatsApp pairing service — manages Baileys sessions for QR code authentication.
3
+ *
4
+ * This service is separate from the main WhatsApp plugin because the plugin
5
+ * initializes during runtime startup (too late for interactive QR flow).
6
+ * Once pairing succeeds, the auth state is persisted to disk so the plugin
7
+ * can reconnect automatically on subsequent startups.
8
+ */
9
+ /** Validate accountId to prevent path traversal. Only allows alphanumeric, dash, underscore. */
10
+ export declare function sanitizeAccountId(raw: string): string;
11
+ export type WhatsAppPairingStatus =
12
+ | "idle"
13
+ | "initializing"
14
+ | "waiting_for_qr"
15
+ | "connected"
16
+ | "disconnected"
17
+ | "timeout"
18
+ | "error";
19
+ export interface WhatsAppPairingEvent {
20
+ type: "whatsapp-qr" | "whatsapp-status";
21
+ accountId: string;
22
+ qrDataUrl?: string;
23
+ expiresInMs?: number;
24
+ status?: WhatsAppPairingStatus;
25
+ phoneNumber?: string;
26
+ error?: string;
27
+ }
28
+ export interface WhatsAppPairingOptions {
29
+ authDir: string;
30
+ accountId: string;
31
+ onEvent: (event: WhatsAppPairingEvent) => void;
32
+ }
33
+ export declare class WhatsAppPairingSession {
34
+ private socket;
35
+ private status;
36
+ private options;
37
+ private qrAttempts;
38
+ private readonly MAX_QR_ATTEMPTS;
39
+ private restartTimer;
40
+ constructor(options: WhatsAppPairingOptions);
41
+ start(): Promise<void>;
42
+ stop(): void;
43
+ getStatus(): WhatsAppPairingStatus;
44
+ private setStatus;
45
+ }
46
+ export declare function whatsappAuthExists(
47
+ workspaceDir: string,
48
+ accountId?: string,
49
+ ): boolean;
50
+ export declare function whatsappLogout(
51
+ workspaceDir: string,
52
+ accountId?: string,
53
+ ): Promise<void>;
54
+ //# sourceMappingURL=pairing-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pairing-service.d.ts","sourceRoot":"","sources":["../../src/pairing-service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG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{ type IAgentRuntime, Service } from "@elizaos/core";
2
+ import type { WhatsAppMessageResponse, WhatsAppWebhookEvent } from "./types";
3
+ type RuntimeServiceConfig =
4
+ | {
5
+ transport: "baileys";
6
+ authDir: string;
7
+ dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
8
+ groupPolicy?: "open" | "allowlist" | "disabled";
9
+ allowFrom?: string[];
10
+ groupAllowFrom?: string[];
11
+ }
12
+ | {
13
+ transport: "cloudapi";
14
+ accessToken: string;
15
+ phoneNumberId: string;
16
+ webhookVerifyToken?: string;
17
+ apiVersion?: string;
18
+ dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
19
+ groupPolicy?: "open" | "allowlist" | "disabled";
20
+ allowFrom?: string[];
21
+ groupAllowFrom?: string[];
22
+ };
23
+ export declare class WhatsAppConnectorService extends Service {
24
+ static serviceType: string;
25
+ protected runtime: IAgentRuntime;
26
+ capabilityDescription: string;
27
+ connected: boolean;
28
+ phoneNumber: string | null;
29
+ private client;
30
+ config: RuntimeServiceConfig | null;
31
+ constructor(runtime?: IAgentRuntime);
32
+ static start(runtime: IAgentRuntime): Promise<WhatsAppConnectorService>;
33
+ initialize(): Promise<void>;
34
+ stop(): Promise<void>;
35
+ handleWebhook(event: WhatsAppWebhookEvent): Promise<void>;
36
+ verifyWebhook(mode: string, token: string, challenge: string): string | null;
37
+ private bindClientEvents;
38
+ private handleNormalizedMessage;
39
+ private handleIncomingWebhookMessage;
40
+ private processIncomingMessage;
41
+ private sendTextMessage;
42
+ sendMessage(message: {
43
+ type: "text";
44
+ to: string;
45
+ content: string;
46
+ replyToMessageId?: string;
47
+ }): Promise<WhatsAppMessageResponse>;
48
+ }
49
+ export {};
50
+ //# sourceMappingURL=runtime-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-service.d.ts","sourceRoot":"","sources":["../../src/runtime-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAGlB,OAAO,EAER,MAAM,eAAe,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AAC,IAAI,CAAC;IAQrB,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAe/D,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAa5E,OAAO,CAAC,gBAAgB;YA6CV,uBAAuB;YAmBvB,4BAA4B;YAkB5B,sBAAsB;YAiLtB,eAAe;IAwBvB,WAAW,CAAC,OAAO,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAGrC"}
@@ -0,0 +1,157 @@
1
+ import { WhatsAppClient } from "./client";
2
+ import type {
3
+ CloudAPIConfig,
4
+ SendReactionParams,
5
+ SendReactionResult,
6
+ WhatsAppEventType,
7
+ WhatsAppMessage,
8
+ WhatsAppMessageResponse,
9
+ WhatsAppWebhookEvent,
10
+ } from "./types";
11
+ type EventHandler = (payload: unknown) => void | Promise<void>;
12
+ /**
13
+ * WhatsApp service for ElizaOS.
14
+ * Provides comprehensive WhatsApp Cloud API integration.
15
+ */
16
+ export declare class WhatsAppService {
17
+ static readonly serviceType = "whatsapp";
18
+ private config;
19
+ private client;
20
+ private messageHandler;
21
+ private webhookHandler;
22
+ private running;
23
+ private eventHandlers;
24
+ constructor(config: CloudAPIConfig);
25
+ /**
26
+ * Create service from environment variables.
27
+ */
28
+ static fromEnv(): WhatsAppService;
29
+ /**
30
+ * Get the underlying client.
31
+ */
32
+ getClient(): WhatsAppClient;
33
+ /**
34
+ * Start the WhatsApp service.
35
+ */
36
+ start(): Promise<void>;
37
+ /**
38
+ * Stop the WhatsApp service.
39
+ */
40
+ stop(): Promise<void>;
41
+ /**
42
+ * Check if the service is running.
43
+ */
44
+ isRunning(): boolean;
45
+ /**
46
+ * Register an event handler.
47
+ */
48
+ onEvent(eventType: WhatsAppEventType, handler: EventHandler): void;
49
+ /**
50
+ * Handle a webhook event.
51
+ */
52
+ handleWebhook(event: WhatsAppWebhookEvent): Promise<void>;
53
+ /**
54
+ * Verify a webhook subscription request.
55
+ */
56
+ verifyWebhook(mode: string, token: string, challenge: string): string | null;
57
+ /**
58
+ * Verify webhook payload signature.
59
+ */
60
+ verifyWebhookSignature(payload: Buffer | string, signature: string): boolean;
61
+ /**
62
+ * Send a message of any type.
63
+ */
64
+ sendMessage(message: WhatsAppMessage): Promise<WhatsAppMessageResponse>;
65
+ /**
66
+ * Send a text message.
67
+ */
68
+ sendText(to: string, text: string): Promise<WhatsAppMessageResponse>;
69
+ /**
70
+ * Send a reaction to a message.
71
+ */
72
+ sendReaction(params: SendReactionParams): Promise<SendReactionResult>;
73
+ /**
74
+ * Remove a reaction from a message.
75
+ */
76
+ removeReaction(to: string, messageId: string): Promise<SendReactionResult>;
77
+ /**
78
+ * Send an image message.
79
+ */
80
+ sendImage(
81
+ to: string,
82
+ imageUrl: string,
83
+ caption?: string,
84
+ ): Promise<WhatsAppMessageResponse>;
85
+ /**
86
+ * Send a video message.
87
+ */
88
+ sendVideo(
89
+ to: string,
90
+ videoUrl: string,
91
+ caption?: string,
92
+ ): Promise<WhatsAppMessageResponse>;
93
+ /**
94
+ * Send an audio message.
95
+ */
96
+ sendAudio(to: string, audioUrl: string): Promise<WhatsAppMessageResponse>;
97
+ /**
98
+ * Send a document message.
99
+ */
100
+ sendDocument(
101
+ to: string,
102
+ documentUrl: string,
103
+ filename?: string,
104
+ caption?: string,
105
+ ): Promise<WhatsAppMessageResponse>;
106
+ /**
107
+ * Send a location message.
108
+ */
109
+ sendLocation(
110
+ to: string,
111
+ latitude: number,
112
+ longitude: number,
113
+ name?: string,
114
+ address?: string,
115
+ ): Promise<WhatsAppMessageResponse>;
116
+ /**
117
+ * Send an interactive button message.
118
+ */
119
+ sendButtonMessage(
120
+ to: string,
121
+ bodyText: string,
122
+ buttons: Array<{
123
+ id: string;
124
+ title: string;
125
+ }>,
126
+ headerText?: string,
127
+ footerText?: string,
128
+ ): Promise<WhatsAppMessageResponse>;
129
+ /**
130
+ * Send an interactive list message.
131
+ */
132
+ sendListMessage(
133
+ to: string,
134
+ bodyText: string,
135
+ buttonText: string,
136
+ sections: Array<{
137
+ title?: string;
138
+ rows: Array<{
139
+ id: string;
140
+ title: string;
141
+ description?: string;
142
+ }>;
143
+ }>,
144
+ headerText?: string,
145
+ footerText?: string,
146
+ ): Promise<WhatsAppMessageResponse>;
147
+ /**
148
+ * Mark a message as read.
149
+ */
150
+ markAsRead(messageId: string): Promise<boolean>;
151
+ /**
152
+ * Get the download URL for a media file.
153
+ */
154
+ getMediaUrl(mediaId: string): Promise<string | null>;
155
+ }
156
+ export {};
157
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,KAAK,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/D;;;GAGG;AACH,qBAAa,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,WAAW,cAAc;IAEzC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAqD;gBAE9D,MAAM,EAAE,cAAc;IAOlC;;OAEG;IACH,MAAM,CAAC,OA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IrD;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAG3D"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * WhatsApp setup HTTP routes.
3
+ *
4
+ * Provides QR-code pairing, status, disconnect, and webhook endpoints:
5
+ *
6
+ * GET /api/whatsapp/webhook Meta webhook verification
7
+ * POST /api/whatsapp/webhook Meta webhook event delivery
8
+ * POST /api/whatsapp/pair Start QR pairing session
9
+ * GET /api/whatsapp/status Check connection / pairing status
10
+ * POST /api/whatsapp/pair/stop Stop active pairing session
11
+ * POST /api/whatsapp/disconnect Logout + remove auth state
12
+ *
13
+ * These routes are registered with `rawPath: true` so they mount at their
14
+ * legacy paths without the plugin-name prefix.
15
+ */
16
+ import type { Route } from "@elizaos/core";
17
+ /**
18
+ * Plugin routes for WhatsApp setup and webhooks.
19
+ * Registered with `rawPath: true` to preserve legacy `/api/whatsapp/*` paths.
20
+ */
21
+ export declare const whatsappSetupRoutes: Route[];
22
+ /**
23
+ * Stop all active pairing sessions. Called during shutdown cleanup.
24
+ */
25
+ export declare function stopAllPairingSessions(): void;
26
+ //# sourceMappingURL=setup-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-routes.d.ts","sourceRoot":"","sources":["../../src/setup-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAiB,KAAK,EAA+B,MAAM,eAAe,CAAC;AA0VvF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,EAyCtC,CAAC;AAEF;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAS7C"}