machinaos 0.0.10 → 0.0.13
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 +16 -0
- package/client/package.json +1 -1
- package/client/src/Dashboard.tsx +3 -3
- package/client/src/components/AIAgentNode.tsx +24 -12
- package/client/src/components/OutputPanel.tsx +3 -2
- package/client/src/components/parameterPanel/InputSection.tsx +16 -3
- package/client/src/nodeDefinitions/aiAgentNodes.ts +12 -0
- package/client/src/nodeDefinitions/specializedAgentNodes.ts +68 -320
- package/client/src/nodeDefinitions/toolNodes.ts +87 -1
- package/client/src/nodeDefinitions/workflowNodes.ts +55 -1
- package/package.json +12 -3
- package/scripts/daemon.js +427 -0
- package/scripts/start.js +7 -1
- package/scripts/sync-version.js +108 -0
- package/server/Dockerfile +6 -7
- package/server/constants.py +2 -0
- package/server/core/cleanup.py +123 -0
- package/server/core/config.py +16 -0
- package/server/core/database.py +92 -1
- package/server/core/health.py +121 -0
- package/server/examples/__init__.py +1 -0
- package/server/gunicorn.conf.py +46 -0
- package/server/main.py +38 -3
- package/server/models/database.py +1 -0
- package/server/models/nodes.py +18 -2
- package/server/requirements-docker.txt +86 -0
- package/server/routers/database.py +16 -0
- package/server/routers/websocket.py +6 -5
- package/server/services/ai.py +115 -14
- package/server/services/auth.py +6 -1
- package/server/services/deployment/manager.py +14 -0
- package/server/services/event_waiter.py +55 -0
- package/server/services/example_loader.py +60 -0
- package/server/services/execution/executor.py +2 -0
- package/server/services/execution/models.py +8 -0
- package/server/services/handlers/__init__.py +2 -0
- package/server/services/handlers/ai.py +164 -11
- package/server/services/handlers/document.py +13 -4
- package/server/services/handlers/tools.py +445 -14
- package/server/services/node_executor.py +3 -0
- package/server/services/temporal/activities.py +3 -0
- package/server/services/workflow.py +2 -0
- package/server/skills/android_agent/app-launcher-skill/SKILL.md +137 -0
- package/server/skills/android_agent/app-list-skill/SKILL.md +148 -0
- package/server/skills/android_agent/audio-skill/SKILL.md +169 -0
- package/server/skills/android_agent/battery-skill/SKILL.md +114 -0
- package/server/skills/android_agent/bluetooth-skill/SKILL.md +151 -0
- package/server/skills/android_agent/camera-skill/SKILL.md +148 -0
- package/server/skills/android_agent/environmental-skill/SKILL.md +140 -0
- package/server/skills/android_agent/location-skill/SKILL.md +163 -0
- package/server/skills/android_agent/motion-skill/SKILL.md +141 -0
- package/server/skills/android_agent/screen-control-skill/SKILL.md +164 -0
- package/server/skills/android_agent/wifi-skill/SKILL.md +182 -0
- package/server/skills/assistant/subagent-skill/SKILL.md +205 -0
- package/server/skills/coding_agent/javascript-skill/SKILL.md +196 -0
- package/server/skills/coding_agent/python-skill/SKILL.md +165 -0
- package/server/skills/social_agent/whatsapp-db-skill/SKILL.md +284 -0
- package/server/skills/social_agent/whatsapp-send-skill/SKILL.md +180 -0
- package/server/skills/task_agent/cron-scheduler-skill/SKILL.md +215 -0
- package/server/skills/task_agent/task-manager-skill/SKILL.md +251 -0
- package/server/skills/task_agent/timer-skill/SKILL.md +168 -0
- package/server/skills/travel_agent/geocoding-skill/SKILL.md +186 -0
- package/server/skills/travel_agent/nearby-places-skill/SKILL.md +234 -0
- package/server/skills/web_agent/http-request-skill/SKILL.md +211 -0
- package/server/skills/android/skill/SKILL.md +0 -84
- package/server/skills/assistant/code-skill/SKILL.md +0 -176
- package/server/skills/assistant/http-skill/SKILL.md +0 -163
- package/server/skills/assistant/maps-skill/SKILL.md +0 -172
- package/server/skills/assistant/scheduler-skill/SKILL.md +0 -86
- package/server/skills/assistant/whatsapp-skill/SKILL.md +0 -285
- /package/server/skills/{android → android_agent}/personality/SKILL.md +0 -0
- /package/server/skills/{assistant → web_agent}/web-search-skill/SKILL.md +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: javascript-skill
|
|
3
|
+
description: Execute JavaScript code for calculations, data processing, and JSON manipulation. Full ES6+ support with Node.js runtime.
|
|
4
|
+
allowed-tools: javascript_code
|
|
5
|
+
metadata:
|
|
6
|
+
author: machina
|
|
7
|
+
version: "1.0"
|
|
8
|
+
category: code
|
|
9
|
+
icon: "📜"
|
|
10
|
+
color: "#F7DF1E"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# JavaScript Code Execution Tool
|
|
14
|
+
|
|
15
|
+
Execute JavaScript code for calculations, data processing, and JSON manipulation.
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
18
|
+
|
|
19
|
+
This skill provides instructions for the **JavaScript Executor** tool node. Connect the **JavaScript Executor** node to Zeenie's `input-tools` handle to enable JavaScript code execution.
|
|
20
|
+
|
|
21
|
+
## javascript_code Tool
|
|
22
|
+
|
|
23
|
+
Execute JavaScript code and return results.
|
|
24
|
+
|
|
25
|
+
### Schema Fields
|
|
26
|
+
|
|
27
|
+
| Field | Type | Required | Description |
|
|
28
|
+
|-------|------|----------|-------------|
|
|
29
|
+
| code | string | Yes | JavaScript code to execute |
|
|
30
|
+
|
|
31
|
+
### Available Features
|
|
32
|
+
|
|
33
|
+
| Feature | Description |
|
|
34
|
+
|---------|-------------|
|
|
35
|
+
| ES6+ syntax | Arrow functions, destructuring, spread operator |
|
|
36
|
+
| `JSON` | JSON.parse() and JSON.stringify() |
|
|
37
|
+
| `Math` | Mathematical operations |
|
|
38
|
+
| `Date` | Date and time manipulation |
|
|
39
|
+
| `Array` methods | map, filter, reduce, sort, etc. |
|
|
40
|
+
| `Object` methods | keys, values, entries, assign |
|
|
41
|
+
| `String` methods | All standard string methods |
|
|
42
|
+
|
|
43
|
+
### Built-in Variables
|
|
44
|
+
|
|
45
|
+
| Variable | Description |
|
|
46
|
+
|----------|-------------|
|
|
47
|
+
| `input_data` | Data from connected workflow nodes (object) |
|
|
48
|
+
| `output` | Set this to return a result |
|
|
49
|
+
|
|
50
|
+
### Output Methods
|
|
51
|
+
|
|
52
|
+
1. **Set `output` variable**: Returns structured data to the workflow
|
|
53
|
+
2. **Use `console.log()`**: Captured as console output
|
|
54
|
+
|
|
55
|
+
### Examples
|
|
56
|
+
|
|
57
|
+
**Basic calculation:**
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"code": "const result = 25 * 4 + 10;\nconsole.log(`Result: ${result}`);\noutput = result;"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Array processing:**
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"code": "const numbers = input_data.numbers || [1, 2, 3, 4, 5];\nconst total = numbers.reduce((a, b) => a + b, 0);\nconst average = total / numbers.length;\nconsole.log(`Total: ${total}, Average: ${average}`);\noutput = { total, average };"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Filter array:**
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"code": "const numbers = input_data.numbers || [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\nconst evens = numbers.filter(n => n % 2 === 0);\nconsole.log(`Even numbers: ${evens}`);\noutput = evens;"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Transform data:**
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"code": "const users = input_data.users || [{name: 'John', age: 30}, {name: 'Jane', age: 25}];\nconst names = users.map(u => u.name);\nconsole.log(`Names: ${names.join(', ')}`);\noutput = names;"
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**JSON manipulation:**
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"code": "const data = { name: 'John', age: 30, city: 'NYC' };\nconst json = JSON.stringify(data, null, 2);\nconsole.log(json);\noutput = data;"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Object operations:**
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"code": "const obj = { a: 1, b: 2, c: 3 };\nconst keys = Object.keys(obj);\nconst values = Object.values(obj);\nconst sum = values.reduce((a, b) => a + b, 0);\nconsole.log(`Sum of values: ${sum}`);\noutput = { keys, values, sum };"
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Date operations:**
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"code": "const now = new Date();\nconst tomorrow = new Date(now.getTime() + 24 * 60 * 60 * 1000);\nconst formatted = tomorrow.toISOString().split('T')[0];\nconsole.log(`Tomorrow: ${formatted}`);\noutput = formatted;"
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Sort array:**
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"code": "const items = input_data.items || ['banana', 'apple', 'cherry'];\nconst sorted = [...items].sort();\nconsole.log(`Sorted: ${sorted}`);\noutput = sorted;"
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**String processing:**
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"code": "const text = 'Hello World, Hello JavaScript';\nconst words = text.split(' ');\nconst unique = [...new Set(words)];\nconsole.log(`Unique words: ${unique}`);\noutput = unique;"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Destructuring and spread:**
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"code": "const { name, age } = input_data.user || { name: 'John', age: 30 };\nconst profile = { name, age, active: true };\nconst extended = { ...profile, role: 'admin' };\nconsole.log(JSON.stringify(extended));\noutput = extended;"
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Response Format
|
|
128
|
+
|
|
129
|
+
**Success:**
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"success": true,
|
|
133
|
+
"result": { "total": 15, "average": 3 },
|
|
134
|
+
"output": "Total: 15, Average: 3"
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Error:**
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"error": "ReferenceError: undefinedVar is not defined"
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Use Cases
|
|
146
|
+
|
|
147
|
+
| Use Case | Approach |
|
|
148
|
+
|----------|----------|
|
|
149
|
+
| Array manipulation | Use map, filter, reduce |
|
|
150
|
+
| JSON processing | Use JSON.parse, JSON.stringify |
|
|
151
|
+
| Object operations | Use Object.keys, values, entries |
|
|
152
|
+
| String processing | Use split, join, replace |
|
|
153
|
+
| Math calculations | Use Math methods |
|
|
154
|
+
| Date operations | Use Date object |
|
|
155
|
+
| Data transformation | Use spread and destructuring |
|
|
156
|
+
|
|
157
|
+
## Guidelines
|
|
158
|
+
|
|
159
|
+
1. **Always set `output`**: This returns data to the workflow
|
|
160
|
+
2. **Use `console.log()` for debugging**: Output is captured and returned
|
|
161
|
+
3. **Use ES6+ features**: Arrow functions, destructuring, spread
|
|
162
|
+
4. **Handle undefined**: Use `|| defaultValue` pattern
|
|
163
|
+
5. **Keep code focused**: One task per execution
|
|
164
|
+
6. **No network access**: Use http-skill for web requests
|
|
165
|
+
7. **Timeout**: Default 30 seconds max execution time
|
|
166
|
+
|
|
167
|
+
## Security Restrictions
|
|
168
|
+
|
|
169
|
+
- No network/fetch operations
|
|
170
|
+
- No file system access (no require('fs'))
|
|
171
|
+
- No child processes
|
|
172
|
+
- Limited execution time (30 seconds)
|
|
173
|
+
- Sandboxed environment
|
|
174
|
+
|
|
175
|
+
## Common Patterns
|
|
176
|
+
|
|
177
|
+
**Default values:**
|
|
178
|
+
```javascript
|
|
179
|
+
const data = input_data.value || 'default';
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Null-safe access:**
|
|
183
|
+
```javascript
|
|
184
|
+
const name = input_data?.user?.name || 'Unknown';
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Array to object:**
|
|
188
|
+
```javascript
|
|
189
|
+
const arr = [{id: 1, name: 'A'}, {id: 2, name: 'B'}];
|
|
190
|
+
const obj = Object.fromEntries(arr.map(x => [x.id, x.name]));
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Setup Requirements
|
|
194
|
+
|
|
195
|
+
1. Connect the **JavaScript Executor** node to Zeenie's `input-tools` handle
|
|
196
|
+
2. Node.js must be installed on the server
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: python-skill
|
|
3
|
+
description: Execute Python code for calculations, data processing, and automation. Access to math, json, datetime, collections, and more.
|
|
4
|
+
allowed-tools: python_code
|
|
5
|
+
metadata:
|
|
6
|
+
author: machina
|
|
7
|
+
version: "1.0"
|
|
8
|
+
category: code
|
|
9
|
+
icon: "🐍"
|
|
10
|
+
color: "#3776AB"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Python Code Execution Tool
|
|
14
|
+
|
|
15
|
+
Execute Python code for calculations, data processing, and automation tasks.
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
18
|
+
|
|
19
|
+
This skill provides instructions for the **Python Executor** tool node. Connect the **Python Executor** node to Zeenie's `input-tools` handle to enable Python code execution.
|
|
20
|
+
|
|
21
|
+
## python_code Tool
|
|
22
|
+
|
|
23
|
+
Execute Python code and return results.
|
|
24
|
+
|
|
25
|
+
### Schema Fields
|
|
26
|
+
|
|
27
|
+
| Field | Type | Required | Description |
|
|
28
|
+
|-------|------|----------|-------------|
|
|
29
|
+
| code | string | Yes | Python code to execute |
|
|
30
|
+
|
|
31
|
+
### Available Libraries
|
|
32
|
+
|
|
33
|
+
| Library | Description |
|
|
34
|
+
|---------|-------------|
|
|
35
|
+
| `math` | Mathematical functions (sqrt, pow, sin, cos, etc.) |
|
|
36
|
+
| `json` | JSON encoding/decoding |
|
|
37
|
+
| `datetime` | Date and time manipulation |
|
|
38
|
+
| `timedelta` | Time duration calculations |
|
|
39
|
+
| `re` | Regular expressions |
|
|
40
|
+
| `random` | Random number generation |
|
|
41
|
+
| `Counter` | Count hashable objects |
|
|
42
|
+
| `defaultdict` | Dictionary with default values |
|
|
43
|
+
|
|
44
|
+
### Built-in Variables
|
|
45
|
+
|
|
46
|
+
| Variable | Description |
|
|
47
|
+
|----------|-------------|
|
|
48
|
+
| `input_data` | Data from connected workflow nodes (dict) |
|
|
49
|
+
| `output` | Set this to return a result |
|
|
50
|
+
|
|
51
|
+
### Output Methods
|
|
52
|
+
|
|
53
|
+
1. **Set `output` variable**: Returns structured data to the workflow
|
|
54
|
+
2. **Use `print()`**: Captured as console output
|
|
55
|
+
|
|
56
|
+
### Examples
|
|
57
|
+
|
|
58
|
+
**Basic calculation:**
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"code": "result = 25 * 4 + 10\nprint(f'Result: {result}')\noutput = result"
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Calculate tip:**
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"code": "bill = 85.50\ntip_percent = 15\ntip = bill * (tip_percent / 100)\ntotal = bill + tip\nprint(f'Tip: ${tip:.2f}')\nprint(f'Total: ${total:.2f}')\noutput = {'tip': tip, 'total': total}"
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Generate random numbers:**
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"code": "import random\nnumbers = [random.randint(1, 100) for _ in range(5)]\nprint(f'Random numbers: {numbers}')\noutput = numbers"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Date calculations:**
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"code": "from datetime import datetime, timedelta\ntoday = datetime.now()\nfuture = today + timedelta(days=30)\nresult = future.strftime('%Y-%m-%d')\nprint(f'30 days from now: {result}')\noutput = result"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Process data:**
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"code": "data = input_data.get('numbers', [1, 2, 3, 4, 5])\ntotal = sum(data)\naverage = total / len(data)\nprint(f'Total: {total}, Average: {average}')\noutput = {'total': total, 'average': average}"
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Parse JSON:**
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"code": "import json\njson_str = '{\"name\": \"John\", \"age\": 30}'\ndata = json.loads(json_str)\nprint(f'Name: {data[\"name\"]}')\noutput = data"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Count items:**
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"code": "from collections import Counter\nitems = ['apple', 'banana', 'apple', 'cherry', 'banana', 'apple']\ncounts = dict(Counter(items))\nprint(f'Counts: {counts}')\noutput = counts"
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Text processing:**
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"code": "import re\ntext = 'Contact: john@example.com or jane@test.org'\nemails = re.findall(r'\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b', text)\nprint(f'Found emails: {emails}')\noutput = emails"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Response Format
|
|
115
|
+
|
|
116
|
+
**Success:**
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"success": true,
|
|
120
|
+
"result": {"tip": 12.825, "total": 98.325},
|
|
121
|
+
"output": "Tip: $12.83\nTotal: $98.33"
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Error:**
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"error": "name 'undefined_var' is not defined"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Use Cases
|
|
133
|
+
|
|
134
|
+
| Use Case | Approach |
|
|
135
|
+
|----------|----------|
|
|
136
|
+
| Math calculations | Use `math` library functions |
|
|
137
|
+
| Date/time operations | Use `datetime` and `timedelta` |
|
|
138
|
+
| Data analysis | Use list comprehensions, sum, len |
|
|
139
|
+
| Random generation | Use `random` library |
|
|
140
|
+
| Text parsing | Use `re` regular expressions |
|
|
141
|
+
| JSON manipulation | Use `json.loads()` and `json.dumps()` |
|
|
142
|
+
| Counting | Use `Counter` from collections |
|
|
143
|
+
|
|
144
|
+
## Guidelines
|
|
145
|
+
|
|
146
|
+
1. **Always set `output`**: This returns data to the workflow
|
|
147
|
+
2. **Use `print()` for debugging**: Output is captured and returned
|
|
148
|
+
3. **Keep code focused**: One task per execution
|
|
149
|
+
4. **Handle errors**: Use try/except for robust code
|
|
150
|
+
5. **No network access**: Use http-skill for web requests
|
|
151
|
+
6. **No file system access**: Restricted to safe operations
|
|
152
|
+
7. **Timeout**: Default 30 seconds max execution time
|
|
153
|
+
|
|
154
|
+
## Security Restrictions
|
|
155
|
+
|
|
156
|
+
- No network/socket operations
|
|
157
|
+
- No file system access outside designated areas
|
|
158
|
+
- No subprocess/shell commands
|
|
159
|
+
- Limited execution time (30 seconds)
|
|
160
|
+
- Sandboxed environment
|
|
161
|
+
|
|
162
|
+
## Setup Requirements
|
|
163
|
+
|
|
164
|
+
1. Connect the **Python Executor** node to Zeenie's `input-tools` handle
|
|
165
|
+
2. Python must be installed on the server
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: whatsapp-db-skill
|
|
3
|
+
description: Query WhatsApp database for contacts, groups, and chat history. Look up contact info, search groups, retrieve messages.
|
|
4
|
+
allowed-tools: whatsapp_db
|
|
5
|
+
metadata:
|
|
6
|
+
author: machina
|
|
7
|
+
version: "1.0"
|
|
8
|
+
category: messaging
|
|
9
|
+
icon: "🗃️"
|
|
10
|
+
color: "#25D366"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# WhatsApp Database Tool
|
|
14
|
+
|
|
15
|
+
Query WhatsApp database for contacts, groups, and message history.
|
|
16
|
+
|
|
17
|
+
## How It Works
|
|
18
|
+
|
|
19
|
+
This skill provides instructions for the **WhatsApp DB** tool node. Connect the **WhatsApp DB** node to Zeenie's `input-tools` handle to enable database queries.
|
|
20
|
+
|
|
21
|
+
## whatsapp_db Tool
|
|
22
|
+
|
|
23
|
+
Query contacts, groups, and chat history.
|
|
24
|
+
|
|
25
|
+
### Schema Fields
|
|
26
|
+
|
|
27
|
+
| Field | Type | Required | Description |
|
|
28
|
+
|-------|------|----------|-------------|
|
|
29
|
+
| operation | string | Yes | Operation type (see below) |
|
|
30
|
+
| chat_type | string | For chat_history | `"individual"` or `"group"` |
|
|
31
|
+
| phone | string | Varies | Phone number (for chat_history individual, get_contact_info) |
|
|
32
|
+
| group_id | string | Varies | Group JID (for chat_history group, get_group_info) |
|
|
33
|
+
| query | string | No | Search query (for search_groups, list_contacts) |
|
|
34
|
+
| limit | int | No | Max results (varies by operation) |
|
|
35
|
+
| offset | int | No | Pagination offset (for chat_history) |
|
|
36
|
+
| message_filter | string | No | `"all"` or `"text_only"` (for chat_history) |
|
|
37
|
+
| group_filter | string | No | `"all"` or `"contact"` (for group chat_history) |
|
|
38
|
+
| sender_phone | string | No | Filter by sender (when group_filter="contact") |
|
|
39
|
+
| phones | string | For check_contacts | Comma-separated phone numbers |
|
|
40
|
+
| participant_limit | int | No | Max participants (for get_group_info, 1-100) |
|
|
41
|
+
|
|
42
|
+
### Operations
|
|
43
|
+
|
|
44
|
+
| Operation | Description | Required Fields |
|
|
45
|
+
|-----------|-------------|-----------------|
|
|
46
|
+
| `list_contacts` | List contacts with saved names | query (optional), limit |
|
|
47
|
+
| `get_contact_info` | Get full contact details | phone |
|
|
48
|
+
| `search_groups` | Search groups by name | query, limit |
|
|
49
|
+
| `get_group_info` | Get group details with participants | group_id |
|
|
50
|
+
| `chat_history` | Retrieve message history | chat_type, phone/group_id |
|
|
51
|
+
| `check_contacts` | Check WhatsApp registration | phones |
|
|
52
|
+
|
|
53
|
+
### Limits
|
|
54
|
+
|
|
55
|
+
| Operation | Default | Max |
|
|
56
|
+
|-----------|---------|-----|
|
|
57
|
+
| chat_history | 50 | 500 |
|
|
58
|
+
| search_groups | 20 | 50 |
|
|
59
|
+
| list_contacts | 50 | 100 |
|
|
60
|
+
| get_group_info participants | 50 | 100 |
|
|
61
|
+
|
|
62
|
+
**Important:** Always use small limits and specific queries to avoid context overflow.
|
|
63
|
+
|
|
64
|
+
## Operation Examples
|
|
65
|
+
|
|
66
|
+
### list_contacts
|
|
67
|
+
|
|
68
|
+
Find contacts by name.
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"operation": "list_contacts",
|
|
73
|
+
"query": "mom",
|
|
74
|
+
"limit": 10
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Response:**
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"success": true,
|
|
82
|
+
"operation": "list_contacts",
|
|
83
|
+
"contacts": [
|
|
84
|
+
{"phone": "919876543210", "name": "Mom", "jid": "919876543210@s.whatsapp.net"}
|
|
85
|
+
],
|
|
86
|
+
"total": 1
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### get_contact_info
|
|
91
|
+
|
|
92
|
+
Get full contact details for sending/replying.
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"operation": "get_contact_info",
|
|
97
|
+
"phone": "919876543210"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Response:**
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"success": true,
|
|
105
|
+
"operation": "get_contact_info",
|
|
106
|
+
"phone": "919876543210",
|
|
107
|
+
"name": "Mom",
|
|
108
|
+
"jid": "919876543210@s.whatsapp.net",
|
|
109
|
+
"profile_picture": "https://..."
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### search_groups
|
|
114
|
+
|
|
115
|
+
Search groups by name.
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"operation": "search_groups",
|
|
120
|
+
"query": "family",
|
|
121
|
+
"limit": 10
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Response:**
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"success": true,
|
|
129
|
+
"operation": "search_groups",
|
|
130
|
+
"groups": [
|
|
131
|
+
{"group_id": "120363123456789@g.us", "name": "Family Group", "participant_count": 5}
|
|
132
|
+
],
|
|
133
|
+
"total": 1
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### get_group_info
|
|
138
|
+
|
|
139
|
+
Get group details with participant list.
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"operation": "get_group_info",
|
|
144
|
+
"group_id": "120363123456789@g.us",
|
|
145
|
+
"participant_limit": 20
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Response:**
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"success": true,
|
|
153
|
+
"operation": "get_group_info",
|
|
154
|
+
"name": "Family Group",
|
|
155
|
+
"jid": "120363123456789@g.us",
|
|
156
|
+
"participants": [
|
|
157
|
+
{"phone": "919876543210", "name": "Mom", "is_admin": true},
|
|
158
|
+
{"phone": "919876543211", "name": "Dad", "is_admin": false}
|
|
159
|
+
],
|
|
160
|
+
"total_participants": 5
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### chat_history (Individual)
|
|
165
|
+
|
|
166
|
+
Get messages from an individual chat.
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"operation": "chat_history",
|
|
171
|
+
"chat_type": "individual",
|
|
172
|
+
"phone": "919876543210",
|
|
173
|
+
"limit": 20
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### chat_history (Group)
|
|
178
|
+
|
|
179
|
+
Get messages from a group chat.
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"operation": "chat_history",
|
|
184
|
+
"chat_type": "group",
|
|
185
|
+
"group_id": "120363123456789@g.us",
|
|
186
|
+
"message_filter": "text_only",
|
|
187
|
+
"limit": 50
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Response:**
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"success": true,
|
|
195
|
+
"operation": "chat_history",
|
|
196
|
+
"messages": [
|
|
197
|
+
{
|
|
198
|
+
"index": 1,
|
|
199
|
+
"message_id": "ABC123",
|
|
200
|
+
"sender": "919876543210@s.whatsapp.net",
|
|
201
|
+
"sender_name": "Mom",
|
|
202
|
+
"text": "Hello!",
|
|
203
|
+
"timestamp": "2025-01-30T12:00:00",
|
|
204
|
+
"is_from_me": false
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"total": 50,
|
|
208
|
+
"has_more": true
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### check_contacts
|
|
213
|
+
|
|
214
|
+
Check if phone numbers have WhatsApp.
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"operation": "check_contacts",
|
|
219
|
+
"phones": "1234567890,0987654321"
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Response:**
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"success": true,
|
|
227
|
+
"operation": "check_contacts",
|
|
228
|
+
"results": [
|
|
229
|
+
{"phone": "1234567890", "registered": true, "jid": "1234567890@s.whatsapp.net"},
|
|
230
|
+
{"phone": "0987654321", "registered": false}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Common Workflows
|
|
236
|
+
|
|
237
|
+
### Find and message someone by name
|
|
238
|
+
|
|
239
|
+
1. Use `list_contacts` with query to find the person
|
|
240
|
+
2. Get their phone number from the result
|
|
241
|
+
3. Use `whatsapp_send` tool with the phone number
|
|
242
|
+
|
|
243
|
+
### Get recent messages from a contact
|
|
244
|
+
|
|
245
|
+
1. Use `chat_history` with chat_type="individual"
|
|
246
|
+
2. Set appropriate limit for desired history depth
|
|
247
|
+
|
|
248
|
+
### Find and message a group
|
|
249
|
+
|
|
250
|
+
1. Use `search_groups` to find the group by name
|
|
251
|
+
2. Get the group_id from the result
|
|
252
|
+
3. Use `whatsapp_send` tool with recipient_type="group"
|
|
253
|
+
|
|
254
|
+
### See who's in a group
|
|
255
|
+
|
|
256
|
+
1. Use `get_group_info` with the group_id
|
|
257
|
+
2. Set participant_limit to control output size
|
|
258
|
+
|
|
259
|
+
## Guidelines
|
|
260
|
+
|
|
261
|
+
1. **Phone numbers**: Always use without + prefix, just digits
|
|
262
|
+
2. **Group IDs**: JID format ending in `@g.us`
|
|
263
|
+
3. **Limits**: Use small limits to avoid context overflow
|
|
264
|
+
4. **Queries**: Be specific to narrow results
|
|
265
|
+
5. **Pagination**: Use offset to page through chat_history
|
|
266
|
+
|
|
267
|
+
## Error Responses
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"error": "Phone number is required for chat_type='individual'"
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
```json
|
|
276
|
+
{
|
|
277
|
+
"error": "group_id is required for get_group_info"
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Setup Requirements
|
|
282
|
+
|
|
283
|
+
1. Connect the **WhatsApp DB** node to Zeenie's `input-tools` handle
|
|
284
|
+
2. Ensure WhatsApp is connected (green status indicator in Credentials)
|