n8n-nodes-autotask 0.9.4 → 0.9.6
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/README.md +251 -22
- package/dist/nodes/Autotask/Autotask.node.js +274 -264
- package/dist/nodes/Autotask/Autotask.node.js.map +1 -1
- package/dist/nodes/Autotask/constants/entities.js +1 -0
- package/dist/nodes/Autotask/constants/entities.js.map +1 -1
- package/dist/nodes/Autotask/constants/field.constants.js +1 -0
- package/dist/nodes/Autotask/constants/field.constants.js.map +1 -1
- package/dist/nodes/Autotask/helpers/agent-error-hints.d.ts +37 -0
- package/dist/nodes/Autotask/helpers/agent-error-hints.js +170 -0
- package/dist/nodes/Autotask/helpers/agent-error-hints.js.map +1 -0
- package/dist/nodes/Autotask/helpers/aiHelper.d.ts +70 -0
- package/dist/nodes/Autotask/helpers/aiHelper.js +367 -0
- package/dist/nodes/Autotask/helpers/aiHelper.js.map +1 -0
- package/dist/nodes/Autotask/helpers/dry-run.d.ts +30 -0
- package/dist/nodes/Autotask/helpers/dry-run.js +97 -0
- package/dist/nodes/Autotask/helpers/dry-run.js.map +1 -0
- package/dist/nodes/Autotask/helpers/json-validation.d.ts +8 -0
- package/dist/nodes/Autotask/helpers/json-validation.js +123 -0
- package/dist/nodes/Autotask/helpers/json-validation.js.map +1 -0
- package/dist/nodes/Autotask/helpers/label-resolution.d.ts +13 -0
- package/dist/nodes/Autotask/helpers/label-resolution.js +83 -0
- package/dist/nodes/Autotask/helpers/label-resolution.js.map +1 -0
- package/dist/nodes/Autotask/helpers/output-mode.d.ts +10 -0
- package/dist/nodes/Autotask/helpers/output-mode.js +89 -0
- package/dist/nodes/Autotask/helpers/output-mode.js.map +1 -0
- package/dist/nodes/Autotask/helpers/resource-operations.helper.d.ts +6 -0
- package/dist/nodes/Autotask/helpers/resource-operations.helper.js +3 -1
- package/dist/nodes/Autotask/helpers/resource-operations.helper.js.map +1 -1
- package/dist/nodes/Autotask/operations/base/create-operation.js +32 -4
- package/dist/nodes/Autotask/operations/base/create-operation.js.map +1 -1
- package/dist/nodes/Autotask/operations/base/field-values.js +29 -1
- package/dist/nodes/Autotask/operations/base/field-values.js.map +1 -1
- package/dist/nodes/Autotask/operations/base/get-many.js +23 -22
- package/dist/nodes/Autotask/operations/base/get-many.js.map +1 -1
- package/dist/nodes/Autotask/operations/base/get-operation.js +11 -22
- package/dist/nodes/Autotask/operations/base/get-operation.js.map +1 -1
- package/dist/nodes/Autotask/operations/base/update-operation.js +21 -2
- package/dist/nodes/Autotask/operations/base/update-operation.js.map +1 -1
- package/dist/nodes/Autotask/operations/common/json-parameters/description.d.ts +15 -0
- package/dist/nodes/Autotask/operations/common/json-parameters/description.js +134 -0
- package/dist/nodes/Autotask/operations/common/json-parameters/description.js.map +1 -0
- package/dist/nodes/Autotask/operations/common/json-parameters/index.d.ts +1 -0
- package/dist/nodes/Autotask/operations/common/json-parameters/index.js +14 -0
- package/dist/nodes/Autotask/operations/common/json-parameters/index.js.map +1 -0
- package/dist/nodes/Autotask/operations/common/select-columns/filter-entity.js +33 -1
- package/dist/nodes/Autotask/operations/common/select-columns/filter-entity.js.map +1 -1
- package/dist/nodes/Autotask/resources/aiHelper/description.d.ts +2 -0
- package/dist/nodes/Autotask/resources/aiHelper/description.js +218 -0
- package/dist/nodes/Autotask/resources/aiHelper/description.js.map +1 -0
- package/dist/nodes/Autotask/resources/aiHelper/execute.d.ts +2 -0
- package/dist/nodes/Autotask/resources/aiHelper/execute.js +64 -0
- package/dist/nodes/Autotask/resources/aiHelper/execute.js.map +1 -0
- package/dist/nodes/Autotask/resources/aiHelper/index.d.ts +2 -0
- package/dist/nodes/Autotask/resources/aiHelper/index.js +8 -0
- package/dist/nodes/Autotask/resources/aiHelper/index.js.map +1 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/description.d.ts +2 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/description.js +90 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/description.js.map +1 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/execute.d.ts +2 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/execute.js +87 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/execute.js.map +1 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/index.d.ts +2 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/index.js +8 -0
- package/dist/nodes/Autotask/resources/companySiteConfigurations/index.js.map +1 -0
- package/dist/nodes/Autotask/resources/definitions.js +10 -0
- package/dist/nodes/Autotask/resources/definitions.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# n8n-nodes-autotask
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|

|
|
5
5
|
|
|
6
6
|
[](https://buymeacoffee.com/msoukhomlinov)
|
|
@@ -68,6 +68,7 @@ The node supports the following Autotask resources:
|
|
|
68
68
|
| Company Alert | Manage alerts associated with companies |
|
|
69
69
|
| Company Location | Manage locations for companies |
|
|
70
70
|
| Company Note | Manage notes attached to companies |
|
|
71
|
+
| Company Site Configuration | Manage company site configurations and user-defined fields for customer companies |
|
|
71
72
|
| Company Webhook | Manage webhooks for company events |
|
|
72
73
|
| Configuration Item | Manage configuration items (CIs) for companies |
|
|
73
74
|
| Configuration Item Billing Product Association | Manage product associations for configuration items |
|
|
@@ -216,41 +217,269 @@ The API Threshold resource provides a simple way to monitor your Autotask API us
|
|
|
216
217
|
|
|
217
218
|
This is particularly useful for workflows that make many API calls, allowing you to implement conditional logic based on current usage levels to avoid hitting rate limits and ensure continuous operation.
|
|
218
219
|
|
|
219
|
-
### AI
|
|
220
|
+
### AI Agent Playbook
|
|
220
221
|
|
|
221
|
-
This node
|
|
222
|
+
This node is optimised for AI agents and tool-calling systems with specialised features designed for autonomous operation.
|
|
222
223
|
|
|
223
|
-
####
|
|
224
|
+
#### Quick Start for AI Agents
|
|
224
225
|
|
|
225
|
-
|
|
226
|
+
**1. Introspect Resources**
|
|
227
|
+
```javascript
|
|
228
|
+
// Discover available fields and requirements
|
|
229
|
+
operation: aiHelper.describeResource
|
|
230
|
+
params: { resource: "ticket", mode: "write" }
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**2. Prepare Data**
|
|
234
|
+
```javascript
|
|
235
|
+
// Use JSON parameters for direct data input
|
|
236
|
+
bodyJson: {
|
|
237
|
+
"title": "API Integration Issue",
|
|
238
|
+
"description": "Customer reporting connection problems",
|
|
239
|
+
"priority": "Medium",
|
|
240
|
+
"status": "New"
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Note: You may provide labels for picklist/reference fields in `bodyJson` (e.g., `status: "New"`). They are automatically resolved to IDs pre-flight.
|
|
245
|
+
|
|
246
|
+
**3. Preview First (Optional)**
|
|
247
|
+
```javascript
|
|
248
|
+
// Test your request without making API calls
|
|
249
|
+
dryRun: true
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**4. Execute with Optimal Output**
|
|
253
|
+
```javascript
|
|
254
|
+
// Choose output format for token efficiency
|
|
255
|
+
outputMode: "rawIds" // Most efficient
|
|
256
|
+
outputMode: "idsAndLabels" // Default (balanced)
|
|
257
|
+
outputMode: "labelsOnly" // Most readable
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### AI Helper Operations
|
|
261
|
+
|
|
262
|
+
**Introspection Endpoint:**
|
|
263
|
+
- `aiHelper.describeResource(resource, mode)` - Get field metadata, requirements, constraints, and **entity dependencies**
|
|
264
|
+
- `aiHelper.listPicklistValues(resource, fieldId, query, limit, page)` - Get valid values for dropdown fields
|
|
265
|
+
- `aiHelper.validateParameters(resource, mode, fieldValues)` - **NEW:** Validate field values without API calls - pre-flight validation
|
|
266
|
+
|
|
267
|
+
**Dynamic Dependency Discovery:**
|
|
268
|
+
- **Reference fields** show what entity they link to (e.g., `companyID → company`)
|
|
269
|
+
- **Field dependencies** reveal required relationships (e.g., `contactID requires: companyID`)
|
|
270
|
+
- **Workflow guidance** provides creation order tips (e.g., "Ensure company exists before creating contact")
|
|
271
|
+
|
|
272
|
+
**Enhanced Validation:**
|
|
273
|
+
- **JSON Schema validation** - Immediate feedback on malformed `bodyJson`/`selectColumnsJson`
|
|
274
|
+
- **Parameter pre-validation** - Validate field values, types, dependencies without API calls
|
|
275
|
+
- **Structured error responses** - Detailed validation results with field-by-field feedback
|
|
276
|
+
|
|
277
|
+
**JSON Parameter Fallbacks:**
|
|
278
|
+
- `bodyJson` - Override UI mappings for write operations (create/update)
|
|
279
|
+
- `selectColumnsJson` - Specify fields for read operations as JSON array
|
|
280
|
+
|
|
281
|
+
**Agent-Friendly Features:**
|
|
282
|
+
- `outputMode` - Control response format (rawIds/idsAndLabels/labelsOnly)
|
|
283
|
+
- `dryRun` - Get request preview without API execution
|
|
284
|
+
- Smart error hints with actionable suggestions
|
|
285
|
+
|
|
286
|
+
#### Tool Configuration for Maximum Effectiveness
|
|
287
|
+
|
|
288
|
+
For optimal AI agent integration, configure multiple instances of this node as separate tools. This provides focused, reliable access to different resource types.
|
|
289
|
+
|
|
290
|
+
**Recommended Tool Setup:**
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
293
|
+
// Tool 1: Resource Discovery and Field Introspection
|
|
294
|
+
{
|
|
295
|
+
name: "autotask_inspector",
|
|
296
|
+
description: "Discover Autotask resources, fields, and valid values",
|
|
297
|
+
resource: "aiHelper",
|
|
298
|
+
operations: ["describeResource", "listPicklistValues"]
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Tool 2: Contact Management
|
|
302
|
+
{
|
|
303
|
+
name: "autotask_contacts",
|
|
304
|
+
description: "Read and write Autotask contacts and people",
|
|
305
|
+
resource: "contact",
|
|
306
|
+
operations: ["get", "getMany", "create", "update"],
|
|
307
|
+
defaultParams: {
|
|
308
|
+
outputMode: "idsAndLabels",
|
|
309
|
+
selectColumnsJson: ["id", "firstName", "lastName", "emailAddress", "companyID", "title", "phone"]
|
|
310
|
+
}
|
|
311
|
+
// Accepts labels in bodyJson; labels are auto-resolved to IDs
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Tool 3: Company/Account Management
|
|
315
|
+
{
|
|
316
|
+
name: "autotask_companies",
|
|
317
|
+
description: "Read and write Autotask companies and accounts",
|
|
318
|
+
resource: "company",
|
|
319
|
+
operations: ["get", "getMany", "create", "update"],
|
|
320
|
+
defaultParams: {
|
|
321
|
+
outputMode: "idsAndLabels",
|
|
322
|
+
selectColumnsJson: ["id", "companyName", "companyType", "phone", "address1", "city", "state"]
|
|
323
|
+
}
|
|
324
|
+
// Accepts labels in bodyJson; labels are auto-resolved to IDs
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Tool 4: General Resource Access
|
|
328
|
+
{
|
|
329
|
+
name: "autotask_resources",
|
|
330
|
+
description: "Access any Autotask resource with full flexibility",
|
|
331
|
+
allResources: true,
|
|
332
|
+
defaultParams: {
|
|
333
|
+
outputMode: "rawIds" // Most token-efficient for exploratory queries
|
|
334
|
+
}
|
|
335
|
+
// Accepts labels in bodyJson; labels are auto-resolved to IDs
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Usage Pattern:**
|
|
340
|
+
1. **Start with Inspector** - Use `autotask_inspector` to understand field requirements
|
|
341
|
+
2. **Use Focused Tools** - Call `autotask_contacts` or `autotask_companies` for CRM related operations
|
|
342
|
+
3. **Use Specialist Tools** - Use `autotask_resources` for lookups of Autotask MSP staff (resources)
|
|
226
343
|
|
|
227
|
-
|
|
228
|
-
|
|
344
|
+
**Benefits:**
|
|
345
|
+
- **Faster execution** - Pre-configured tools reduce parameter complexity
|
|
346
|
+
- **Better reliability** - Focused tools have predictable schemas
|
|
347
|
+
- **Token efficiency** - Default parameters optimised for each use case
|
|
348
|
+
- **Easier debugging** - Clear separation of concerns
|
|
229
349
|
|
|
230
|
-
#### Environment
|
|
350
|
+
#### Environment Setup
|
|
231
351
|
|
|
232
|
-
For
|
|
352
|
+
For AI tool usage, set this environment variable:
|
|
233
353
|
|
|
234
354
|
```bash
|
|
235
355
|
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
|
|
236
356
|
```
|
|
237
357
|
|
|
238
|
-
|
|
239
|
-
-
|
|
240
|
-
-
|
|
241
|
-
-
|
|
242
|
-
-
|
|
358
|
+
Configuration options:
|
|
359
|
+
- Add to your `.env` file
|
|
360
|
+
- Set in system environment variables
|
|
361
|
+
- Include in Docker/container configuration
|
|
362
|
+
- Add to startup command: `N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true n8n start`
|
|
363
|
+
|
|
364
|
+
#### Example Agent Workflow
|
|
365
|
+
|
|
366
|
+
**Scenario: Create a contact for a new company**
|
|
367
|
+
|
|
368
|
+
```javascript
|
|
369
|
+
// 1. Inspect contact requirements using dedicated tool
|
|
370
|
+
autotask_inspector.call({
|
|
371
|
+
operation: "describeResource",
|
|
372
|
+
targetResource: "contact",
|
|
373
|
+
mode: "write"
|
|
374
|
+
})
|
|
375
|
+
// Returns: {
|
|
376
|
+
// fields: [
|
|
377
|
+
// { id: "companyID", required: true, isReference: true, referencesEntity: "company" },
|
|
378
|
+
// { id: "firstName", required: true, type: "string" },
|
|
379
|
+
// { id: "lastName", required: true, type: "string" }
|
|
380
|
+
// ],
|
|
381
|
+
// notes: [
|
|
382
|
+
// "Required fields for write: companyID, firstName, lastName",
|
|
383
|
+
// "Reference fields (must reference existing entities): companyID → company",
|
|
384
|
+
// "Workflow tip: Ensure referenced company exists before creating contact."
|
|
385
|
+
// ]
|
|
386
|
+
// }
|
|
387
|
+
|
|
388
|
+
// 2. Check company picklist values if needed
|
|
389
|
+
autotask_inspector.call({
|
|
390
|
+
operation: "listPicklistValues",
|
|
391
|
+
targetResource: "contact",
|
|
392
|
+
fieldId: "companyID",
|
|
393
|
+
query: "Tech Solutions" // Search for company
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
// 2.5. Validate parameters before creation (NEW!)
|
|
397
|
+
autotask_inspector.call({
|
|
398
|
+
operation: "validateParameters",
|
|
399
|
+
targetResource: "contact",
|
|
400
|
+
mode: "create",
|
|
401
|
+
fieldValues: {
|
|
402
|
+
"firstName": "John",
|
|
403
|
+
"lastName": "Smith",
|
|
404
|
+
"emailAddress": "john.smith@techsolutions.com",
|
|
405
|
+
"companyID": 12345,
|
|
406
|
+
"title": "IT Manager"
|
|
407
|
+
}
|
|
408
|
+
})
|
|
409
|
+
// Returns: {
|
|
410
|
+
// isValid: true,
|
|
411
|
+
// errors: [],
|
|
412
|
+
// warnings: [
|
|
413
|
+
// { field: "companyID", message: "Reference field 'companyID' points to company. Ensure the referenced record exists.", code: "REFERENCE_EXISTENCE_CHECK" }
|
|
414
|
+
// ],
|
|
415
|
+
// summary: { totalFields: 15, providedFields: 5, validFields: 5, requiredFieldsMissing: 0, invalidValues: 0 }
|
|
416
|
+
// }
|
|
417
|
+
|
|
418
|
+
// 3. Create contact using focused tool
|
|
419
|
+
autotask_contacts.call({
|
|
420
|
+
operation: "create",
|
|
421
|
+
bodyJson: {
|
|
422
|
+
"firstName": "John",
|
|
423
|
+
"lastName": "Smith",
|
|
424
|
+
"emailAddress": "john.smith@techsolutions.com",
|
|
425
|
+
"companyID": 12345,
|
|
426
|
+
"title": "IT Manager"
|
|
427
|
+
},
|
|
428
|
+
dryRun: true // Preview first
|
|
429
|
+
})
|
|
430
|
+
// Dry-run response includes a `resolutions` array when labels were resolved to IDs, e.g.:
|
|
431
|
+
// resolutions: [{ field: 'status', from: 'New', to: 1, method: 'picklist' }]
|
|
432
|
+
|
|
433
|
+
// 4. Execute after validation
|
|
434
|
+
autotask_contacts.call({
|
|
435
|
+
operation: "create",
|
|
436
|
+
bodyJson: { /* same data */ },
|
|
437
|
+
outputMode: "idsAndLabels"
|
|
438
|
+
})
|
|
439
|
+
|
|
440
|
+
// 5. Retrieve company details using focused tool
|
|
441
|
+
autotask_companies.call({
|
|
442
|
+
operation: "get",
|
|
443
|
+
id: 12345
|
|
444
|
+
})
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
#### Error Self-Healing
|
|
448
|
+
|
|
449
|
+
Errors include structured hints to help agents self-correct:
|
|
450
|
+
|
|
451
|
+
```javascript
|
|
452
|
+
// Error response includes actionable guidance
|
|
453
|
+
{
|
|
454
|
+
"error": "Field 'priority' has invalid value 'Urgent'",
|
|
455
|
+
"extensions": {
|
|
456
|
+
"hint": "Use aiHelper.listPicklistValues('ticket', 'priority') to get valid options, then retry with a valid value.",
|
|
457
|
+
"suggestions": [
|
|
458
|
+
"Get valid values: aiHelper.listPicklistValues('ticket', 'priority')",
|
|
459
|
+
"Use exact values from the picklist response"
|
|
460
|
+
]
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
#### Best Practices for Agents
|
|
243
466
|
|
|
244
|
-
|
|
467
|
+
- **Configure focused tools** - Set up separate tools for inspector, contacts, companies, and general resources
|
|
468
|
+
- **Start with inspection** - Always call `autotask_inspector.describeResource` first to understand field requirements
|
|
469
|
+
- **Use focused tools** - Prefer `autotask_contacts` or `autotask_companies` over general tools for better reliability
|
|
470
|
+
- **Validate before execution** - Use `autotask_inspector.validateParameters` for pre-flight validation to catch errors early
|
|
471
|
+
- **Optimise responses** - Use `selectColumnsJson` to reduce payload size and `outputMode: "rawIds"` for token efficiency
|
|
472
|
+
- **Double-check with dry-run** - Use `dryRun: true` to preview requests before execution, especially for write operations
|
|
473
|
+
- **Handle errors smartly** - Follow the structured hints in error responses for self-correction
|
|
474
|
+
- **Cache discoveries** - Store field metadata and picklist values to avoid repeated introspection calls
|
|
475
|
+
- **JSON validation** - Invalid JSON in `bodyJson`/`selectColumnsJson` is caught immediately with helpful error messages
|
|
245
476
|
|
|
246
|
-
####
|
|
477
|
+
#### Troubleshooting
|
|
247
478
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
- Add notes to a ticket or company record
|
|
253
|
-
- Search for tickets matching specific criteria
|
|
479
|
+
**Tool Not Available:** Ensure `N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true` is set
|
|
480
|
+
**No Parameters Visible:** Call `aiHelper.describeResource` to inspect available fields
|
|
481
|
+
**Large Responses:** Use `selectColumnsJson` and `outputMode: "rawIds"` for efficiency
|
|
482
|
+
**Validation Errors:** Follow error hints to resolve field requirement issues
|
|
254
483
|
|
|
255
484
|
## Usage
|
|
256
485
|
|