machinaos 0.0.1 → 0.0.7
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/.env.template +71 -71
- package/LICENSE +21 -21
- package/README.md +163 -87
- package/bin/cli.js +62 -106
- package/client/.dockerignore +45 -45
- package/client/Dockerfile +68 -68
- package/client/dist/assets/index-DFSC53FP.css +1 -0
- package/client/dist/assets/index-fJ-1gTf5.js +613 -0
- package/client/dist/index.html +14 -0
- package/client/eslint.config.js +34 -16
- package/client/nginx.conf +66 -66
- package/client/package.json +61 -48
- package/client/src/App.tsx +27 -27
- package/client/src/Dashboard.tsx +1200 -1172
- package/client/src/ParameterPanel.tsx +302 -300
- package/client/src/components/AIAgentNode.tsx +315 -321
- package/client/src/components/APIKeyValidator.tsx +117 -117
- package/client/src/components/ClaudeChatModelNode.tsx +17 -17
- package/client/src/components/CredentialsModal.tsx +1200 -306
- package/client/src/components/GeminiChatModelNode.tsx +17 -17
- package/client/src/components/GenericNode.tsx +356 -356
- package/client/src/components/LocationParameterPanel.tsx +153 -153
- package/client/src/components/ModelNode.tsx +285 -285
- package/client/src/components/OpenAIChatModelNode.tsx +17 -17
- package/client/src/components/OutputPanel.tsx +470 -470
- package/client/src/components/ParameterRenderer.tsx +1873 -1873
- package/client/src/components/SkillEditorModal.tsx +3 -3
- package/client/src/components/SquareNode.tsx +812 -796
- package/client/src/components/ToolkitNode.tsx +365 -365
- package/client/src/components/auth/LoginPage.tsx +247 -247
- package/client/src/components/auth/ProtectedRoute.tsx +59 -59
- package/client/src/components/base/BaseChatModelNode.tsx +270 -270
- package/client/src/components/icons/AIProviderIcons.tsx +50 -50
- package/client/src/components/maps/GoogleMapsPicker.tsx +136 -136
- package/client/src/components/maps/MapsPreviewPanel.tsx +109 -109
- package/client/src/components/maps/index.ts +25 -25
- package/client/src/components/parameterPanel/InputSection.tsx +1094 -1094
- package/client/src/components/parameterPanel/LocationPanelLayout.tsx +64 -64
- package/client/src/components/parameterPanel/MapsSection.tsx +91 -91
- package/client/src/components/parameterPanel/MiddleSection.tsx +867 -571
- package/client/src/components/parameterPanel/OutputSection.tsx +80 -80
- package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +81 -81
- package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -436
- package/client/src/components/parameterPanel/index.ts +41 -41
- package/client/src/components/shared/DataPanel.tsx +142 -142
- package/client/src/components/shared/JSONTreeRenderer.tsx +105 -105
- package/client/src/components/ui/AIResultModal.tsx +203 -203
- package/client/src/components/ui/ApiKeyInput.tsx +93 -0
- package/client/src/components/ui/CodeEditor.tsx +81 -81
- package/client/src/components/ui/CollapsibleSection.tsx +87 -87
- package/client/src/components/ui/ComponentItem.tsx +153 -153
- package/client/src/components/ui/ComponentPalette.tsx +320 -320
- package/client/src/components/ui/ConsolePanel.tsx +151 -43
- package/client/src/components/ui/ErrorBoundary.tsx +195 -195
- package/client/src/components/ui/InputNodesPanel.tsx +203 -203
- package/client/src/components/ui/MapSelector.tsx +313 -313
- package/client/src/components/ui/Modal.tsx +151 -148
- package/client/src/components/ui/NodeOutputPanel.tsx +1150 -1150
- package/client/src/components/ui/OutputDisplayPanel.tsx +381 -381
- package/client/src/components/ui/QRCodeDisplay.tsx +182 -0
- package/client/src/components/ui/TopToolbar.tsx +736 -736
- package/client/src/components/ui/WorkflowSidebar.tsx +293 -293
- package/client/src/config/antdTheme.ts +186 -186
- package/client/src/contexts/AuthContext.tsx +221 -221
- package/client/src/contexts/ThemeContext.tsx +42 -42
- package/client/src/contexts/WebSocketContext.tsx +2144 -1971
- package/client/src/factories/baseChatModelFactory.ts +255 -255
- package/client/src/hooks/useAndroidOperations.ts +118 -164
- package/client/src/hooks/useApiKeyValidation.ts +106 -106
- package/client/src/hooks/useApiKeys.ts +238 -238
- package/client/src/hooks/useAppTheme.ts +17 -17
- package/client/src/hooks/useComponentPalette.ts +50 -50
- package/client/src/hooks/useDragAndDrop.ts +123 -123
- package/client/src/hooks/useDragVariable.ts +88 -88
- package/client/src/hooks/useExecution.ts +319 -313
- package/client/src/hooks/useParameterPanel.ts +176 -176
- package/client/src/hooks/useReactFlowNodes.ts +188 -188
- package/client/src/hooks/useToolSchema.ts +209 -209
- package/client/src/hooks/useWhatsApp.ts +196 -196
- package/client/src/hooks/useWorkflowManagement.ts +45 -45
- package/client/src/index.css +314 -314
- package/client/src/nodeDefinitions/aiAgentNodes.ts +335 -335
- package/client/src/nodeDefinitions/aiModelNodes.ts +340 -340
- package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -383
- package/client/src/nodeDefinitions/chatNodes.ts +135 -135
- package/client/src/nodeDefinitions/codeNodes.ts +54 -54
- package/client/src/nodeDefinitions/index.ts +14 -14
- package/client/src/nodeDefinitions/locationNodes.ts +462 -462
- package/client/src/nodeDefinitions/schedulerNodes.ts +220 -220
- package/client/src/nodeDefinitions/skillNodes.ts +17 -5
- package/client/src/nodeDefinitions/utilityNodes.ts +284 -284
- package/client/src/nodeDefinitions/whatsappNodes.ts +821 -865
- package/client/src/nodeDefinitions.ts +101 -103
- package/client/src/services/dynamicParameterService.ts +95 -95
- package/client/src/services/execution/aiAgentExecutionService.ts +34 -34
- package/client/src/services/executionService.ts +227 -231
- package/client/src/services/workflowApi.ts +91 -91
- package/client/src/store/useAppStore.ts +578 -581
- package/client/src/styles/theme.ts +513 -508
- package/client/src/styles/zIndex.ts +16 -16
- package/client/src/types/ComponentTypes.ts +38 -38
- package/client/src/types/INodeProperties.ts +287 -287
- package/client/src/types/NodeTypes.ts +27 -27
- package/client/src/utils/formatters.ts +32 -32
- package/client/src/utils/googleMapsLoader.ts +139 -139
- package/client/src/utils/locationUtils.ts +84 -84
- package/client/src/utils/nodeUtils.ts +30 -30
- package/client/src/utils/workflow.ts +29 -29
- package/client/src/vite-env.d.ts +12 -12
- package/client/tailwind.config.js +59 -59
- package/client/tsconfig.json +25 -25
- package/client/vite.config.js +35 -35
- package/install.ps1 +308 -0
- package/install.sh +343 -0
- package/package.json +81 -70
- package/scripts/build.js +174 -51
- package/scripts/clean.js +40 -40
- package/scripts/start.js +234 -210
- package/scripts/stop.js +301 -325
- package/server/.dockerignore +44 -44
- package/server/Dockerfile +45 -45
- package/server/constants.py +244 -249
- package/server/core/cache.py +460 -460
- package/server/core/config.py +127 -127
- package/server/core/container.py +98 -98
- package/server/core/database.py +1296 -1210
- package/server/core/logging.py +313 -313
- package/server/main.py +288 -288
- package/server/middleware/__init__.py +5 -5
- package/server/middleware/auth.py +89 -89
- package/server/models/auth.py +52 -52
- package/server/models/cache.py +24 -24
- package/server/models/database.py +235 -210
- package/server/models/nodes.py +435 -455
- package/server/pyproject.toml +75 -72
- package/server/requirements.txt +83 -83
- package/server/routers/android.py +294 -294
- package/server/routers/auth.py +203 -203
- package/server/routers/database.py +150 -150
- package/server/routers/maps.py +141 -141
- package/server/routers/nodejs_compat.py +288 -288
- package/server/routers/webhook.py +90 -90
- package/server/routers/websocket.py +2239 -2127
- package/server/routers/whatsapp.py +761 -761
- package/server/routers/workflow.py +199 -199
- package/server/services/ai.py +2444 -2414
- package/server/services/android_service.py +588 -588
- package/server/services/auth.py +130 -130
- package/server/services/chat_client.py +160 -160
- package/server/services/deployment/manager.py +706 -706
- package/server/services/event_waiter.py +675 -785
- package/server/services/execution/executor.py +1351 -1351
- package/server/services/execution/models.py +1 -1
- package/server/services/handlers/__init__.py +122 -126
- package/server/services/handlers/ai.py +390 -355
- package/server/services/handlers/android.py +69 -260
- package/server/services/handlers/code.py +278 -278
- package/server/services/handlers/http.py +193 -193
- package/server/services/handlers/tools.py +146 -32
- package/server/services/handlers/triggers.py +107 -107
- package/server/services/handlers/utility.py +822 -822
- package/server/services/handlers/whatsapp.py +423 -476
- package/server/services/maps.py +288 -288
- package/server/services/memory_store.py +103 -103
- package/server/services/node_executor.py +372 -375
- package/server/services/scheduler.py +155 -155
- package/server/services/skill_loader.py +1 -1
- package/server/services/status_broadcaster.py +834 -826
- package/server/services/temporal/__init__.py +23 -23
- package/server/services/temporal/activities.py +344 -344
- package/server/services/temporal/client.py +76 -76
- package/server/services/temporal/executor.py +147 -147
- package/server/services/temporal/worker.py +251 -251
- package/server/services/temporal/workflow.py +355 -355
- package/server/services/temporal/ws_client.py +236 -236
- package/server/services/text.py +110 -110
- package/server/services/user_auth.py +172 -172
- package/server/services/websocket_client.py +29 -29
- package/server/services/workflow.py +597 -597
- package/server/skills/android-skill/SKILL.md +4 -4
- package/server/skills/code-skill/SKILL.md +123 -89
- package/server/skills/maps-skill/SKILL.md +3 -3
- package/server/skills/memory-skill/SKILL.md +1 -1
- package/server/skills/web-search-skill/SKILL.md +154 -0
- package/server/skills/whatsapp-skill/SKILL.md +3 -3
- package/server/uv.lock +461 -100
- package/server/whatsapp-rpc/.dockerignore +30 -30
- package/server/whatsapp-rpc/Dockerfile +44 -44
- package/server/whatsapp-rpc/Dockerfile.web +17 -17
- package/server/whatsapp-rpc/README.md +139 -139
- package/server/whatsapp-rpc/bin/whatsapp-rpc-server +0 -0
- package/server/whatsapp-rpc/cli.js +95 -95
- package/server/whatsapp-rpc/configs/config.yaml +6 -6
- package/server/whatsapp-rpc/docker-compose.yml +35 -35
- package/server/whatsapp-rpc/docs/API.md +410 -410
- package/server/whatsapp-rpc/node_modules/.package-lock.json +259 -0
- package/server/whatsapp-rpc/node_modules/chalk/license +9 -0
- package/server/whatsapp-rpc/node_modules/chalk/package.json +83 -0
- package/server/whatsapp-rpc/node_modules/chalk/readme.md +297 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/index.d.ts +325 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/index.js +225 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/utilities.js +33 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/server/whatsapp-rpc/node_modules/commander/LICENSE +22 -0
- package/server/whatsapp-rpc/node_modules/commander/Readme.md +1148 -0
- package/server/whatsapp-rpc/node_modules/commander/esm.mjs +16 -0
- package/server/whatsapp-rpc/node_modules/commander/index.js +26 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/argument.js +145 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/command.js +2179 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/error.js +43 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/help.js +462 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/option.js +329 -0
- package/server/whatsapp-rpc/node_modules/commander/lib/suggestSimilar.js +100 -0
- package/server/whatsapp-rpc/node_modules/commander/package-support.json +16 -0
- package/server/whatsapp-rpc/node_modules/commander/package.json +80 -0
- package/server/whatsapp-rpc/node_modules/commander/typings/esm.d.mts +3 -0
- package/server/whatsapp-rpc/node_modules/commander/typings/index.d.ts +884 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/README.md +89 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/index.js +39 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/parse.js +91 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/escape.js +47 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
- package/server/whatsapp-rpc/node_modules/cross-spawn/package.json +73 -0
- package/server/whatsapp-rpc/node_modules/execa/index.d.ts +955 -0
- package/server/whatsapp-rpc/node_modules/execa/index.js +309 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/command.js +119 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/error.js +87 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/kill.js +102 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/pipe.js +42 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/promise.js +36 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/stdio.js +49 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/stream.js +133 -0
- package/server/whatsapp-rpc/node_modules/execa/lib/verbose.js +19 -0
- package/server/whatsapp-rpc/node_modules/execa/license +9 -0
- package/server/whatsapp-rpc/node_modules/execa/package.json +90 -0
- package/server/whatsapp-rpc/node_modules/execa/readme.md +822 -0
- package/server/whatsapp-rpc/node_modules/get-stream/license +9 -0
- package/server/whatsapp-rpc/node_modules/get-stream/package.json +53 -0
- package/server/whatsapp-rpc/node_modules/get-stream/readme.md +291 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/array-buffer.js +84 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/array.js +32 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/buffer.js +20 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/contents.js +101 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/index.d.ts +119 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/index.js +5 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/string.js +36 -0
- package/server/whatsapp-rpc/node_modules/get-stream/source/utils.js +11 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/README.md +95 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/index.js +97 -0
- package/server/whatsapp-rpc/node_modules/get-them-args/package.json +36 -0
- package/server/whatsapp-rpc/node_modules/human-signals/LICENSE +201 -0
- package/server/whatsapp-rpc/node_modules/human-signals/README.md +168 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/core.js +273 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.d.ts +73 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.js +70 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/realtime.js +16 -0
- package/server/whatsapp-rpc/node_modules/human-signals/build/src/signals.js +34 -0
- package/server/whatsapp-rpc/node_modules/human-signals/package.json +61 -0
- package/server/whatsapp-rpc/node_modules/is-stream/index.d.ts +81 -0
- package/server/whatsapp-rpc/node_modules/is-stream/index.js +29 -0
- package/server/whatsapp-rpc/node_modules/is-stream/license +9 -0
- package/server/whatsapp-rpc/node_modules/is-stream/package.json +44 -0
- package/server/whatsapp-rpc/node_modules/is-stream/readme.md +60 -0
- package/server/whatsapp-rpc/node_modules/isexe/LICENSE +15 -0
- package/server/whatsapp-rpc/node_modules/isexe/README.md +51 -0
- package/server/whatsapp-rpc/node_modules/isexe/index.js +57 -0
- package/server/whatsapp-rpc/node_modules/isexe/mode.js +41 -0
- package/server/whatsapp-rpc/node_modules/isexe/package.json +31 -0
- package/server/whatsapp-rpc/node_modules/isexe/test/basic.js +221 -0
- package/server/whatsapp-rpc/node_modules/isexe/windows.js +42 -0
- package/server/whatsapp-rpc/node_modules/kill-port/.editorconfig +12 -0
- package/server/whatsapp-rpc/node_modules/kill-port/.gitattributes +1 -0
- package/server/whatsapp-rpc/node_modules/kill-port/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/kill-port/README.md +140 -0
- package/server/whatsapp-rpc/node_modules/kill-port/cli.js +25 -0
- package/server/whatsapp-rpc/node_modules/kill-port/example.js +21 -0
- package/server/whatsapp-rpc/node_modules/kill-port/index.js +46 -0
- package/server/whatsapp-rpc/node_modules/kill-port/logo.png +0 -0
- package/server/whatsapp-rpc/node_modules/kill-port/package.json +41 -0
- package/server/whatsapp-rpc/node_modules/kill-port/pnpm-lock.yaml +4606 -0
- package/server/whatsapp-rpc/node_modules/kill-port/test.js +16 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/README.md +78 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/index.js +41 -0
- package/server/whatsapp-rpc/node_modules/merge-stream/package.json +19 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/index.d.ts +52 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/index.js +71 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/license +9 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/package.json +45 -0
- package/server/whatsapp-rpc/node_modules/mimic-fn/readme.md +90 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/index.d.ts +90 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/index.js +52 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/license +9 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.d.ts +31 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.js +12 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/license +9 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/package.json +41 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/readme.md +57 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/package.json +49 -0
- package/server/whatsapp-rpc/node_modules/npm-run-path/readme.md +104 -0
- package/server/whatsapp-rpc/node_modules/onetime/index.d.ts +59 -0
- package/server/whatsapp-rpc/node_modules/onetime/index.js +41 -0
- package/server/whatsapp-rpc/node_modules/onetime/license +9 -0
- package/server/whatsapp-rpc/node_modules/onetime/package.json +45 -0
- package/server/whatsapp-rpc/node_modules/onetime/readme.md +94 -0
- package/server/whatsapp-rpc/node_modules/path-key/index.d.ts +40 -0
- package/server/whatsapp-rpc/node_modules/path-key/index.js +16 -0
- package/server/whatsapp-rpc/node_modules/path-key/license +9 -0
- package/server/whatsapp-rpc/node_modules/path-key/package.json +39 -0
- package/server/whatsapp-rpc/node_modules/path-key/readme.md +61 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/index.js +19 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/license +9 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/package.json +34 -0
- package/server/whatsapp-rpc/node_modules/shebang-command/readme.md +34 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/index.d.ts +22 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/index.js +2 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/license +9 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/package.json +35 -0
- package/server/whatsapp-rpc/node_modules/shebang-regex/readme.md +33 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/LICENSE +21 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/README.md +60 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/index.js +47 -0
- package/server/whatsapp-rpc/node_modules/shell-exec/package.json +29 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/LICENSE.txt +16 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/README.md +74 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js +10 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js +279 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/package.json +3 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js +42 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js +4 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js +275 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/package.json +3 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js +39 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
- package/server/whatsapp-rpc/node_modules/signal-exit/package.json +106 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/index.js +14 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/license +9 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/package.json +43 -0
- package/server/whatsapp-rpc/node_modules/strip-final-newline/readme.md +35 -0
- package/server/whatsapp-rpc/node_modules/which/CHANGELOG.md +166 -0
- package/server/whatsapp-rpc/node_modules/which/LICENSE +15 -0
- package/server/whatsapp-rpc/node_modules/which/README.md +54 -0
- package/server/whatsapp-rpc/node_modules/which/bin/node-which +52 -0
- package/server/whatsapp-rpc/node_modules/which/package.json +43 -0
- package/server/whatsapp-rpc/node_modules/which/which.js +125 -0
- package/server/whatsapp-rpc/package-lock.json +272 -0
- package/server/whatsapp-rpc/package.json +30 -30
- package/server/whatsapp-rpc/schema.json +1294 -1294
- package/server/whatsapp-rpc/scripts/clean.cjs +66 -66
- package/server/whatsapp-rpc/scripts/cli.js +162 -162
- package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -166
- package/server/whatsapp-rpc/src/python/pyproject.toml +15 -15
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -4
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -427
- package/server/whatsapp-rpc/web/app.py +609 -609
- package/server/whatsapp-rpc/web/requirements.txt +6 -6
- package/server/whatsapp-rpc/web/rpc_client.py +427 -427
- package/server/whatsapp-rpc/web/static/openapi.yaml +59 -59
- package/server/whatsapp-rpc/web/templates/base.html +149 -149
- package/server/whatsapp-rpc/web/templates/contacts.html +240 -240
- package/server/whatsapp-rpc/web/templates/dashboard.html +319 -319
- package/server/whatsapp-rpc/web/templates/groups.html +328 -328
- package/server/whatsapp-rpc/web/templates/messages.html +465 -465
- package/server/whatsapp-rpc/web/templates/messaging.html +680 -680
- package/server/whatsapp-rpc/web/templates/send.html +258 -258
- package/server/whatsapp-rpc/web/templates/settings.html +459 -459
- package/client/src/components/ui/AndroidSettingsPanel.tsx +0 -401
- package/client/src/components/ui/WhatsAppSettingsPanel.tsx +0 -345
- package/client/src/nodeDefinitions/androidDeviceNodes.ts +0 -140
- package/docker-compose.prod.yml +0 -107
- package/docker-compose.yml +0 -104
- package/docs-MachinaOs/README.md +0 -85
- package/docs-MachinaOs/deployment/docker.mdx +0 -228
- package/docs-MachinaOs/deployment/production.mdx +0 -345
- package/docs-MachinaOs/docs.json +0 -75
- package/docs-MachinaOs/faq.mdx +0 -309
- package/docs-MachinaOs/favicon.svg +0 -5
- package/docs-MachinaOs/installation.mdx +0 -160
- package/docs-MachinaOs/introduction.mdx +0 -114
- package/docs-MachinaOs/logo/dark.svg +0 -6
- package/docs-MachinaOs/logo/light.svg +0 -6
- package/docs-MachinaOs/nodes/ai-agent.mdx +0 -216
- package/docs-MachinaOs/nodes/ai-models.mdx +0 -240
- package/docs-MachinaOs/nodes/android.mdx +0 -411
- package/docs-MachinaOs/nodes/overview.mdx +0 -181
- package/docs-MachinaOs/nodes/schedulers.mdx +0 -316
- package/docs-MachinaOs/nodes/webhooks.mdx +0 -330
- package/docs-MachinaOs/nodes/whatsapp.mdx +0 -305
- package/docs-MachinaOs/quickstart.mdx +0 -119
- package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +0 -177
- package/docs-MachinaOs/tutorials/android-automation.mdx +0 -242
- package/docs-MachinaOs/tutorials/first-workflow.mdx +0 -134
- package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +0 -185
- package/nul +0 -0
- package/scripts/check-ports.ps1 +0 -33
- package/scripts/kill-port.ps1 +0 -154
|
@@ -1,865 +1,821 @@
|
|
|
1
|
-
// WhatsApp Node Definitions - Messaging integration via whatsmeow
|
|
2
|
-
import {
|
|
3
|
-
INodeTypeDescription,
|
|
4
|
-
NodeConnectionType
|
|
5
|
-
} from '../types/INodeProperties';
|
|
6
|
-
import { API_CONFIG } from '../config/api';
|
|
7
|
-
|
|
8
|
-
// Get WebSocket URL dynamically based on environment
|
|
9
|
-
const getWebSocketUrl = (): string => {
|
|
10
|
-
const baseUrl = API_CONFIG.PYTHON_BASE_URL;
|
|
11
|
-
|
|
12
|
-
// Production: empty base URL means use current origin
|
|
13
|
-
if (!baseUrl) {
|
|
14
|
-
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
|
15
|
-
return `${wsProtocol}://${window.location.host}/ws/status`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Development: convert http(s) to ws(s)
|
|
19
|
-
const wsProtocol = baseUrl.startsWith('https') ? 'wss' : 'ws';
|
|
20
|
-
const wsUrl = baseUrl.replace(/^https?/, wsProtocol);
|
|
21
|
-
return `${wsUrl}/ws/status`;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// Helper to make WebSocket requests
|
|
25
|
-
async function wsRequest(type: string, data: Record<string, unknown> = {}): Promise<unknown> {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
const ws = new WebSocket(getWebSocketUrl());
|
|
28
|
-
const timeout = setTimeout(() => {
|
|
29
|
-
ws.close();
|
|
30
|
-
reject(new Error('WebSocket request timeout'));
|
|
31
|
-
}, 10000);
|
|
32
|
-
|
|
33
|
-
ws.onopen = () => {
|
|
34
|
-
ws.send(JSON.stringify({ type, ...data }));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
ws.onmessage = (event) => {
|
|
38
|
-
clearTimeout(timeout);
|
|
39
|
-
try {
|
|
40
|
-
const response = JSON.parse(event.data);
|
|
41
|
-
ws.close();
|
|
42
|
-
resolve(response);
|
|
43
|
-
} catch (e) {
|
|
44
|
-
ws.close();
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
ws.onerror = (error) => {
|
|
50
|
-
clearTimeout(timeout);
|
|
51
|
-
ws.close();
|
|
52
|
-
reject(error);
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// ============================================================================
|
|
58
|
-
// WHATSAPP ICONS (SVG Data URIs)
|
|
59
|
-
// ============================================================================
|
|
60
|
-
|
|
61
|
-
// WhatsApp Send - Paper plane (send message)
|
|
62
|
-
const WHATSAPP_SEND_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E";
|
|
63
|
-
|
|
64
|
-
// WhatsApp Connect - Official WhatsApp logo (exported for use in skill nodes)
|
|
65
|
-
export const WHATSAPP_CONNECT_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E";
|
|
66
|
-
|
|
67
|
-
// WhatsApp Receive - Notification bell with dot (trigger node)
|
|
68
|
-
const WHATSAPP_RECEIVE_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5v6z'/%3E%3Ccircle cx='18' cy='6' r='4'/%3E%3C/svg%3E";
|
|
69
|
-
|
|
70
|
-
// WhatsApp DB - Database icon (query contacts, groups, messages)
|
|
71
|
-
const WHATSAPP_DB_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M12 3C7.58 3 4 4.79 4 7v10c0 2.21 3.58 4 8 4s8-1.79 8-4V7c0-2.21-3.58-4-8-4zm0 2c3.87 0 6 1.5 6 2s-2.13 2-6 2-6-1.5-6-2 2.13-2 6-2zm6 12c0 .5-2.13 2-6 2s-6-1.5-6-2v-2.23c1.61.78 3.72 1.23 6 1.23s4.39-.45 6-1.23V17zm0-4c0 .5-2.13 2-6 2s-6-1.5-6-2v-2.23c1.61.78 3.72 1.23 6 1.23s4.39-.45 6-1.23V13zm0-4c0 .5-2.13 2-6 2s-6-1.5-6-2V6.77C7.61 7.55 9.72 8 12 8s4.39-.45 6-1.23V9z'/%3E%3C/svg%3E";
|
|
72
|
-
|
|
73
|
-
// ============================================================================
|
|
74
|
-
// WHATSAPP NODES
|
|
75
|
-
// ============================================================================
|
|
76
|
-
|
|
77
|
-
export const whatsappNodes: Record<string, INodeTypeDescription> = {
|
|
78
|
-
// WhatsApp Send Message Node - Enhanced with full schema support
|
|
79
|
-
whatsappSend: {
|
|
80
|
-
displayName: 'WhatsApp Send',
|
|
81
|
-
name: 'whatsappSend',
|
|
82
|
-
icon: WHATSAPP_SEND_ICON,
|
|
83
|
-
group: ['whatsapp', 'tool'],
|
|
84
|
-
version: 1,
|
|
85
|
-
subtitle: 'Send WhatsApp Message',
|
|
86
|
-
description: 'Send text, media, location, or contact messages via WhatsApp',
|
|
87
|
-
defaults: { name: 'WhatsApp Send', color: '#25D366' },
|
|
88
|
-
inputs: [{
|
|
89
|
-
name: 'main',
|
|
90
|
-
displayName: 'Input',
|
|
91
|
-
type: 'main' as NodeConnectionType,
|
|
92
|
-
description: 'Message input'
|
|
93
|
-
}],
|
|
94
|
-
outputs: [
|
|
95
|
-
{
|
|
96
|
-
name: 'main',
|
|
97
|
-
displayName: 'Output',
|
|
98
|
-
type: 'main' as NodeConnectionType,
|
|
99
|
-
description: 'Message output'
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: 'tool',
|
|
103
|
-
displayName: 'Tool',
|
|
104
|
-
type: 'main' as NodeConnectionType,
|
|
105
|
-
description: 'Connect to AI Agent tool handle'
|
|
106
|
-
}
|
|
107
|
-
],
|
|
108
|
-
properties: [
|
|
109
|
-
// ===== RECIPIENT =====
|
|
110
|
-
{
|
|
111
|
-
displayName: 'Send To',
|
|
112
|
-
name: 'recipient_type',
|
|
113
|
-
type: 'options',
|
|
114
|
-
options: [
|
|
115
|
-
{ name: 'Phone Number', value: 'phone' },
|
|
116
|
-
{ name: 'Group', value: 'group' }
|
|
117
|
-
],
|
|
118
|
-
default: 'phone',
|
|
119
|
-
description: 'Send to individual or group'
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
displayName: 'Phone Number',
|
|
123
|
-
name: 'phone',
|
|
124
|
-
type: 'string',
|
|
125
|
-
default: '',
|
|
126
|
-
required: true,
|
|
127
|
-
placeholder: '1234567890',
|
|
128
|
-
description: 'Recipient phone number (without + prefix)',
|
|
129
|
-
displayOptions: {
|
|
130
|
-
show: { recipient_type: ['phone'] }
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
displayName: 'Group',
|
|
135
|
-
name: 'group_id',
|
|
136
|
-
type: 'string',
|
|
137
|
-
default: '',
|
|
138
|
-
required: true,
|
|
139
|
-
placeholder: '123456789@g.us',
|
|
140
|
-
description: 'Group JID to send message to (use Load button to select)',
|
|
141
|
-
displayOptions: {
|
|
142
|
-
show: { recipient_type: ['group'] }
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
// ===== MESSAGE TYPE =====
|
|
147
|
-
{
|
|
148
|
-
displayName: 'Message Type',
|
|
149
|
-
name: 'message_type',
|
|
150
|
-
type: 'options',
|
|
151
|
-
options: [
|
|
152
|
-
{ name: 'Text', value: 'text' },
|
|
153
|
-
{ name: 'Image', value: 'image' },
|
|
154
|
-
{ name: 'Video', value: 'video' },
|
|
155
|
-
{ name: 'Audio', value: 'audio' },
|
|
156
|
-
{ name: 'Document', value: 'document' },
|
|
157
|
-
{ name: 'Sticker', value: 'sticker' },
|
|
158
|
-
{ name: 'Location', value: 'location' },
|
|
159
|
-
{ name: 'Contact', value: 'contact' }
|
|
160
|
-
],
|
|
161
|
-
default: 'text',
|
|
162
|
-
description: 'Type of message to send'
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
// ===== TEXT MESSAGE =====
|
|
166
|
-
{
|
|
167
|
-
displayName: 'Message',
|
|
168
|
-
name: 'message',
|
|
169
|
-
type: 'string',
|
|
170
|
-
default: '',
|
|
171
|
-
required: true,
|
|
172
|
-
typeOptions: { rows: 4 },
|
|
173
|
-
description: 'Text message content',
|
|
174
|
-
placeholder: 'Enter your message...',
|
|
175
|
-
displayOptions: {
|
|
176
|
-
show: { message_type: ['text'] }
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
// ===== MEDIA MESSAGES (image, video, audio, document, sticker) =====
|
|
181
|
-
{
|
|
182
|
-
displayName: 'Media Source',
|
|
183
|
-
name: 'media_source',
|
|
184
|
-
type: 'options',
|
|
185
|
-
options: [
|
|
186
|
-
{ name: 'Base64 Data', value: 'base64' },
|
|
187
|
-
{ name: 'File Path', value: 'file' },
|
|
188
|
-
{ name: 'URL', value: 'url' }
|
|
189
|
-
],
|
|
190
|
-
default: 'base64',
|
|
191
|
-
description: 'Source of media data',
|
|
192
|
-
displayOptions: {
|
|
193
|
-
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'] }
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
displayName: 'Media Data (Base64)',
|
|
198
|
-
name: 'media_data',
|
|
199
|
-
type: 'string',
|
|
200
|
-
default: '',
|
|
201
|
-
required: true,
|
|
202
|
-
typeOptions: { rows: 3 },
|
|
203
|
-
description: 'Base64-encoded media data',
|
|
204
|
-
displayOptions: {
|
|
205
|
-
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'], media_source: ['base64'] }
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
displayName: 'File',
|
|
210
|
-
name: 'file_path',
|
|
211
|
-
type: 'file',
|
|
212
|
-
default: '',
|
|
213
|
-
required: true,
|
|
214
|
-
placeholder: '/path/to/file.jpg',
|
|
215
|
-
description: 'Upload a file or enter server path',
|
|
216
|
-
typeOptions: {
|
|
217
|
-
accept: '*/*'
|
|
218
|
-
},
|
|
219
|
-
displayOptions: {
|
|
220
|
-
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'], media_source: ['file'] }
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
displayName: 'Media URL',
|
|
225
|
-
name: 'media_url',
|
|
226
|
-
type: 'string',
|
|
227
|
-
default: '',
|
|
228
|
-
required: true,
|
|
229
|
-
placeholder: 'https://example.com/image.jpg',
|
|
230
|
-
description: 'URL to download media from',
|
|
231
|
-
displayOptions: {
|
|
232
|
-
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'], media_source: ['url'] }
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
displayName: 'MIME Type',
|
|
237
|
-
name: 'mime_type',
|
|
238
|
-
type: 'string',
|
|
239
|
-
default: '',
|
|
240
|
-
placeholder: 'image/jpeg, video/mp4, audio/ogg',
|
|
241
|
-
description: 'MIME type of the media (auto-detected if empty)',
|
|
242
|
-
displayOptions: {
|
|
243
|
-
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'] }
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
displayName: 'Caption',
|
|
248
|
-
name: 'caption',
|
|
249
|
-
type: 'string',
|
|
250
|
-
default: '',
|
|
251
|
-
typeOptions: { rows: 2 },
|
|
252
|
-
description: 'Optional caption for media',
|
|
253
|
-
displayOptions: {
|
|
254
|
-
show: { message_type: ['image', 'video', 'document'] }
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
displayName: 'Filename',
|
|
259
|
-
name: 'filename',
|
|
260
|
-
type: 'string',
|
|
261
|
-
default: '',
|
|
262
|
-
placeholder: 'document.pdf',
|
|
263
|
-
description: 'Filename for document',
|
|
264
|
-
displayOptions: {
|
|
265
|
-
show: { message_type: ['document'] }
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
// ===== LOCATION MESSAGE =====
|
|
270
|
-
{
|
|
271
|
-
displayName: 'Latitude',
|
|
272
|
-
name: 'latitude',
|
|
273
|
-
type: 'number',
|
|
274
|
-
default: 0,
|
|
275
|
-
required: true,
|
|
276
|
-
description: 'Location latitude',
|
|
277
|
-
displayOptions: {
|
|
278
|
-
show: { message_type: ['location'] }
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
displayName: 'Longitude',
|
|
283
|
-
name: 'longitude',
|
|
284
|
-
type: 'number',
|
|
285
|
-
default: 0,
|
|
286
|
-
required: true,
|
|
287
|
-
description: 'Location longitude',
|
|
288
|
-
displayOptions: {
|
|
289
|
-
show: { message_type: ['location'] }
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
displayName: 'Location Name',
|
|
294
|
-
name: 'location_name',
|
|
295
|
-
type: 'string',
|
|
296
|
-
default: '',
|
|
297
|
-
placeholder: 'San Francisco',
|
|
298
|
-
description: 'Display name for location',
|
|
299
|
-
displayOptions: {
|
|
300
|
-
show: { message_type: ['location'] }
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
displayName: 'Address',
|
|
305
|
-
name: 'address',
|
|
306
|
-
type: 'string',
|
|
307
|
-
default: '',
|
|
308
|
-
placeholder: 'California, USA',
|
|
309
|
-
description: 'Address text',
|
|
310
|
-
displayOptions: {
|
|
311
|
-
show: { message_type: ['location'] }
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
|
|
315
|
-
// ===== CONTACT MESSAGE =====
|
|
316
|
-
{
|
|
317
|
-
displayName: 'Contact Name',
|
|
318
|
-
name: 'contact_name',
|
|
319
|
-
type: 'string',
|
|
320
|
-
default: '',
|
|
321
|
-
required: true,
|
|
322
|
-
placeholder: 'John Doe',
|
|
323
|
-
description: 'Display name for contact',
|
|
324
|
-
displayOptions: {
|
|
325
|
-
show: { message_type: ['contact'] }
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
displayName: 'Contact vCard',
|
|
330
|
-
name: 'vcard',
|
|
331
|
-
type: 'string',
|
|
332
|
-
default: '',
|
|
333
|
-
required: true,
|
|
334
|
-
typeOptions: { rows: 4 },
|
|
335
|
-
placeholder: 'BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL:+1234567890\nEND:VCARD',
|
|
336
|
-
description: 'vCard 3.0 format string',
|
|
337
|
-
displayOptions: {
|
|
338
|
-
show: { message_type: ['contact'] }
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
// ===== REPLY (QUOTE) =====
|
|
343
|
-
{
|
|
344
|
-
displayName: 'Reply To Message',
|
|
345
|
-
name: 'is_reply',
|
|
346
|
-
type: 'boolean',
|
|
347
|
-
default: false,
|
|
348
|
-
description: 'Quote an existing message'
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
displayName: 'Reply Message ID',
|
|
352
|
-
name: 'reply_message_id',
|
|
353
|
-
type: 'string',
|
|
354
|
-
default: '',
|
|
355
|
-
required: true,
|
|
356
|
-
placeholder: 'ABC123DEF456',
|
|
357
|
-
description: 'ID of message to reply to',
|
|
358
|
-
displayOptions: {
|
|
359
|
-
show: { is_reply: [true] }
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
displayName: 'Reply Sender',
|
|
364
|
-
name: 'reply_sender',
|
|
365
|
-
type: 'string',
|
|
366
|
-
default: '',
|
|
367
|
-
required: true,
|
|
368
|
-
placeholder: '1234567890@s.whatsapp.net',
|
|
369
|
-
description: 'Sender JID of quoted message',
|
|
370
|
-
displayOptions: {
|
|
371
|
-
show: { is_reply: [true] }
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
displayName: 'Reply Preview',
|
|
376
|
-
name: 'reply_content',
|
|
377
|
-
type: 'string',
|
|
378
|
-
default: '',
|
|
379
|
-
placeholder: 'Original message text...',
|
|
380
|
-
description: 'Text preview of quoted message',
|
|
381
|
-
displayOptions: {
|
|
382
|
-
show: { is_reply: [true] }
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
]
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
// WhatsApp
|
|
389
|
-
|
|
390
|
-
displayName: 'WhatsApp
|
|
391
|
-
name: '
|
|
392
|
-
icon:
|
|
393
|
-
group: ['whatsapp'],
|
|
394
|
-
version: 1,
|
|
395
|
-
subtitle: '
|
|
396
|
-
description: '
|
|
397
|
-
defaults: { name: 'WhatsApp
|
|
398
|
-
inputs: [],
|
|
399
|
-
outputs: [{
|
|
400
|
-
name: 'main',
|
|
401
|
-
displayName: '
|
|
402
|
-
type: 'main' as NodeConnectionType,
|
|
403
|
-
description: '
|
|
404
|
-
}],
|
|
405
|
-
properties: [
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
description: '
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
displayName: '
|
|
498
|
-
name: '
|
|
499
|
-
type: '
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
description: '
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
displayName: '
|
|
510
|
-
name: '
|
|
511
|
-
type: '
|
|
512
|
-
default:
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
{
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
{
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
name: 'phones',
|
|
823
|
-
type: 'string',
|
|
824
|
-
default: '',
|
|
825
|
-
required: true,
|
|
826
|
-
placeholder: '1234567890, 0987654321',
|
|
827
|
-
description: 'Comma-separated phone numbers to check WhatsApp registration',
|
|
828
|
-
displayOptions: {
|
|
829
|
-
show: { operation: ['check_contacts'] }
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
],
|
|
833
|
-
methods: {
|
|
834
|
-
loadOptions: {
|
|
835
|
-
async getWhatsAppGroups(): Promise<Array<{name: string, value: string, description?: string}>> {
|
|
836
|
-
try {
|
|
837
|
-
const response = await wsRequest('whatsapp_groups') as { success: boolean; groups?: Array<{ jid: string; name: string; participant_count?: number; is_community?: boolean }> };
|
|
838
|
-
|
|
839
|
-
if (response.success && response.groups) {
|
|
840
|
-
const regularGroups = response.groups.filter((group) => !group.is_community);
|
|
841
|
-
if (regularGroups.length === 0) {
|
|
842
|
-
return [{ name: 'No groups found', value: '', description: 'Only communities found' }];
|
|
843
|
-
}
|
|
844
|
-
return regularGroups.map((group) => ({
|
|
845
|
-
name: group.name || group.jid,
|
|
846
|
-
value: group.jid,
|
|
847
|
-
description: group.participant_count ? `${group.participant_count} members` : undefined
|
|
848
|
-
}));
|
|
849
|
-
}
|
|
850
|
-
return [{ name: 'No groups found', value: '', description: 'Connect WhatsApp first' }];
|
|
851
|
-
} catch (error) {
|
|
852
|
-
console.error('Error loading WhatsApp groups:', error);
|
|
853
|
-
return [{ name: 'Error loading groups', value: '', description: 'Check WhatsApp connection' }];
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
};
|
|
860
|
-
|
|
861
|
-
// ============================================================================
|
|
862
|
-
// EXPORTS
|
|
863
|
-
// ============================================================================
|
|
864
|
-
|
|
865
|
-
export const WHATSAPP_NODE_TYPES = ['whatsappSend', 'whatsappConnect', 'whatsappReceive', 'whatsappDb'];
|
|
1
|
+
// WhatsApp Node Definitions - Messaging integration via whatsmeow
|
|
2
|
+
import {
|
|
3
|
+
INodeTypeDescription,
|
|
4
|
+
NodeConnectionType
|
|
5
|
+
} from '../types/INodeProperties';
|
|
6
|
+
import { API_CONFIG } from '../config/api';
|
|
7
|
+
|
|
8
|
+
// Get WebSocket URL dynamically based on environment
|
|
9
|
+
const getWebSocketUrl = (): string => {
|
|
10
|
+
const baseUrl = API_CONFIG.PYTHON_BASE_URL;
|
|
11
|
+
|
|
12
|
+
// Production: empty base URL means use current origin
|
|
13
|
+
if (!baseUrl) {
|
|
14
|
+
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
|
15
|
+
return `${wsProtocol}://${window.location.host}/ws/status`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Development: convert http(s) to ws(s)
|
|
19
|
+
const wsProtocol = baseUrl.startsWith('https') ? 'wss' : 'ws';
|
|
20
|
+
const wsUrl = baseUrl.replace(/^https?/, wsProtocol);
|
|
21
|
+
return `${wsUrl}/ws/status`;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Helper to make WebSocket requests
|
|
25
|
+
async function wsRequest(type: string, data: Record<string, unknown> = {}): Promise<unknown> {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const ws = new WebSocket(getWebSocketUrl());
|
|
28
|
+
const timeout = setTimeout(() => {
|
|
29
|
+
ws.close();
|
|
30
|
+
reject(new Error('WebSocket request timeout'));
|
|
31
|
+
}, 10000);
|
|
32
|
+
|
|
33
|
+
ws.onopen = () => {
|
|
34
|
+
ws.send(JSON.stringify({ type, ...data }));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
ws.onmessage = (event) => {
|
|
38
|
+
clearTimeout(timeout);
|
|
39
|
+
try {
|
|
40
|
+
const response = JSON.parse(event.data);
|
|
41
|
+
ws.close();
|
|
42
|
+
resolve(response);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
ws.close();
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
ws.onerror = (error) => {
|
|
50
|
+
clearTimeout(timeout);
|
|
51
|
+
ws.close();
|
|
52
|
+
reject(error);
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ============================================================================
|
|
58
|
+
// WHATSAPP ICONS (SVG Data URIs)
|
|
59
|
+
// ============================================================================
|
|
60
|
+
|
|
61
|
+
// WhatsApp Send - Paper plane (send message)
|
|
62
|
+
const WHATSAPP_SEND_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E";
|
|
63
|
+
|
|
64
|
+
// WhatsApp Connect - Official WhatsApp logo (exported for use in skill nodes)
|
|
65
|
+
export const WHATSAPP_CONNECT_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E";
|
|
66
|
+
|
|
67
|
+
// WhatsApp Receive - Notification bell with dot (trigger node)
|
|
68
|
+
const WHATSAPP_RECEIVE_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5v6z'/%3E%3Ccircle cx='18' cy='6' r='4'/%3E%3C/svg%3E";
|
|
69
|
+
|
|
70
|
+
// WhatsApp DB - Database icon (query contacts, groups, messages)
|
|
71
|
+
const WHATSAPP_DB_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2325D366'%3E%3Cpath d='M12 3C7.58 3 4 4.79 4 7v10c0 2.21 3.58 4 8 4s8-1.79 8-4V7c0-2.21-3.58-4-8-4zm0 2c3.87 0 6 1.5 6 2s-2.13 2-6 2-6-1.5-6-2 2.13-2 6-2zm6 12c0 .5-2.13 2-6 2s-6-1.5-6-2v-2.23c1.61.78 3.72 1.23 6 1.23s4.39-.45 6-1.23V17zm0-4c0 .5-2.13 2-6 2s-6-1.5-6-2v-2.23c1.61.78 3.72 1.23 6 1.23s4.39-.45 6-1.23V13zm0-4c0 .5-2.13 2-6 2s-6-1.5-6-2V6.77C7.61 7.55 9.72 8 12 8s4.39-.45 6-1.23V9z'/%3E%3C/svg%3E";
|
|
72
|
+
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// WHATSAPP NODES
|
|
75
|
+
// ============================================================================
|
|
76
|
+
|
|
77
|
+
export const whatsappNodes: Record<string, INodeTypeDescription> = {
|
|
78
|
+
// WhatsApp Send Message Node - Enhanced with full schema support
|
|
79
|
+
whatsappSend: {
|
|
80
|
+
displayName: 'WhatsApp Send',
|
|
81
|
+
name: 'whatsappSend',
|
|
82
|
+
icon: WHATSAPP_SEND_ICON,
|
|
83
|
+
group: ['whatsapp', 'tool'],
|
|
84
|
+
version: 1,
|
|
85
|
+
subtitle: 'Send WhatsApp Message',
|
|
86
|
+
description: 'Send text, media, location, or contact messages via WhatsApp',
|
|
87
|
+
defaults: { name: 'WhatsApp Send', color: '#25D366' },
|
|
88
|
+
inputs: [{
|
|
89
|
+
name: 'main',
|
|
90
|
+
displayName: 'Input',
|
|
91
|
+
type: 'main' as NodeConnectionType,
|
|
92
|
+
description: 'Message input'
|
|
93
|
+
}],
|
|
94
|
+
outputs: [
|
|
95
|
+
{
|
|
96
|
+
name: 'main',
|
|
97
|
+
displayName: 'Output',
|
|
98
|
+
type: 'main' as NodeConnectionType,
|
|
99
|
+
description: 'Message output'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'tool',
|
|
103
|
+
displayName: 'Tool',
|
|
104
|
+
type: 'main' as NodeConnectionType,
|
|
105
|
+
description: 'Connect to AI Agent tool handle'
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
properties: [
|
|
109
|
+
// ===== RECIPIENT =====
|
|
110
|
+
{
|
|
111
|
+
displayName: 'Send To',
|
|
112
|
+
name: 'recipient_type',
|
|
113
|
+
type: 'options',
|
|
114
|
+
options: [
|
|
115
|
+
{ name: 'Phone Number', value: 'phone' },
|
|
116
|
+
{ name: 'Group', value: 'group' }
|
|
117
|
+
],
|
|
118
|
+
default: 'phone',
|
|
119
|
+
description: 'Send to individual or group'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
displayName: 'Phone Number',
|
|
123
|
+
name: 'phone',
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: '',
|
|
126
|
+
required: true,
|
|
127
|
+
placeholder: '1234567890',
|
|
128
|
+
description: 'Recipient phone number (without + prefix)',
|
|
129
|
+
displayOptions: {
|
|
130
|
+
show: { recipient_type: ['phone'] }
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Group',
|
|
135
|
+
name: 'group_id',
|
|
136
|
+
type: 'string',
|
|
137
|
+
default: '',
|
|
138
|
+
required: true,
|
|
139
|
+
placeholder: '123456789@g.us',
|
|
140
|
+
description: 'Group JID to send message to (use Load button to select)',
|
|
141
|
+
displayOptions: {
|
|
142
|
+
show: { recipient_type: ['group'] }
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
// ===== MESSAGE TYPE =====
|
|
147
|
+
{
|
|
148
|
+
displayName: 'Message Type',
|
|
149
|
+
name: 'message_type',
|
|
150
|
+
type: 'options',
|
|
151
|
+
options: [
|
|
152
|
+
{ name: 'Text', value: 'text' },
|
|
153
|
+
{ name: 'Image', value: 'image' },
|
|
154
|
+
{ name: 'Video', value: 'video' },
|
|
155
|
+
{ name: 'Audio', value: 'audio' },
|
|
156
|
+
{ name: 'Document', value: 'document' },
|
|
157
|
+
{ name: 'Sticker', value: 'sticker' },
|
|
158
|
+
{ name: 'Location', value: 'location' },
|
|
159
|
+
{ name: 'Contact', value: 'contact' }
|
|
160
|
+
],
|
|
161
|
+
default: 'text',
|
|
162
|
+
description: 'Type of message to send'
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
// ===== TEXT MESSAGE =====
|
|
166
|
+
{
|
|
167
|
+
displayName: 'Message',
|
|
168
|
+
name: 'message',
|
|
169
|
+
type: 'string',
|
|
170
|
+
default: '',
|
|
171
|
+
required: true,
|
|
172
|
+
typeOptions: { rows: 4 },
|
|
173
|
+
description: 'Text message content',
|
|
174
|
+
placeholder: 'Enter your message...',
|
|
175
|
+
displayOptions: {
|
|
176
|
+
show: { message_type: ['text'] }
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
// ===== MEDIA MESSAGES (image, video, audio, document, sticker) =====
|
|
181
|
+
{
|
|
182
|
+
displayName: 'Media Source',
|
|
183
|
+
name: 'media_source',
|
|
184
|
+
type: 'options',
|
|
185
|
+
options: [
|
|
186
|
+
{ name: 'Base64 Data', value: 'base64' },
|
|
187
|
+
{ name: 'File Path', value: 'file' },
|
|
188
|
+
{ name: 'URL', value: 'url' }
|
|
189
|
+
],
|
|
190
|
+
default: 'base64',
|
|
191
|
+
description: 'Source of media data',
|
|
192
|
+
displayOptions: {
|
|
193
|
+
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'] }
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
displayName: 'Media Data (Base64)',
|
|
198
|
+
name: 'media_data',
|
|
199
|
+
type: 'string',
|
|
200
|
+
default: '',
|
|
201
|
+
required: true,
|
|
202
|
+
typeOptions: { rows: 3 },
|
|
203
|
+
description: 'Base64-encoded media data',
|
|
204
|
+
displayOptions: {
|
|
205
|
+
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'], media_source: ['base64'] }
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
displayName: 'File',
|
|
210
|
+
name: 'file_path',
|
|
211
|
+
type: 'file',
|
|
212
|
+
default: '',
|
|
213
|
+
required: true,
|
|
214
|
+
placeholder: '/path/to/file.jpg',
|
|
215
|
+
description: 'Upload a file or enter server path',
|
|
216
|
+
typeOptions: {
|
|
217
|
+
accept: '*/*'
|
|
218
|
+
},
|
|
219
|
+
displayOptions: {
|
|
220
|
+
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'], media_source: ['file'] }
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
displayName: 'Media URL',
|
|
225
|
+
name: 'media_url',
|
|
226
|
+
type: 'string',
|
|
227
|
+
default: '',
|
|
228
|
+
required: true,
|
|
229
|
+
placeholder: 'https://example.com/image.jpg',
|
|
230
|
+
description: 'URL to download media from',
|
|
231
|
+
displayOptions: {
|
|
232
|
+
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'], media_source: ['url'] }
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
displayName: 'MIME Type',
|
|
237
|
+
name: 'mime_type',
|
|
238
|
+
type: 'string',
|
|
239
|
+
default: '',
|
|
240
|
+
placeholder: 'image/jpeg, video/mp4, audio/ogg',
|
|
241
|
+
description: 'MIME type of the media (auto-detected if empty)',
|
|
242
|
+
displayOptions: {
|
|
243
|
+
show: { message_type: ['image', 'video', 'audio', 'document', 'sticker'] }
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
displayName: 'Caption',
|
|
248
|
+
name: 'caption',
|
|
249
|
+
type: 'string',
|
|
250
|
+
default: '',
|
|
251
|
+
typeOptions: { rows: 2 },
|
|
252
|
+
description: 'Optional caption for media',
|
|
253
|
+
displayOptions: {
|
|
254
|
+
show: { message_type: ['image', 'video', 'document'] }
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
displayName: 'Filename',
|
|
259
|
+
name: 'filename',
|
|
260
|
+
type: 'string',
|
|
261
|
+
default: '',
|
|
262
|
+
placeholder: 'document.pdf',
|
|
263
|
+
description: 'Filename for document',
|
|
264
|
+
displayOptions: {
|
|
265
|
+
show: { message_type: ['document'] }
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
// ===== LOCATION MESSAGE =====
|
|
270
|
+
{
|
|
271
|
+
displayName: 'Latitude',
|
|
272
|
+
name: 'latitude',
|
|
273
|
+
type: 'number',
|
|
274
|
+
default: 0,
|
|
275
|
+
required: true,
|
|
276
|
+
description: 'Location latitude',
|
|
277
|
+
displayOptions: {
|
|
278
|
+
show: { message_type: ['location'] }
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
displayName: 'Longitude',
|
|
283
|
+
name: 'longitude',
|
|
284
|
+
type: 'number',
|
|
285
|
+
default: 0,
|
|
286
|
+
required: true,
|
|
287
|
+
description: 'Location longitude',
|
|
288
|
+
displayOptions: {
|
|
289
|
+
show: { message_type: ['location'] }
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
displayName: 'Location Name',
|
|
294
|
+
name: 'location_name',
|
|
295
|
+
type: 'string',
|
|
296
|
+
default: '',
|
|
297
|
+
placeholder: 'San Francisco',
|
|
298
|
+
description: 'Display name for location',
|
|
299
|
+
displayOptions: {
|
|
300
|
+
show: { message_type: ['location'] }
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
displayName: 'Address',
|
|
305
|
+
name: 'address',
|
|
306
|
+
type: 'string',
|
|
307
|
+
default: '',
|
|
308
|
+
placeholder: 'California, USA',
|
|
309
|
+
description: 'Address text',
|
|
310
|
+
displayOptions: {
|
|
311
|
+
show: { message_type: ['location'] }
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
// ===== CONTACT MESSAGE =====
|
|
316
|
+
{
|
|
317
|
+
displayName: 'Contact Name',
|
|
318
|
+
name: 'contact_name',
|
|
319
|
+
type: 'string',
|
|
320
|
+
default: '',
|
|
321
|
+
required: true,
|
|
322
|
+
placeholder: 'John Doe',
|
|
323
|
+
description: 'Display name for contact',
|
|
324
|
+
displayOptions: {
|
|
325
|
+
show: { message_type: ['contact'] }
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
displayName: 'Contact vCard',
|
|
330
|
+
name: 'vcard',
|
|
331
|
+
type: 'string',
|
|
332
|
+
default: '',
|
|
333
|
+
required: true,
|
|
334
|
+
typeOptions: { rows: 4 },
|
|
335
|
+
placeholder: 'BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL:+1234567890\nEND:VCARD',
|
|
336
|
+
description: 'vCard 3.0 format string',
|
|
337
|
+
displayOptions: {
|
|
338
|
+
show: { message_type: ['contact'] }
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
// ===== REPLY (QUOTE) =====
|
|
343
|
+
{
|
|
344
|
+
displayName: 'Reply To Message',
|
|
345
|
+
name: 'is_reply',
|
|
346
|
+
type: 'boolean',
|
|
347
|
+
default: false,
|
|
348
|
+
description: 'Quote an existing message'
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
displayName: 'Reply Message ID',
|
|
352
|
+
name: 'reply_message_id',
|
|
353
|
+
type: 'string',
|
|
354
|
+
default: '',
|
|
355
|
+
required: true,
|
|
356
|
+
placeholder: 'ABC123DEF456',
|
|
357
|
+
description: 'ID of message to reply to',
|
|
358
|
+
displayOptions: {
|
|
359
|
+
show: { is_reply: [true] }
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
displayName: 'Reply Sender',
|
|
364
|
+
name: 'reply_sender',
|
|
365
|
+
type: 'string',
|
|
366
|
+
default: '',
|
|
367
|
+
required: true,
|
|
368
|
+
placeholder: '1234567890@s.whatsapp.net',
|
|
369
|
+
description: 'Sender JID of quoted message',
|
|
370
|
+
displayOptions: {
|
|
371
|
+
show: { is_reply: [true] }
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
displayName: 'Reply Preview',
|
|
376
|
+
name: 'reply_content',
|
|
377
|
+
type: 'string',
|
|
378
|
+
default: '',
|
|
379
|
+
placeholder: 'Original message text...',
|
|
380
|
+
description: 'Text preview of quoted message',
|
|
381
|
+
displayOptions: {
|
|
382
|
+
show: { is_reply: [true] }
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
]
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
// WhatsApp Receive Message - triggers workflow on incoming messages
|
|
389
|
+
whatsappReceive: {
|
|
390
|
+
displayName: 'WhatsApp Receive',
|
|
391
|
+
name: 'whatsappReceive',
|
|
392
|
+
icon: WHATSAPP_RECEIVE_ICON,
|
|
393
|
+
group: ['whatsapp', 'trigger'],
|
|
394
|
+
version: 1,
|
|
395
|
+
subtitle: 'On Message Received',
|
|
396
|
+
description: 'Trigger workflow when WhatsApp message is received. Outputs message data including sender, content, and metadata.',
|
|
397
|
+
defaults: { name: 'WhatsApp Receive', color: '#075E54' },
|
|
398
|
+
inputs: [],
|
|
399
|
+
outputs: [{
|
|
400
|
+
name: 'main',
|
|
401
|
+
displayName: 'Message',
|
|
402
|
+
type: 'main' as NodeConnectionType,
|
|
403
|
+
description: 'Received message data (message_id, sender, sender_phone, chat_id, message_type, text, timestamp, is_group, is_from_me, group_info.sender_jid, group_info.sender_phone, group_info.sender_name)'
|
|
404
|
+
}],
|
|
405
|
+
properties: [
|
|
406
|
+
// ===== MESSAGE TYPE FILTER =====
|
|
407
|
+
{
|
|
408
|
+
displayName: 'Message Type',
|
|
409
|
+
name: 'messageTypeFilter',
|
|
410
|
+
type: 'options',
|
|
411
|
+
options: [
|
|
412
|
+
{ name: 'All Types', value: 'all' },
|
|
413
|
+
{ name: 'Text Only', value: 'text' },
|
|
414
|
+
{ name: 'Image Only', value: 'image' },
|
|
415
|
+
{ name: 'Video Only', value: 'video' },
|
|
416
|
+
{ name: 'Audio Only', value: 'audio' },
|
|
417
|
+
{ name: 'Document Only', value: 'document' },
|
|
418
|
+
{ name: 'Location Only', value: 'location' },
|
|
419
|
+
{ name: 'Contact Only', value: 'contact' }
|
|
420
|
+
],
|
|
421
|
+
default: 'all',
|
|
422
|
+
description: 'Filter by message content type'
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
// ===== SENDER FILTER =====
|
|
426
|
+
{
|
|
427
|
+
displayName: 'Sender Filter',
|
|
428
|
+
name: 'filter',
|
|
429
|
+
type: 'options',
|
|
430
|
+
options: [
|
|
431
|
+
{ name: 'All Messages', value: 'all' },
|
|
432
|
+
{ name: 'From Any Contact (Non-Group)', value: 'any_contact' },
|
|
433
|
+
{ name: 'From Specific Contact', value: 'contact' },
|
|
434
|
+
{ name: 'From Specific Group', value: 'group' },
|
|
435
|
+
{ name: 'Contains Keywords', value: 'keywords' }
|
|
436
|
+
],
|
|
437
|
+
default: 'all',
|
|
438
|
+
description: 'Filter which messages trigger the workflow'
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
displayName: 'Contact Phone',
|
|
442
|
+
name: 'contactPhone',
|
|
443
|
+
type: 'string',
|
|
444
|
+
default: '',
|
|
445
|
+
required: true,
|
|
446
|
+
displayOptions: {
|
|
447
|
+
show: { filter: ['contact'] }
|
|
448
|
+
},
|
|
449
|
+
placeholder: '1234567890',
|
|
450
|
+
description: 'Phone number to filter messages from (without + prefix)'
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
displayName: 'Group',
|
|
454
|
+
name: 'group_id',
|
|
455
|
+
type: 'string',
|
|
456
|
+
default: '',
|
|
457
|
+
required: true,
|
|
458
|
+
displayOptions: {
|
|
459
|
+
show: { filter: ['group'] }
|
|
460
|
+
},
|
|
461
|
+
placeholder: '123456789@g.us',
|
|
462
|
+
description: 'Group JID to filter messages from (use Load button to select)'
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
displayName: 'Sender Number',
|
|
466
|
+
name: 'senderNumber',
|
|
467
|
+
type: 'string',
|
|
468
|
+
default: '',
|
|
469
|
+
displayOptions: {
|
|
470
|
+
show: { filter: ['group'] }
|
|
471
|
+
},
|
|
472
|
+
placeholder: '1234567890',
|
|
473
|
+
description: 'Optional: Filter by sender phone number (use Load button to select from group members)'
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
displayName: 'Keywords',
|
|
477
|
+
name: 'keywords',
|
|
478
|
+
type: 'string',
|
|
479
|
+
default: '',
|
|
480
|
+
required: true,
|
|
481
|
+
displayOptions: {
|
|
482
|
+
show: { filter: ['keywords'] }
|
|
483
|
+
},
|
|
484
|
+
placeholder: 'help, support, info',
|
|
485
|
+
description: 'Comma-separated keywords to trigger on (case-insensitive)'
|
|
486
|
+
},
|
|
487
|
+
|
|
488
|
+
// ===== OPTIONS =====
|
|
489
|
+
{
|
|
490
|
+
displayName: 'Ignore Own Messages',
|
|
491
|
+
name: 'ignoreOwnMessages',
|
|
492
|
+
type: 'boolean',
|
|
493
|
+
default: true,
|
|
494
|
+
description: 'Do not trigger on messages sent by this device'
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
displayName: 'Forwarded Messages',
|
|
498
|
+
name: 'forwardedFilter',
|
|
499
|
+
type: 'options',
|
|
500
|
+
options: [
|
|
501
|
+
{ name: 'Include All', value: 'all' },
|
|
502
|
+
{ name: 'Only Forwarded', value: 'only_forwarded' },
|
|
503
|
+
{ name: 'Ignore Forwarded', value: 'ignore_forwarded' }
|
|
504
|
+
],
|
|
505
|
+
default: 'all',
|
|
506
|
+
description: 'Filter messages based on forwarded status'
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
displayName: 'Include Media Data',
|
|
510
|
+
name: 'includeMediaData',
|
|
511
|
+
type: 'boolean',
|
|
512
|
+
default: false,
|
|
513
|
+
description: 'Include base64 media data in output (increases memory usage)'
|
|
514
|
+
}
|
|
515
|
+
],
|
|
516
|
+
methods: {
|
|
517
|
+
loadOptions: {
|
|
518
|
+
async getWhatsAppGroups(): Promise<Array<{name: string, value: string, description?: string}>> {
|
|
519
|
+
try {
|
|
520
|
+
const response = await wsRequest('whatsapp_groups') as { success: boolean; groups?: Array<{ jid: string; name: string; participant_count?: number; is_community?: boolean }> };
|
|
521
|
+
|
|
522
|
+
if (response.success && response.groups) {
|
|
523
|
+
// Filter out communities - they don't have regular chat history
|
|
524
|
+
const regularGroups = response.groups.filter((group) => !group.is_community);
|
|
525
|
+
if (regularGroups.length === 0) {
|
|
526
|
+
return [{ name: 'No groups found', value: '', description: 'Only communities found (no chat history)' }];
|
|
527
|
+
}
|
|
528
|
+
return regularGroups.map((group) => ({
|
|
529
|
+
name: group.name || group.jid,
|
|
530
|
+
value: group.jid,
|
|
531
|
+
description: group.participant_count ? `${group.participant_count} members` : undefined
|
|
532
|
+
}));
|
|
533
|
+
}
|
|
534
|
+
return [{ name: 'No groups found', value: '', description: 'Connect WhatsApp first' }];
|
|
535
|
+
} catch (error) {
|
|
536
|
+
console.error('Error loading WhatsApp groups:', error);
|
|
537
|
+
return [{ name: 'Error loading groups', value: '', description: 'Check WhatsApp connection' }];
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
|
|
541
|
+
async getGroupMembers(this: { getCurrentNodeParameter: (name: string) => string }): Promise<Array<{name: string, value: string, description?: string}>> {
|
|
542
|
+
try {
|
|
543
|
+
const groupId = this.getCurrentNodeParameter('group_id');
|
|
544
|
+
if (!groupId) {
|
|
545
|
+
return [{ name: 'Select a group first', value: '', description: 'Choose a group above' }];
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const response = await wsRequest('whatsapp_group_info', { group_id: groupId }) as {
|
|
549
|
+
success: boolean;
|
|
550
|
+
participants?: Array<{ phone: string; name: string; jid: string; is_admin?: boolean }>;
|
|
551
|
+
name?: string;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
if (response.success && response.participants && response.participants.length > 0) {
|
|
555
|
+
// Add "All Members" option first
|
|
556
|
+
const options: Array<{name: string, value: string, description?: string}> = [
|
|
557
|
+
{ name: 'All Members', value: '', description: 'Receive from anyone in group' }
|
|
558
|
+
];
|
|
559
|
+
|
|
560
|
+
// Add each participant
|
|
561
|
+
for (const p of response.participants) {
|
|
562
|
+
const displayName = p.name || p.phone;
|
|
563
|
+
const adminLabel = p.is_admin ? ' (Admin)' : '';
|
|
564
|
+
options.push({
|
|
565
|
+
name: `${displayName}${adminLabel}`,
|
|
566
|
+
value: p.phone,
|
|
567
|
+
description: p.phone
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return options;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
return [{ name: 'No members found', value: '', description: 'Could not load group members' }];
|
|
575
|
+
} catch (error) {
|
|
576
|
+
console.error('Error loading group members:', error);
|
|
577
|
+
return [{ name: 'Error loading members', value: '', description: 'Check WhatsApp connection' }];
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
|
|
584
|
+
// WhatsApp DB Node - Query contacts, groups, messages
|
|
585
|
+
// Can be used as workflow node OR as AI Agent tool (group includes 'tool')
|
|
586
|
+
whatsappDb: {
|
|
587
|
+
displayName: 'WhatsApp DB',
|
|
588
|
+
name: 'whatsappDb',
|
|
589
|
+
icon: WHATSAPP_DB_ICON,
|
|
590
|
+
group: ['whatsapp', 'tool'],
|
|
591
|
+
version: 1,
|
|
592
|
+
subtitle: 'Query WhatsApp',
|
|
593
|
+
description: 'Query WhatsApp database - contacts, groups, messages, contact info',
|
|
594
|
+
defaults: { name: 'WhatsApp DB', color: '#25D366' },
|
|
595
|
+
inputs: [{
|
|
596
|
+
name: 'main',
|
|
597
|
+
displayName: 'Input',
|
|
598
|
+
type: 'main' as NodeConnectionType,
|
|
599
|
+
description: 'Trigger input'
|
|
600
|
+
}],
|
|
601
|
+
outputs: [
|
|
602
|
+
{
|
|
603
|
+
name: 'main',
|
|
604
|
+
displayName: 'Output',
|
|
605
|
+
type: 'main' as NodeConnectionType,
|
|
606
|
+
description: 'Query result'
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: 'tool',
|
|
610
|
+
displayName: 'Tool',
|
|
611
|
+
type: 'main' as NodeConnectionType,
|
|
612
|
+
description: 'Connect to AI Agent tool handle'
|
|
613
|
+
}
|
|
614
|
+
],
|
|
615
|
+
properties: [
|
|
616
|
+
// ===== OPERATION SELECTOR =====
|
|
617
|
+
{
|
|
618
|
+
displayName: 'Operation',
|
|
619
|
+
name: 'operation',
|
|
620
|
+
type: 'options',
|
|
621
|
+
options: [
|
|
622
|
+
{ name: 'Chat History', value: 'chat_history' },
|
|
623
|
+
{ name: 'Search Groups', value: 'search_groups' },
|
|
624
|
+
{ name: 'Get Group Info', value: 'get_group_info' },
|
|
625
|
+
{ name: 'Get Contact Info', value: 'get_contact_info' },
|
|
626
|
+
{ name: 'List Contacts', value: 'list_contacts' },
|
|
627
|
+
{ name: 'Check Contacts', value: 'check_contacts' }
|
|
628
|
+
],
|
|
629
|
+
default: 'chat_history',
|
|
630
|
+
description: 'Operation to perform'
|
|
631
|
+
},
|
|
632
|
+
|
|
633
|
+
// ===== CHAT HISTORY PARAMETERS =====
|
|
634
|
+
{
|
|
635
|
+
displayName: 'Chat Type',
|
|
636
|
+
name: 'chat_type',
|
|
637
|
+
type: 'options',
|
|
638
|
+
options: [
|
|
639
|
+
{ name: 'Individual Chat', value: 'individual' },
|
|
640
|
+
{ name: 'Group Chat', value: 'group' }
|
|
641
|
+
],
|
|
642
|
+
default: 'individual',
|
|
643
|
+
description: 'Type of chat to retrieve history from',
|
|
644
|
+
displayOptions: {
|
|
645
|
+
show: { operation: ['chat_history'] }
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
displayName: 'Phone Number',
|
|
650
|
+
name: 'phone',
|
|
651
|
+
type: 'string',
|
|
652
|
+
default: '',
|
|
653
|
+
required: true,
|
|
654
|
+
placeholder: '1234567890',
|
|
655
|
+
description: 'Phone number of the contact (without + prefix)',
|
|
656
|
+
displayOptions: {
|
|
657
|
+
show: { operation: ['chat_history'], chat_type: ['individual'] }
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
displayName: 'Group',
|
|
662
|
+
name: 'group_id',
|
|
663
|
+
type: 'string',
|
|
664
|
+
default: '',
|
|
665
|
+
required: true,
|
|
666
|
+
placeholder: '123456789@g.us',
|
|
667
|
+
description: 'Group JID',
|
|
668
|
+
displayOptions: {
|
|
669
|
+
show: { operation: ['chat_history', 'get_group_info'], chat_type: ['group'] }
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
displayName: 'Message Filter',
|
|
674
|
+
name: 'group_filter',
|
|
675
|
+
type: 'options',
|
|
676
|
+
options: [
|
|
677
|
+
{ name: 'All Messages', value: 'all' },
|
|
678
|
+
{ name: 'From Specific Contact', value: 'contact' }
|
|
679
|
+
],
|
|
680
|
+
default: 'all',
|
|
681
|
+
description: 'Filter messages in group',
|
|
682
|
+
displayOptions: {
|
|
683
|
+
show: { operation: ['chat_history'], chat_type: ['group'] }
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
displayName: 'Sender Phone',
|
|
688
|
+
name: 'sender_phone',
|
|
689
|
+
type: 'string',
|
|
690
|
+
default: '',
|
|
691
|
+
placeholder: '1234567890',
|
|
692
|
+
description: 'Filter messages from specific group member',
|
|
693
|
+
displayOptions: {
|
|
694
|
+
show: { operation: ['chat_history'], chat_type: ['group'], group_filter: ['contact'] }
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
displayName: 'Message Type',
|
|
699
|
+
name: 'message_filter',
|
|
700
|
+
type: 'options',
|
|
701
|
+
options: [
|
|
702
|
+
{ name: 'All Types', value: 'all' },
|
|
703
|
+
{ name: 'Text Only', value: 'text_only' }
|
|
704
|
+
],
|
|
705
|
+
default: 'all',
|
|
706
|
+
description: 'Filter by message type',
|
|
707
|
+
displayOptions: {
|
|
708
|
+
show: { operation: ['chat_history'] }
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
displayName: 'Limit',
|
|
713
|
+
name: 'limit',
|
|
714
|
+
type: 'number',
|
|
715
|
+
default: 50,
|
|
716
|
+
typeOptions: { minValue: 1, maxValue: 500 },
|
|
717
|
+
description: 'Maximum number of messages to retrieve (1-500)',
|
|
718
|
+
displayOptions: {
|
|
719
|
+
show: { operation: ['chat_history'] }
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
displayName: 'Offset',
|
|
724
|
+
name: 'offset',
|
|
725
|
+
type: 'number',
|
|
726
|
+
default: 0,
|
|
727
|
+
typeOptions: { minValue: 0 },
|
|
728
|
+
description: 'Number of messages to skip (for pagination)',
|
|
729
|
+
displayOptions: {
|
|
730
|
+
show: { operation: ['chat_history'] }
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
|
|
734
|
+
// ===== SEARCH GROUPS PARAMETERS =====
|
|
735
|
+
{
|
|
736
|
+
displayName: 'Search Query',
|
|
737
|
+
name: 'query',
|
|
738
|
+
type: 'string',
|
|
739
|
+
default: '',
|
|
740
|
+
placeholder: 'Family, Work, etc.',
|
|
741
|
+
description: 'Search groups by name (leave empty for all groups)',
|
|
742
|
+
displayOptions: {
|
|
743
|
+
show: { operation: ['search_groups', 'list_contacts'] }
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
|
|
747
|
+
// ===== GET GROUP INFO PARAMETERS =====
|
|
748
|
+
{
|
|
749
|
+
displayName: 'Group',
|
|
750
|
+
name: 'group_id_for_info',
|
|
751
|
+
type: 'string',
|
|
752
|
+
default: '',
|
|
753
|
+
required: true,
|
|
754
|
+
placeholder: '123456789@g.us',
|
|
755
|
+
description: 'Group JID to get info for',
|
|
756
|
+
displayOptions: {
|
|
757
|
+
show: { operation: ['get_group_info'] }
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
|
|
761
|
+
// ===== GET CONTACT INFO PARAMETERS =====
|
|
762
|
+
{
|
|
763
|
+
displayName: 'Phone Number',
|
|
764
|
+
name: 'contact_phone',
|
|
765
|
+
type: 'string',
|
|
766
|
+
default: '',
|
|
767
|
+
required: true,
|
|
768
|
+
placeholder: '1234567890',
|
|
769
|
+
description: 'Phone number to get contact info for',
|
|
770
|
+
displayOptions: {
|
|
771
|
+
show: { operation: ['get_contact_info'] }
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
|
|
775
|
+
// ===== CHECK CONTACTS PARAMETERS =====
|
|
776
|
+
{
|
|
777
|
+
displayName: 'Phone Numbers',
|
|
778
|
+
name: 'phones',
|
|
779
|
+
type: 'string',
|
|
780
|
+
default: '',
|
|
781
|
+
required: true,
|
|
782
|
+
placeholder: '1234567890, 0987654321',
|
|
783
|
+
description: 'Comma-separated phone numbers to check WhatsApp registration',
|
|
784
|
+
displayOptions: {
|
|
785
|
+
show: { operation: ['check_contacts'] }
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
],
|
|
789
|
+
methods: {
|
|
790
|
+
loadOptions: {
|
|
791
|
+
async getWhatsAppGroups(): Promise<Array<{name: string, value: string, description?: string}>> {
|
|
792
|
+
try {
|
|
793
|
+
const response = await wsRequest('whatsapp_groups') as { success: boolean; groups?: Array<{ jid: string; name: string; participant_count?: number; is_community?: boolean }> };
|
|
794
|
+
|
|
795
|
+
if (response.success && response.groups) {
|
|
796
|
+
const regularGroups = response.groups.filter((group) => !group.is_community);
|
|
797
|
+
if (regularGroups.length === 0) {
|
|
798
|
+
return [{ name: 'No groups found', value: '', description: 'Only communities found' }];
|
|
799
|
+
}
|
|
800
|
+
return regularGroups.map((group) => ({
|
|
801
|
+
name: group.name || group.jid,
|
|
802
|
+
value: group.jid,
|
|
803
|
+
description: group.participant_count ? `${group.participant_count} members` : undefined
|
|
804
|
+
}));
|
|
805
|
+
}
|
|
806
|
+
return [{ name: 'No groups found', value: '', description: 'Connect WhatsApp first' }];
|
|
807
|
+
} catch (error) {
|
|
808
|
+
console.error('Error loading WhatsApp groups:', error);
|
|
809
|
+
return [{ name: 'Error loading groups', value: '', description: 'Check WhatsApp connection' }];
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
// ============================================================================
|
|
818
|
+
// EXPORTS
|
|
819
|
+
// ============================================================================
|
|
820
|
+
|
|
821
|
+
export const WHATSAPP_NODE_TYPES = ['whatsappSend', 'whatsappReceive', 'whatsappDb'];
|