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.
Files changed (422) hide show
  1. package/.env.template +71 -71
  2. package/LICENSE +21 -21
  3. package/README.md +163 -87
  4. package/bin/cli.js +62 -106
  5. package/client/.dockerignore +45 -45
  6. package/client/Dockerfile +68 -68
  7. package/client/dist/assets/index-DFSC53FP.css +1 -0
  8. package/client/dist/assets/index-fJ-1gTf5.js +613 -0
  9. package/client/dist/index.html +14 -0
  10. package/client/eslint.config.js +34 -16
  11. package/client/nginx.conf +66 -66
  12. package/client/package.json +61 -48
  13. package/client/src/App.tsx +27 -27
  14. package/client/src/Dashboard.tsx +1200 -1172
  15. package/client/src/ParameterPanel.tsx +302 -300
  16. package/client/src/components/AIAgentNode.tsx +315 -321
  17. package/client/src/components/APIKeyValidator.tsx +117 -117
  18. package/client/src/components/ClaudeChatModelNode.tsx +17 -17
  19. package/client/src/components/CredentialsModal.tsx +1200 -306
  20. package/client/src/components/GeminiChatModelNode.tsx +17 -17
  21. package/client/src/components/GenericNode.tsx +356 -356
  22. package/client/src/components/LocationParameterPanel.tsx +153 -153
  23. package/client/src/components/ModelNode.tsx +285 -285
  24. package/client/src/components/OpenAIChatModelNode.tsx +17 -17
  25. package/client/src/components/OutputPanel.tsx +470 -470
  26. package/client/src/components/ParameterRenderer.tsx +1873 -1873
  27. package/client/src/components/SkillEditorModal.tsx +3 -3
  28. package/client/src/components/SquareNode.tsx +812 -796
  29. package/client/src/components/ToolkitNode.tsx +365 -365
  30. package/client/src/components/auth/LoginPage.tsx +247 -247
  31. package/client/src/components/auth/ProtectedRoute.tsx +59 -59
  32. package/client/src/components/base/BaseChatModelNode.tsx +270 -270
  33. package/client/src/components/icons/AIProviderIcons.tsx +50 -50
  34. package/client/src/components/maps/GoogleMapsPicker.tsx +136 -136
  35. package/client/src/components/maps/MapsPreviewPanel.tsx +109 -109
  36. package/client/src/components/maps/index.ts +25 -25
  37. package/client/src/components/parameterPanel/InputSection.tsx +1094 -1094
  38. package/client/src/components/parameterPanel/LocationPanelLayout.tsx +64 -64
  39. package/client/src/components/parameterPanel/MapsSection.tsx +91 -91
  40. package/client/src/components/parameterPanel/MiddleSection.tsx +867 -571
  41. package/client/src/components/parameterPanel/OutputSection.tsx +80 -80
  42. package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +81 -81
  43. package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -436
  44. package/client/src/components/parameterPanel/index.ts +41 -41
  45. package/client/src/components/shared/DataPanel.tsx +142 -142
  46. package/client/src/components/shared/JSONTreeRenderer.tsx +105 -105
  47. package/client/src/components/ui/AIResultModal.tsx +203 -203
  48. package/client/src/components/ui/ApiKeyInput.tsx +93 -0
  49. package/client/src/components/ui/CodeEditor.tsx +81 -81
  50. package/client/src/components/ui/CollapsibleSection.tsx +87 -87
  51. package/client/src/components/ui/ComponentItem.tsx +153 -153
  52. package/client/src/components/ui/ComponentPalette.tsx +320 -320
  53. package/client/src/components/ui/ConsolePanel.tsx +151 -43
  54. package/client/src/components/ui/ErrorBoundary.tsx +195 -195
  55. package/client/src/components/ui/InputNodesPanel.tsx +203 -203
  56. package/client/src/components/ui/MapSelector.tsx +313 -313
  57. package/client/src/components/ui/Modal.tsx +151 -148
  58. package/client/src/components/ui/NodeOutputPanel.tsx +1150 -1150
  59. package/client/src/components/ui/OutputDisplayPanel.tsx +381 -381
  60. package/client/src/components/ui/QRCodeDisplay.tsx +182 -0
  61. package/client/src/components/ui/TopToolbar.tsx +736 -736
  62. package/client/src/components/ui/WorkflowSidebar.tsx +293 -293
  63. package/client/src/config/antdTheme.ts +186 -186
  64. package/client/src/contexts/AuthContext.tsx +221 -221
  65. package/client/src/contexts/ThemeContext.tsx +42 -42
  66. package/client/src/contexts/WebSocketContext.tsx +2144 -1971
  67. package/client/src/factories/baseChatModelFactory.ts +255 -255
  68. package/client/src/hooks/useAndroidOperations.ts +118 -164
  69. package/client/src/hooks/useApiKeyValidation.ts +106 -106
  70. package/client/src/hooks/useApiKeys.ts +238 -238
  71. package/client/src/hooks/useAppTheme.ts +17 -17
  72. package/client/src/hooks/useComponentPalette.ts +50 -50
  73. package/client/src/hooks/useDragAndDrop.ts +123 -123
  74. package/client/src/hooks/useDragVariable.ts +88 -88
  75. package/client/src/hooks/useExecution.ts +319 -313
  76. package/client/src/hooks/useParameterPanel.ts +176 -176
  77. package/client/src/hooks/useReactFlowNodes.ts +188 -188
  78. package/client/src/hooks/useToolSchema.ts +209 -209
  79. package/client/src/hooks/useWhatsApp.ts +196 -196
  80. package/client/src/hooks/useWorkflowManagement.ts +45 -45
  81. package/client/src/index.css +314 -314
  82. package/client/src/nodeDefinitions/aiAgentNodes.ts +335 -335
  83. package/client/src/nodeDefinitions/aiModelNodes.ts +340 -340
  84. package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -383
  85. package/client/src/nodeDefinitions/chatNodes.ts +135 -135
  86. package/client/src/nodeDefinitions/codeNodes.ts +54 -54
  87. package/client/src/nodeDefinitions/index.ts +14 -14
  88. package/client/src/nodeDefinitions/locationNodes.ts +462 -462
  89. package/client/src/nodeDefinitions/schedulerNodes.ts +220 -220
  90. package/client/src/nodeDefinitions/skillNodes.ts +17 -5
  91. package/client/src/nodeDefinitions/utilityNodes.ts +284 -284
  92. package/client/src/nodeDefinitions/whatsappNodes.ts +821 -865
  93. package/client/src/nodeDefinitions.ts +101 -103
  94. package/client/src/services/dynamicParameterService.ts +95 -95
  95. package/client/src/services/execution/aiAgentExecutionService.ts +34 -34
  96. package/client/src/services/executionService.ts +227 -231
  97. package/client/src/services/workflowApi.ts +91 -91
  98. package/client/src/store/useAppStore.ts +578 -581
  99. package/client/src/styles/theme.ts +513 -508
  100. package/client/src/styles/zIndex.ts +16 -16
  101. package/client/src/types/ComponentTypes.ts +38 -38
  102. package/client/src/types/INodeProperties.ts +287 -287
  103. package/client/src/types/NodeTypes.ts +27 -27
  104. package/client/src/utils/formatters.ts +32 -32
  105. package/client/src/utils/googleMapsLoader.ts +139 -139
  106. package/client/src/utils/locationUtils.ts +84 -84
  107. package/client/src/utils/nodeUtils.ts +30 -30
  108. package/client/src/utils/workflow.ts +29 -29
  109. package/client/src/vite-env.d.ts +12 -12
  110. package/client/tailwind.config.js +59 -59
  111. package/client/tsconfig.json +25 -25
  112. package/client/vite.config.js +35 -35
  113. package/install.ps1 +308 -0
  114. package/install.sh +343 -0
  115. package/package.json +81 -70
  116. package/scripts/build.js +174 -51
  117. package/scripts/clean.js +40 -40
  118. package/scripts/start.js +234 -210
  119. package/scripts/stop.js +301 -325
  120. package/server/.dockerignore +44 -44
  121. package/server/Dockerfile +45 -45
  122. package/server/constants.py +244 -249
  123. package/server/core/cache.py +460 -460
  124. package/server/core/config.py +127 -127
  125. package/server/core/container.py +98 -98
  126. package/server/core/database.py +1296 -1210
  127. package/server/core/logging.py +313 -313
  128. package/server/main.py +288 -288
  129. package/server/middleware/__init__.py +5 -5
  130. package/server/middleware/auth.py +89 -89
  131. package/server/models/auth.py +52 -52
  132. package/server/models/cache.py +24 -24
  133. package/server/models/database.py +235 -210
  134. package/server/models/nodes.py +435 -455
  135. package/server/pyproject.toml +75 -72
  136. package/server/requirements.txt +83 -83
  137. package/server/routers/android.py +294 -294
  138. package/server/routers/auth.py +203 -203
  139. package/server/routers/database.py +150 -150
  140. package/server/routers/maps.py +141 -141
  141. package/server/routers/nodejs_compat.py +288 -288
  142. package/server/routers/webhook.py +90 -90
  143. package/server/routers/websocket.py +2239 -2127
  144. package/server/routers/whatsapp.py +761 -761
  145. package/server/routers/workflow.py +199 -199
  146. package/server/services/ai.py +2444 -2414
  147. package/server/services/android_service.py +588 -588
  148. package/server/services/auth.py +130 -130
  149. package/server/services/chat_client.py +160 -160
  150. package/server/services/deployment/manager.py +706 -706
  151. package/server/services/event_waiter.py +675 -785
  152. package/server/services/execution/executor.py +1351 -1351
  153. package/server/services/execution/models.py +1 -1
  154. package/server/services/handlers/__init__.py +122 -126
  155. package/server/services/handlers/ai.py +390 -355
  156. package/server/services/handlers/android.py +69 -260
  157. package/server/services/handlers/code.py +278 -278
  158. package/server/services/handlers/http.py +193 -193
  159. package/server/services/handlers/tools.py +146 -32
  160. package/server/services/handlers/triggers.py +107 -107
  161. package/server/services/handlers/utility.py +822 -822
  162. package/server/services/handlers/whatsapp.py +423 -476
  163. package/server/services/maps.py +288 -288
  164. package/server/services/memory_store.py +103 -103
  165. package/server/services/node_executor.py +372 -375
  166. package/server/services/scheduler.py +155 -155
  167. package/server/services/skill_loader.py +1 -1
  168. package/server/services/status_broadcaster.py +834 -826
  169. package/server/services/temporal/__init__.py +23 -23
  170. package/server/services/temporal/activities.py +344 -344
  171. package/server/services/temporal/client.py +76 -76
  172. package/server/services/temporal/executor.py +147 -147
  173. package/server/services/temporal/worker.py +251 -251
  174. package/server/services/temporal/workflow.py +355 -355
  175. package/server/services/temporal/ws_client.py +236 -236
  176. package/server/services/text.py +110 -110
  177. package/server/services/user_auth.py +172 -172
  178. package/server/services/websocket_client.py +29 -29
  179. package/server/services/workflow.py +597 -597
  180. package/server/skills/android-skill/SKILL.md +4 -4
  181. package/server/skills/code-skill/SKILL.md +123 -89
  182. package/server/skills/maps-skill/SKILL.md +3 -3
  183. package/server/skills/memory-skill/SKILL.md +1 -1
  184. package/server/skills/web-search-skill/SKILL.md +154 -0
  185. package/server/skills/whatsapp-skill/SKILL.md +3 -3
  186. package/server/uv.lock +461 -100
  187. package/server/whatsapp-rpc/.dockerignore +30 -30
  188. package/server/whatsapp-rpc/Dockerfile +44 -44
  189. package/server/whatsapp-rpc/Dockerfile.web +17 -17
  190. package/server/whatsapp-rpc/README.md +139 -139
  191. package/server/whatsapp-rpc/bin/whatsapp-rpc-server +0 -0
  192. package/server/whatsapp-rpc/cli.js +95 -95
  193. package/server/whatsapp-rpc/configs/config.yaml +6 -6
  194. package/server/whatsapp-rpc/docker-compose.yml +35 -35
  195. package/server/whatsapp-rpc/docs/API.md +410 -410
  196. package/server/whatsapp-rpc/node_modules/.package-lock.json +259 -0
  197. package/server/whatsapp-rpc/node_modules/chalk/license +9 -0
  198. package/server/whatsapp-rpc/node_modules/chalk/package.json +83 -0
  199. package/server/whatsapp-rpc/node_modules/chalk/readme.md +297 -0
  200. package/server/whatsapp-rpc/node_modules/chalk/source/index.d.ts +325 -0
  201. package/server/whatsapp-rpc/node_modules/chalk/source/index.js +225 -0
  202. package/server/whatsapp-rpc/node_modules/chalk/source/utilities.js +33 -0
  203. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  204. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  205. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  206. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
  207. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  208. package/server/whatsapp-rpc/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
  209. package/server/whatsapp-rpc/node_modules/commander/LICENSE +22 -0
  210. package/server/whatsapp-rpc/node_modules/commander/Readme.md +1148 -0
  211. package/server/whatsapp-rpc/node_modules/commander/esm.mjs +16 -0
  212. package/server/whatsapp-rpc/node_modules/commander/index.js +26 -0
  213. package/server/whatsapp-rpc/node_modules/commander/lib/argument.js +145 -0
  214. package/server/whatsapp-rpc/node_modules/commander/lib/command.js +2179 -0
  215. package/server/whatsapp-rpc/node_modules/commander/lib/error.js +43 -0
  216. package/server/whatsapp-rpc/node_modules/commander/lib/help.js +462 -0
  217. package/server/whatsapp-rpc/node_modules/commander/lib/option.js +329 -0
  218. package/server/whatsapp-rpc/node_modules/commander/lib/suggestSimilar.js +100 -0
  219. package/server/whatsapp-rpc/node_modules/commander/package-support.json +16 -0
  220. package/server/whatsapp-rpc/node_modules/commander/package.json +80 -0
  221. package/server/whatsapp-rpc/node_modules/commander/typings/esm.d.mts +3 -0
  222. package/server/whatsapp-rpc/node_modules/commander/typings/index.d.ts +884 -0
  223. package/server/whatsapp-rpc/node_modules/cross-spawn/LICENSE +21 -0
  224. package/server/whatsapp-rpc/node_modules/cross-spawn/README.md +89 -0
  225. package/server/whatsapp-rpc/node_modules/cross-spawn/index.js +39 -0
  226. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/enoent.js +59 -0
  227. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/parse.js +91 -0
  228. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/escape.js +47 -0
  229. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  230. package/server/whatsapp-rpc/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  231. package/server/whatsapp-rpc/node_modules/cross-spawn/package.json +73 -0
  232. package/server/whatsapp-rpc/node_modules/execa/index.d.ts +955 -0
  233. package/server/whatsapp-rpc/node_modules/execa/index.js +309 -0
  234. package/server/whatsapp-rpc/node_modules/execa/lib/command.js +119 -0
  235. package/server/whatsapp-rpc/node_modules/execa/lib/error.js +87 -0
  236. package/server/whatsapp-rpc/node_modules/execa/lib/kill.js +102 -0
  237. package/server/whatsapp-rpc/node_modules/execa/lib/pipe.js +42 -0
  238. package/server/whatsapp-rpc/node_modules/execa/lib/promise.js +36 -0
  239. package/server/whatsapp-rpc/node_modules/execa/lib/stdio.js +49 -0
  240. package/server/whatsapp-rpc/node_modules/execa/lib/stream.js +133 -0
  241. package/server/whatsapp-rpc/node_modules/execa/lib/verbose.js +19 -0
  242. package/server/whatsapp-rpc/node_modules/execa/license +9 -0
  243. package/server/whatsapp-rpc/node_modules/execa/package.json +90 -0
  244. package/server/whatsapp-rpc/node_modules/execa/readme.md +822 -0
  245. package/server/whatsapp-rpc/node_modules/get-stream/license +9 -0
  246. package/server/whatsapp-rpc/node_modules/get-stream/package.json +53 -0
  247. package/server/whatsapp-rpc/node_modules/get-stream/readme.md +291 -0
  248. package/server/whatsapp-rpc/node_modules/get-stream/source/array-buffer.js +84 -0
  249. package/server/whatsapp-rpc/node_modules/get-stream/source/array.js +32 -0
  250. package/server/whatsapp-rpc/node_modules/get-stream/source/buffer.js +20 -0
  251. package/server/whatsapp-rpc/node_modules/get-stream/source/contents.js +101 -0
  252. package/server/whatsapp-rpc/node_modules/get-stream/source/index.d.ts +119 -0
  253. package/server/whatsapp-rpc/node_modules/get-stream/source/index.js +5 -0
  254. package/server/whatsapp-rpc/node_modules/get-stream/source/string.js +36 -0
  255. package/server/whatsapp-rpc/node_modules/get-stream/source/utils.js +11 -0
  256. package/server/whatsapp-rpc/node_modules/get-them-args/LICENSE +21 -0
  257. package/server/whatsapp-rpc/node_modules/get-them-args/README.md +95 -0
  258. package/server/whatsapp-rpc/node_modules/get-them-args/index.js +97 -0
  259. package/server/whatsapp-rpc/node_modules/get-them-args/package.json +36 -0
  260. package/server/whatsapp-rpc/node_modules/human-signals/LICENSE +201 -0
  261. package/server/whatsapp-rpc/node_modules/human-signals/README.md +168 -0
  262. package/server/whatsapp-rpc/node_modules/human-signals/build/src/core.js +273 -0
  263. package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.d.ts +73 -0
  264. package/server/whatsapp-rpc/node_modules/human-signals/build/src/main.js +70 -0
  265. package/server/whatsapp-rpc/node_modules/human-signals/build/src/realtime.js +16 -0
  266. package/server/whatsapp-rpc/node_modules/human-signals/build/src/signals.js +34 -0
  267. package/server/whatsapp-rpc/node_modules/human-signals/package.json +61 -0
  268. package/server/whatsapp-rpc/node_modules/is-stream/index.d.ts +81 -0
  269. package/server/whatsapp-rpc/node_modules/is-stream/index.js +29 -0
  270. package/server/whatsapp-rpc/node_modules/is-stream/license +9 -0
  271. package/server/whatsapp-rpc/node_modules/is-stream/package.json +44 -0
  272. package/server/whatsapp-rpc/node_modules/is-stream/readme.md +60 -0
  273. package/server/whatsapp-rpc/node_modules/isexe/LICENSE +15 -0
  274. package/server/whatsapp-rpc/node_modules/isexe/README.md +51 -0
  275. package/server/whatsapp-rpc/node_modules/isexe/index.js +57 -0
  276. package/server/whatsapp-rpc/node_modules/isexe/mode.js +41 -0
  277. package/server/whatsapp-rpc/node_modules/isexe/package.json +31 -0
  278. package/server/whatsapp-rpc/node_modules/isexe/test/basic.js +221 -0
  279. package/server/whatsapp-rpc/node_modules/isexe/windows.js +42 -0
  280. package/server/whatsapp-rpc/node_modules/kill-port/.editorconfig +12 -0
  281. package/server/whatsapp-rpc/node_modules/kill-port/.gitattributes +1 -0
  282. package/server/whatsapp-rpc/node_modules/kill-port/LICENSE +21 -0
  283. package/server/whatsapp-rpc/node_modules/kill-port/README.md +140 -0
  284. package/server/whatsapp-rpc/node_modules/kill-port/cli.js +25 -0
  285. package/server/whatsapp-rpc/node_modules/kill-port/example.js +21 -0
  286. package/server/whatsapp-rpc/node_modules/kill-port/index.js +46 -0
  287. package/server/whatsapp-rpc/node_modules/kill-port/logo.png +0 -0
  288. package/server/whatsapp-rpc/node_modules/kill-port/package.json +41 -0
  289. package/server/whatsapp-rpc/node_modules/kill-port/pnpm-lock.yaml +4606 -0
  290. package/server/whatsapp-rpc/node_modules/kill-port/test.js +16 -0
  291. package/server/whatsapp-rpc/node_modules/merge-stream/LICENSE +21 -0
  292. package/server/whatsapp-rpc/node_modules/merge-stream/README.md +78 -0
  293. package/server/whatsapp-rpc/node_modules/merge-stream/index.js +41 -0
  294. package/server/whatsapp-rpc/node_modules/merge-stream/package.json +19 -0
  295. package/server/whatsapp-rpc/node_modules/mimic-fn/index.d.ts +52 -0
  296. package/server/whatsapp-rpc/node_modules/mimic-fn/index.js +71 -0
  297. package/server/whatsapp-rpc/node_modules/mimic-fn/license +9 -0
  298. package/server/whatsapp-rpc/node_modules/mimic-fn/package.json +45 -0
  299. package/server/whatsapp-rpc/node_modules/mimic-fn/readme.md +90 -0
  300. package/server/whatsapp-rpc/node_modules/npm-run-path/index.d.ts +90 -0
  301. package/server/whatsapp-rpc/node_modules/npm-run-path/index.js +52 -0
  302. package/server/whatsapp-rpc/node_modules/npm-run-path/license +9 -0
  303. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.d.ts +31 -0
  304. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/index.js +12 -0
  305. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/license +9 -0
  306. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/package.json +41 -0
  307. package/server/whatsapp-rpc/node_modules/npm-run-path/node_modules/path-key/readme.md +57 -0
  308. package/server/whatsapp-rpc/node_modules/npm-run-path/package.json +49 -0
  309. package/server/whatsapp-rpc/node_modules/npm-run-path/readme.md +104 -0
  310. package/server/whatsapp-rpc/node_modules/onetime/index.d.ts +59 -0
  311. package/server/whatsapp-rpc/node_modules/onetime/index.js +41 -0
  312. package/server/whatsapp-rpc/node_modules/onetime/license +9 -0
  313. package/server/whatsapp-rpc/node_modules/onetime/package.json +45 -0
  314. package/server/whatsapp-rpc/node_modules/onetime/readme.md +94 -0
  315. package/server/whatsapp-rpc/node_modules/path-key/index.d.ts +40 -0
  316. package/server/whatsapp-rpc/node_modules/path-key/index.js +16 -0
  317. package/server/whatsapp-rpc/node_modules/path-key/license +9 -0
  318. package/server/whatsapp-rpc/node_modules/path-key/package.json +39 -0
  319. package/server/whatsapp-rpc/node_modules/path-key/readme.md +61 -0
  320. package/server/whatsapp-rpc/node_modules/shebang-command/index.js +19 -0
  321. package/server/whatsapp-rpc/node_modules/shebang-command/license +9 -0
  322. package/server/whatsapp-rpc/node_modules/shebang-command/package.json +34 -0
  323. package/server/whatsapp-rpc/node_modules/shebang-command/readme.md +34 -0
  324. package/server/whatsapp-rpc/node_modules/shebang-regex/index.d.ts +22 -0
  325. package/server/whatsapp-rpc/node_modules/shebang-regex/index.js +2 -0
  326. package/server/whatsapp-rpc/node_modules/shebang-regex/license +9 -0
  327. package/server/whatsapp-rpc/node_modules/shebang-regex/package.json +35 -0
  328. package/server/whatsapp-rpc/node_modules/shebang-regex/readme.md +33 -0
  329. package/server/whatsapp-rpc/node_modules/shell-exec/LICENSE +21 -0
  330. package/server/whatsapp-rpc/node_modules/shell-exec/README.md +60 -0
  331. package/server/whatsapp-rpc/node_modules/shell-exec/index.js +47 -0
  332. package/server/whatsapp-rpc/node_modules/shell-exec/package.json +29 -0
  333. package/server/whatsapp-rpc/node_modules/signal-exit/LICENSE.txt +16 -0
  334. package/server/whatsapp-rpc/node_modules/signal-exit/README.md +74 -0
  335. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
  336. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
  337. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js +10 -0
  338. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
  339. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
  340. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
  341. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js +279 -0
  342. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
  343. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/package.json +3 -0
  344. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
  345. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
  346. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js +42 -0
  347. package/server/whatsapp-rpc/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
  348. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
  349. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
  350. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js +4 -0
  351. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
  352. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
  353. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
  354. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js +275 -0
  355. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
  356. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/package.json +3 -0
  357. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
  358. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
  359. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js +39 -0
  360. package/server/whatsapp-rpc/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
  361. package/server/whatsapp-rpc/node_modules/signal-exit/package.json +106 -0
  362. package/server/whatsapp-rpc/node_modules/strip-final-newline/index.js +14 -0
  363. package/server/whatsapp-rpc/node_modules/strip-final-newline/license +9 -0
  364. package/server/whatsapp-rpc/node_modules/strip-final-newline/package.json +43 -0
  365. package/server/whatsapp-rpc/node_modules/strip-final-newline/readme.md +35 -0
  366. package/server/whatsapp-rpc/node_modules/which/CHANGELOG.md +166 -0
  367. package/server/whatsapp-rpc/node_modules/which/LICENSE +15 -0
  368. package/server/whatsapp-rpc/node_modules/which/README.md +54 -0
  369. package/server/whatsapp-rpc/node_modules/which/bin/node-which +52 -0
  370. package/server/whatsapp-rpc/node_modules/which/package.json +43 -0
  371. package/server/whatsapp-rpc/node_modules/which/which.js +125 -0
  372. package/server/whatsapp-rpc/package-lock.json +272 -0
  373. package/server/whatsapp-rpc/package.json +30 -30
  374. package/server/whatsapp-rpc/schema.json +1294 -1294
  375. package/server/whatsapp-rpc/scripts/clean.cjs +66 -66
  376. package/server/whatsapp-rpc/scripts/cli.js +162 -162
  377. package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -166
  378. package/server/whatsapp-rpc/src/python/pyproject.toml +15 -15
  379. package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -4
  380. package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -427
  381. package/server/whatsapp-rpc/web/app.py +609 -609
  382. package/server/whatsapp-rpc/web/requirements.txt +6 -6
  383. package/server/whatsapp-rpc/web/rpc_client.py +427 -427
  384. package/server/whatsapp-rpc/web/static/openapi.yaml +59 -59
  385. package/server/whatsapp-rpc/web/templates/base.html +149 -149
  386. package/server/whatsapp-rpc/web/templates/contacts.html +240 -240
  387. package/server/whatsapp-rpc/web/templates/dashboard.html +319 -319
  388. package/server/whatsapp-rpc/web/templates/groups.html +328 -328
  389. package/server/whatsapp-rpc/web/templates/messages.html +465 -465
  390. package/server/whatsapp-rpc/web/templates/messaging.html +680 -680
  391. package/server/whatsapp-rpc/web/templates/send.html +258 -258
  392. package/server/whatsapp-rpc/web/templates/settings.html +459 -459
  393. package/client/src/components/ui/AndroidSettingsPanel.tsx +0 -401
  394. package/client/src/components/ui/WhatsAppSettingsPanel.tsx +0 -345
  395. package/client/src/nodeDefinitions/androidDeviceNodes.ts +0 -140
  396. package/docker-compose.prod.yml +0 -107
  397. package/docker-compose.yml +0 -104
  398. package/docs-MachinaOs/README.md +0 -85
  399. package/docs-MachinaOs/deployment/docker.mdx +0 -228
  400. package/docs-MachinaOs/deployment/production.mdx +0 -345
  401. package/docs-MachinaOs/docs.json +0 -75
  402. package/docs-MachinaOs/faq.mdx +0 -309
  403. package/docs-MachinaOs/favicon.svg +0 -5
  404. package/docs-MachinaOs/installation.mdx +0 -160
  405. package/docs-MachinaOs/introduction.mdx +0 -114
  406. package/docs-MachinaOs/logo/dark.svg +0 -6
  407. package/docs-MachinaOs/logo/light.svg +0 -6
  408. package/docs-MachinaOs/nodes/ai-agent.mdx +0 -216
  409. package/docs-MachinaOs/nodes/ai-models.mdx +0 -240
  410. package/docs-MachinaOs/nodes/android.mdx +0 -411
  411. package/docs-MachinaOs/nodes/overview.mdx +0 -181
  412. package/docs-MachinaOs/nodes/schedulers.mdx +0 -316
  413. package/docs-MachinaOs/nodes/webhooks.mdx +0 -330
  414. package/docs-MachinaOs/nodes/whatsapp.mdx +0 -305
  415. package/docs-MachinaOs/quickstart.mdx +0 -119
  416. package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +0 -177
  417. package/docs-MachinaOs/tutorials/android-automation.mdx +0 -242
  418. package/docs-MachinaOs/tutorials/first-workflow.mdx +0 -134
  419. package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +0 -185
  420. package/nul +0 -0
  421. package/scripts/check-ports.ps1 +0 -33
  422. 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 Connection/Auth Node
389
- whatsappConnect: {
390
- displayName: 'WhatsApp Connect',
391
- name: 'whatsappConnect',
392
- icon: WHATSAPP_CONNECT_ICON,
393
- group: ['whatsapp'],
394
- version: 1,
395
- subtitle: 'WhatsApp Status',
396
- description: 'Check WhatsApp connection status (QR code authentication removed - use external WhatsApp service)',
397
- defaults: { name: 'WhatsApp Connect', color: '#128C7E' },
398
- inputs: [],
399
- outputs: [{
400
- name: 'main',
401
- displayName: 'Output',
402
- type: 'main' as NodeConnectionType,
403
- description: 'Connection output'
404
- }],
405
- properties: [
406
- {
407
- displayName: 'Connection Type',
408
- name: 'connectionType',
409
- type: 'options',
410
- options: [
411
- {
412
- name: 'Scan QR Code',
413
- value: 'qr_code'
414
- },
415
- {
416
- name: 'Use Existing Session',
417
- value: 'existing'
418
- }
419
- ],
420
- default: 'qr_code',
421
- description: 'How to connect to WhatsApp'
422
- },
423
- {
424
- displayName: 'Session Info',
425
- name: 'sessionInfo',
426
- type: 'notice',
427
- default: 'Session will persist across workflow runs. Re-authentication required approximately every 20 days.'
428
- }
429
- ]
430
- },
431
-
432
- // WhatsApp Receive Message - triggers workflow on incoming messages
433
- whatsappReceive: {
434
- displayName: 'WhatsApp Receive',
435
- name: 'whatsappReceive',
436
- icon: WHATSAPP_RECEIVE_ICON,
437
- group: ['whatsapp', 'trigger'],
438
- version: 1,
439
- subtitle: 'On Message Received',
440
- description: 'Trigger workflow when WhatsApp message is received. Outputs message data including sender, content, and metadata.',
441
- defaults: { name: 'WhatsApp Receive', color: '#075E54' },
442
- inputs: [],
443
- outputs: [{
444
- name: 'main',
445
- displayName: 'Message',
446
- type: 'main' as NodeConnectionType,
447
- 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)'
448
- }],
449
- properties: [
450
- // ===== MESSAGE TYPE FILTER =====
451
- {
452
- displayName: 'Message Type',
453
- name: 'messageTypeFilter',
454
- type: 'options',
455
- options: [
456
- { name: 'All Types', value: 'all' },
457
- { name: 'Text Only', value: 'text' },
458
- { name: 'Image Only', value: 'image' },
459
- { name: 'Video Only', value: 'video' },
460
- { name: 'Audio Only', value: 'audio' },
461
- { name: 'Document Only', value: 'document' },
462
- { name: 'Location Only', value: 'location' },
463
- { name: 'Contact Only', value: 'contact' }
464
- ],
465
- default: 'all',
466
- description: 'Filter by message content type'
467
- },
468
-
469
- // ===== SENDER FILTER =====
470
- {
471
- displayName: 'Sender Filter',
472
- name: 'filter',
473
- type: 'options',
474
- options: [
475
- { name: 'All Messages', value: 'all' },
476
- { name: 'From Any Contact (Non-Group)', value: 'any_contact' },
477
- { name: 'From Specific Contact', value: 'contact' },
478
- { name: 'From Specific Group', value: 'group' },
479
- { name: 'Contains Keywords', value: 'keywords' }
480
- ],
481
- default: 'all',
482
- description: 'Filter which messages trigger the workflow'
483
- },
484
- {
485
- displayName: 'Contact Phone',
486
- name: 'contactPhone',
487
- type: 'string',
488
- default: '',
489
- required: true,
490
- displayOptions: {
491
- show: { filter: ['contact'] }
492
- },
493
- placeholder: '1234567890',
494
- description: 'Phone number to filter messages from (without + prefix)'
495
- },
496
- {
497
- displayName: 'Group',
498
- name: 'group_id',
499
- type: 'string',
500
- default: '',
501
- required: true,
502
- displayOptions: {
503
- show: { filter: ['group'] }
504
- },
505
- placeholder: '123456789@g.us',
506
- description: 'Group JID to filter messages from (use Load button to select)'
507
- },
508
- {
509
- displayName: 'Sender Number',
510
- name: 'senderNumber',
511
- type: 'string',
512
- default: '',
513
- displayOptions: {
514
- show: { filter: ['group'] }
515
- },
516
- placeholder: '1234567890',
517
- description: 'Optional: Filter by sender phone number (use Load button to select from group members)'
518
- },
519
- {
520
- displayName: 'Keywords',
521
- name: 'keywords',
522
- type: 'string',
523
- default: '',
524
- required: true,
525
- displayOptions: {
526
- show: { filter: ['keywords'] }
527
- },
528
- placeholder: 'help, support, info',
529
- description: 'Comma-separated keywords to trigger on (case-insensitive)'
530
- },
531
-
532
- // ===== OPTIONS =====
533
- {
534
- displayName: 'Ignore Own Messages',
535
- name: 'ignoreOwnMessages',
536
- type: 'boolean',
537
- default: true,
538
- description: 'Do not trigger on messages sent by this device'
539
- },
540
- {
541
- displayName: 'Forwarded Messages',
542
- name: 'forwardedFilter',
543
- type: 'options',
544
- options: [
545
- { name: 'Include All', value: 'all' },
546
- { name: 'Only Forwarded', value: 'only_forwarded' },
547
- { name: 'Ignore Forwarded', value: 'ignore_forwarded' }
548
- ],
549
- default: 'all',
550
- description: 'Filter messages based on forwarded status'
551
- },
552
- {
553
- displayName: 'Include Media Data',
554
- name: 'includeMediaData',
555
- type: 'boolean',
556
- default: false,
557
- description: 'Include base64 media data in output (increases memory usage)'
558
- }
559
- ],
560
- methods: {
561
- loadOptions: {
562
- async getWhatsAppGroups(): Promise<Array<{name: string, value: string, description?: string}>> {
563
- try {
564
- const response = await wsRequest('whatsapp_groups') as { success: boolean; groups?: Array<{ jid: string; name: string; participant_count?: number; is_community?: boolean }> };
565
-
566
- if (response.success && response.groups) {
567
- // Filter out communities - they don't have regular chat history
568
- const regularGroups = response.groups.filter((group) => !group.is_community);
569
- if (regularGroups.length === 0) {
570
- return [{ name: 'No groups found', value: '', description: 'Only communities found (no chat history)' }];
571
- }
572
- return regularGroups.map((group) => ({
573
- name: group.name || group.jid,
574
- value: group.jid,
575
- description: group.participant_count ? `${group.participant_count} members` : undefined
576
- }));
577
- }
578
- return [{ name: 'No groups found', value: '', description: 'Connect WhatsApp first' }];
579
- } catch (error) {
580
- console.error('Error loading WhatsApp groups:', error);
581
- return [{ name: 'Error loading groups', value: '', description: 'Check WhatsApp connection' }];
582
- }
583
- },
584
-
585
- async getGroupMembers(this: { getCurrentNodeParameter: (name: string) => string }): Promise<Array<{name: string, value: string, description?: string}>> {
586
- try {
587
- const groupId = this.getCurrentNodeParameter('group_id');
588
- if (!groupId) {
589
- return [{ name: 'Select a group first', value: '', description: 'Choose a group above' }];
590
- }
591
-
592
- const response = await wsRequest('whatsapp_group_info', { group_id: groupId }) as {
593
- success: boolean;
594
- participants?: Array<{ phone: string; name: string; jid: string; is_admin?: boolean }>;
595
- name?: string;
596
- };
597
-
598
- if (response.success && response.participants && response.participants.length > 0) {
599
- // Add "All Members" option first
600
- const options: Array<{name: string, value: string, description?: string}> = [
601
- { name: 'All Members', value: '', description: 'Receive from anyone in group' }
602
- ];
603
-
604
- // Add each participant
605
- for (const p of response.participants) {
606
- const displayName = p.name || p.phone;
607
- const adminLabel = p.is_admin ? ' (Admin)' : '';
608
- options.push({
609
- name: `${displayName}${adminLabel}`,
610
- value: p.phone,
611
- description: p.phone
612
- });
613
- }
614
-
615
- return options;
616
- }
617
-
618
- return [{ name: 'No members found', value: '', description: 'Could not load group members' }];
619
- } catch (error) {
620
- console.error('Error loading group members:', error);
621
- return [{ name: 'Error loading members', value: '', description: 'Check WhatsApp connection' }];
622
- }
623
- }
624
- }
625
- }
626
- },
627
-
628
- // WhatsApp DB Node - Query contacts, groups, messages
629
- // Can be used as workflow node OR as AI Agent tool (group includes 'tool')
630
- whatsappDb: {
631
- displayName: 'WhatsApp DB',
632
- name: 'whatsappDb',
633
- icon: WHATSAPP_DB_ICON,
634
- group: ['whatsapp', 'tool'],
635
- version: 1,
636
- subtitle: 'Query WhatsApp',
637
- description: 'Query WhatsApp database - contacts, groups, messages, contact info',
638
- defaults: { name: 'WhatsApp DB', color: '#25D366' },
639
- inputs: [{
640
- name: 'main',
641
- displayName: 'Input',
642
- type: 'main' as NodeConnectionType,
643
- description: 'Trigger input'
644
- }],
645
- outputs: [
646
- {
647
- name: 'main',
648
- displayName: 'Output',
649
- type: 'main' as NodeConnectionType,
650
- description: 'Query result'
651
- },
652
- {
653
- name: 'tool',
654
- displayName: 'Tool',
655
- type: 'main' as NodeConnectionType,
656
- description: 'Connect to AI Agent tool handle'
657
- }
658
- ],
659
- properties: [
660
- // ===== OPERATION SELECTOR =====
661
- {
662
- displayName: 'Operation',
663
- name: 'operation',
664
- type: 'options',
665
- options: [
666
- { name: 'Chat History', value: 'chat_history' },
667
- { name: 'Search Groups', value: 'search_groups' },
668
- { name: 'Get Group Info', value: 'get_group_info' },
669
- { name: 'Get Contact Info', value: 'get_contact_info' },
670
- { name: 'List Contacts', value: 'list_contacts' },
671
- { name: 'Check Contacts', value: 'check_contacts' }
672
- ],
673
- default: 'chat_history',
674
- description: 'Operation to perform'
675
- },
676
-
677
- // ===== CHAT HISTORY PARAMETERS =====
678
- {
679
- displayName: 'Chat Type',
680
- name: 'chat_type',
681
- type: 'options',
682
- options: [
683
- { name: 'Individual Chat', value: 'individual' },
684
- { name: 'Group Chat', value: 'group' }
685
- ],
686
- default: 'individual',
687
- description: 'Type of chat to retrieve history from',
688
- displayOptions: {
689
- show: { operation: ['chat_history'] }
690
- }
691
- },
692
- {
693
- displayName: 'Phone Number',
694
- name: 'phone',
695
- type: 'string',
696
- default: '',
697
- required: true,
698
- placeholder: '1234567890',
699
- description: 'Phone number of the contact (without + prefix)',
700
- displayOptions: {
701
- show: { operation: ['chat_history'], chat_type: ['individual'] }
702
- }
703
- },
704
- {
705
- displayName: 'Group',
706
- name: 'group_id',
707
- type: 'string',
708
- default: '',
709
- required: true,
710
- placeholder: '123456789@g.us',
711
- description: 'Group JID',
712
- displayOptions: {
713
- show: { operation: ['chat_history', 'get_group_info'], chat_type: ['group'] }
714
- }
715
- },
716
- {
717
- displayName: 'Message Filter',
718
- name: 'group_filter',
719
- type: 'options',
720
- options: [
721
- { name: 'All Messages', value: 'all' },
722
- { name: 'From Specific Contact', value: 'contact' }
723
- ],
724
- default: 'all',
725
- description: 'Filter messages in group',
726
- displayOptions: {
727
- show: { operation: ['chat_history'], chat_type: ['group'] }
728
- }
729
- },
730
- {
731
- displayName: 'Sender Phone',
732
- name: 'sender_phone',
733
- type: 'string',
734
- default: '',
735
- placeholder: '1234567890',
736
- description: 'Filter messages from specific group member',
737
- displayOptions: {
738
- show: { operation: ['chat_history'], chat_type: ['group'], group_filter: ['contact'] }
739
- }
740
- },
741
- {
742
- displayName: 'Message Type',
743
- name: 'message_filter',
744
- type: 'options',
745
- options: [
746
- { name: 'All Types', value: 'all' },
747
- { name: 'Text Only', value: 'text_only' }
748
- ],
749
- default: 'all',
750
- description: 'Filter by message type',
751
- displayOptions: {
752
- show: { operation: ['chat_history'] }
753
- }
754
- },
755
- {
756
- displayName: 'Limit',
757
- name: 'limit',
758
- type: 'number',
759
- default: 50,
760
- typeOptions: { minValue: 1, maxValue: 500 },
761
- description: 'Maximum number of messages to retrieve (1-500)',
762
- displayOptions: {
763
- show: { operation: ['chat_history'] }
764
- }
765
- },
766
- {
767
- displayName: 'Offset',
768
- name: 'offset',
769
- type: 'number',
770
- default: 0,
771
- typeOptions: { minValue: 0 },
772
- description: 'Number of messages to skip (for pagination)',
773
- displayOptions: {
774
- show: { operation: ['chat_history'] }
775
- }
776
- },
777
-
778
- // ===== SEARCH GROUPS PARAMETERS =====
779
- {
780
- displayName: 'Search Query',
781
- name: 'query',
782
- type: 'string',
783
- default: '',
784
- placeholder: 'Family, Work, etc.',
785
- description: 'Search groups by name (leave empty for all groups)',
786
- displayOptions: {
787
- show: { operation: ['search_groups', 'list_contacts'] }
788
- }
789
- },
790
-
791
- // ===== GET GROUP INFO PARAMETERS =====
792
- {
793
- displayName: 'Group',
794
- name: 'group_id_for_info',
795
- type: 'string',
796
- default: '',
797
- required: true,
798
- placeholder: '123456789@g.us',
799
- description: 'Group JID to get info for',
800
- displayOptions: {
801
- show: { operation: ['get_group_info'] }
802
- }
803
- },
804
-
805
- // ===== GET CONTACT INFO PARAMETERS =====
806
- {
807
- displayName: 'Phone Number',
808
- name: 'contact_phone',
809
- type: 'string',
810
- default: '',
811
- required: true,
812
- placeholder: '1234567890',
813
- description: 'Phone number to get contact info for',
814
- displayOptions: {
815
- show: { operation: ['get_contact_info'] }
816
- }
817
- },
818
-
819
- // ===== CHECK CONTACTS PARAMETERS =====
820
- {
821
- displayName: 'Phone Numbers',
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'];