n8n-nodes-autotask 0.9.5 → 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.
Files changed (56) hide show
  1. package/README.md +712 -484
  2. package/dist/nodes/Autotask/Autotask.node.js +27 -22
  3. package/dist/nodes/Autotask/Autotask.node.js.map +1 -1
  4. package/dist/nodes/Autotask/helpers/agent-error-hints.d.ts +37 -0
  5. package/dist/nodes/Autotask/helpers/agent-error-hints.js +170 -0
  6. package/dist/nodes/Autotask/helpers/agent-error-hints.js.map +1 -0
  7. package/dist/nodes/Autotask/helpers/aiHelper.d.ts +70 -0
  8. package/dist/nodes/Autotask/helpers/aiHelper.js +367 -0
  9. package/dist/nodes/Autotask/helpers/aiHelper.js.map +1 -0
  10. package/dist/nodes/Autotask/helpers/dry-run.d.ts +30 -0
  11. package/dist/nodes/Autotask/helpers/dry-run.js +97 -0
  12. package/dist/nodes/Autotask/helpers/dry-run.js.map +1 -0
  13. package/dist/nodes/Autotask/helpers/json-validation.d.ts +8 -0
  14. package/dist/nodes/Autotask/helpers/json-validation.js +123 -0
  15. package/dist/nodes/Autotask/helpers/json-validation.js.map +1 -0
  16. package/dist/nodes/Autotask/helpers/label-resolution.d.ts +13 -0
  17. package/dist/nodes/Autotask/helpers/label-resolution.js +83 -0
  18. package/dist/nodes/Autotask/helpers/label-resolution.js.map +1 -0
  19. package/dist/nodes/Autotask/helpers/output-mode.d.ts +10 -0
  20. package/dist/nodes/Autotask/helpers/output-mode.js +89 -0
  21. package/dist/nodes/Autotask/helpers/output-mode.js.map +1 -0
  22. package/dist/nodes/Autotask/helpers/resource-operations.helper.d.ts +6 -0
  23. package/dist/nodes/Autotask/helpers/resource-operations.helper.js +3 -1
  24. package/dist/nodes/Autotask/helpers/resource-operations.helper.js.map +1 -1
  25. package/dist/nodes/Autotask/operations/base/create-operation.js +32 -4
  26. package/dist/nodes/Autotask/operations/base/create-operation.js.map +1 -1
  27. package/dist/nodes/Autotask/operations/base/field-values.js +29 -1
  28. package/dist/nodes/Autotask/operations/base/field-values.js.map +1 -1
  29. package/dist/nodes/Autotask/operations/base/get-many.js +23 -22
  30. package/dist/nodes/Autotask/operations/base/get-many.js.map +1 -1
  31. package/dist/nodes/Autotask/operations/base/get-operation.js +11 -22
  32. package/dist/nodes/Autotask/operations/base/get-operation.js.map +1 -1
  33. package/dist/nodes/Autotask/operations/base/update-operation.js +21 -2
  34. package/dist/nodes/Autotask/operations/base/update-operation.js.map +1 -1
  35. package/dist/nodes/Autotask/operations/common/json-parameters/description.d.ts +15 -0
  36. package/dist/nodes/Autotask/operations/common/json-parameters/description.js +134 -0
  37. package/dist/nodes/Autotask/operations/common/json-parameters/description.js.map +1 -0
  38. package/dist/nodes/Autotask/operations/common/json-parameters/index.d.ts +1 -0
  39. package/dist/nodes/Autotask/operations/common/json-parameters/index.js +14 -0
  40. package/dist/nodes/Autotask/operations/common/json-parameters/index.js.map +1 -0
  41. package/dist/nodes/Autotask/operations/common/select-columns/filter-entity.js +33 -1
  42. package/dist/nodes/Autotask/operations/common/select-columns/filter-entity.js.map +1 -1
  43. package/dist/nodes/Autotask/resources/aiHelper/description.d.ts +2 -0
  44. package/dist/nodes/Autotask/resources/aiHelper/description.js +218 -0
  45. package/dist/nodes/Autotask/resources/aiHelper/description.js.map +1 -0
  46. package/dist/nodes/Autotask/resources/aiHelper/execute.d.ts +2 -0
  47. package/dist/nodes/Autotask/resources/aiHelper/execute.js +64 -0
  48. package/dist/nodes/Autotask/resources/aiHelper/execute.js.map +1 -0
  49. package/dist/nodes/Autotask/resources/aiHelper/index.d.ts +2 -0
  50. package/dist/nodes/Autotask/resources/aiHelper/index.js +8 -0
  51. package/dist/nodes/Autotask/resources/aiHelper/index.js.map +1 -0
  52. package/dist/nodes/Autotask/resources/definitions.js +5 -0
  53. package/dist/nodes/Autotask/resources/definitions.js.map +1 -1
  54. package/dist/package.json +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +81 -81
package/README.md CHANGED
@@ -1,484 +1,712 @@
1
- # n8n-nodes-autotask
2
-
3
- ![n8n-nodes-autotask](https://img.shields.io/badge/n8n--nodes--autotask-0.9.5-blue)
4
- ![License](https://img.shields.io/badge/license-MIT-green)
5
-
6
- [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
7
-
8
- > **IMPORTANT**: After updating this node to a new version, a restart of your n8n instance is highly recommended to ensure all changes are properly applied.
9
-
10
- This is an n8n community node for integrating with Autotask PSA. It provides a comprehensive set of operations to interact with Autotask entities through their REST API.
11
-
12
- ![Overview of n8n-nodes-autotask](./overview.gif)
13
-
14
- [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
15
-
16
- [Installation](#installation)
17
- [Authentication](#authentication)
18
- [Features](#features)
19
- [Usage](#usage)
20
- [Configuration](#configuration)
21
- [Limitations](#limitations)
22
- [Troubleshooting](#troubleshooting)
23
- [Resources](#resources)
24
- [Support](#support)
25
- [License](#license)
26
-
27
- ## Installation
28
-
29
- Follow these steps to install this node:
30
-
31
- ```bash
32
- # Install with npm
33
- npm install n8n-nodes-autotask
34
-
35
- # Install with pnpm
36
- pnpm install n8n-nodes-autotask
37
- ```
38
-
39
- **Requirements:**
40
- - n8n version 1.0.0 or later
41
- - Node.js version 18.10 or later
42
- - pnpm version 9.1 or later (if using pnpm)
43
-
44
- ## Authentication
45
-
46
- To use this node, you need to have API access to your Autotask instance. Follow these steps to set up authentication:
47
-
48
- 1. In Autotask, go to **Admin > API User Security**
49
- 2. Create or select an API user
50
- 3. Note the API Integration Code, Username, and Secret
51
- 4. In n8n, create a new credential of type **Autotask API**
52
- 5. Enter your API Integration Code, Username, and Secret
53
- 6. Select your Autotask zone
54
- 7. Select your timezone (affects how dates and times are displayed and entered)
55
- 8. Configure caching options as needed (this will cache dynamically fetched field picklists)
56
-
57
- ## Features
58
-
59
- ### Supported Resources
60
-
61
- The node supports the following Autotask resources:
62
-
63
- | Resource | Description |
64
- |----------|-------------|
65
- | API Threshold | Check Autotask API usage limits and current usage levels |
66
- | Billing Code | Manage billing codes for time entries and charges |
67
- | Company | Manage organisations in Autotask |
68
- | Company Alert | Manage alerts associated with companies |
69
- | Company Location | Manage locations for companies |
70
- | Company Note | Manage notes attached to companies |
71
- | Company Site Configuration | Manage company site configurations and user-defined fields for customer companies |
72
- | Company Webhook | Manage webhooks for company events |
73
- | Configuration Item | Manage configuration items (CIs) for companies |
74
- | Configuration Item Billing Product Association | Manage product associations for configuration items |
75
- | Configuration Item Category | Manage categories for configuration items |
76
- | Configuration Item Category UDF Association | Manage UDF associations for CI categories |
77
- | Configuration Item DNS Record | Manage DNS records for configuration items |
78
- | Configuration Item Note | Manage notes for configuration items |
79
- | Configuration Item Related Item | Manage related items for configuration items |
80
- | Configuration Item SSL Subject Alternative Name | Manage SSL alternative names for configuration items |
81
- | Configuration Item Type | Manage types for configuration items |
82
- | Configuration Item Webhook | Manage webhooks for configuration item events |
83
- | Contact | Manage contacts associated with companies |
84
- | Contact Groups | Manage contact groups |
85
- | Contact Group Contacts | Manage contacts within contact groups |
86
- | Contact Webhook | Manage webhooks for contact events |
87
- | Contract | Manage contracts for companies |
88
- | Contract Billing Rules | Manage billing rules for contracts |
89
- | Contract Block | Manage block hour contracts |
90
- | Contract Block Hour Factor | Manage hour factors for block hour contracts |
91
- | Contract Charge | Manage charges associated with contracts |
92
- | Contract Exclusion Billing Codes | Manage excluded billing codes for contracts |
93
- | Contract Exclusion Roles | Manage excluded roles for contracts |
94
- | Contract Exclusion Set Excluded Roles | Manage excluded roles within exclusion sets |
95
- | Contract Exclusion Set Excluded Work Types | Manage excluded work types within exclusion sets |
96
- | Contract Exclusion Sets | Manage exclusion sets for contracts |
97
- | Contract Milestone | Manage milestones for contracts |
98
- | Contract Note | Manage notes attached to contracts |
99
- | Contract Rate | Manage rates for contract services |
100
- | Contract Retainers | Manage retainers for contracts |
101
- | Contract Role Costs | Manage role costs for contracts |
102
- | Contract Service | Manage services within contracts |
103
- | Contract Service Adjustments | Manage adjustments for contract services |
104
- | Contract Service Bundle Adjustments | Manage adjustments for service bundles |
105
- | Contract Service Bundles | Manage service bundles within contracts |
106
- | Contract Service Bundle Units | Manage service bundle units |
107
- | Contract Service Unit | Manage service units for contracts |
108
- | Contract Ticket Purchases | Manage ticket purchases for contracts |
109
- | Countries | Query countries, which are used in address information for companies, contacts, and resources |
110
- | Domain Registrars | Manage domain registrars |
111
- | Holiday | Manage holiday dates |
112
- | Holiday Set | Manage holiday sets for resources |
113
- | Invoices | Manage invoices |
114
- | Notification History | View notification history |
115
- | Opportunity | Manage sales opportunities |
116
- | Product | Manage products in the catalogue |
117
- | Product Vendors | Manage vendor associations for products |
118
- | Project | Manage projects |
119
- | Project Charge | Manage charges associated with projects |
120
- | Project Note | Manage notes attached to projects |
121
- | Project Phase | Manage phases within projects |
122
- | Project Task | Manage tasks within projects |
123
- | Quote | Manage quotes for opportunities with pricing for products, services, and labor |
124
- | Quote Item | Manage line items for quotes including products, services, and labor |
125
- | Quote Location | Manage shipping and billing address information for quotes |
126
- | Quote Template | Query quote templates that define content and appearance of quotes |
127
- | Resource | Manage staff resources |
128
- | Resource Role | Manage department/role relationships, service desk queues, and service desk roles |
129
- | Roles | Manage roles in the system |
130
- | Search Filter | Build advanced search filters |
131
- | Service | Manage services offered to clients |
132
- | Service Call | Manage service calls |
133
- | Service Call Task | Manage tasks associated with service calls |
134
- | Service Call Task Resource | Manage resources assigned to service call tasks |
135
- | Service Call Ticket | Manage tickets linked to service calls |
136
- | Service Call Ticket Resource | Manage resources assigned to service call tickets |
137
- | Survey | Manage customer surveys |
138
- | Survey Results | Manage results from customer surveys |
139
- | Ticket | Manage service tickets |
140
- | Ticket History | View historical changes to tickets |
141
- | Ticket Note | Manage notes attached to tickets |
142
- | Ticket Note Webhook | Manage webhooks for ticket note events |
143
- | Ticket Webhook | Manage webhooks for ticket events |
144
- | Time Entry | Manage time entries for billing |
145
-
146
- ### Operations
147
-
148
- For most resources, the following operations are available:
149
-
150
- - **Create**: Add new records
151
- - **Read**: Retrieve a single record by ID
152
- - **Update**: Modify existing records
153
- - **Delete**: Remove records
154
- - **Get Many**: Retrieve multiple records with basic filtering options. This operation allows you to:
155
- - Filter records using simple field conditions (equals)
156
- - Filtering on User Defined Fields (UDFs)
157
- - Automatically paginate through large result sets
158
- - Choose to get all results or limit to a specific number (1-500)
159
- - Set a maximum number of records to return when not retrieving all records
160
- - Select specific columns to return in the response
161
- - Add human-readable labels for picklist and reference fields
162
- - Flatten User-Defined Fields for easier access in workflows
163
- - **Get Many Advanced**: Build complex queries with multiple filter conditions and logical operators. This operation provides:
164
- - Support for complex AND/OR logic in filters
165
- - Nested condition groups for sophisticated queries
166
- - Filtering on User Defined Fields (UDFs)
167
- - Advanced operators like contains, beginsWith, endsWith, exists, notExists
168
- - Support for IN and NOT IN operators with multiple values
169
- - Choose to get all results or limit to a specific number (1-500)
170
- - Set a maximum number of records to return when not retrieving all records
171
- - Select specific columns to return in the response
172
- - Add human-readable labels for picklist and reference fields
173
- - Flatten User-Defined Fields for easier access in workflows
174
- - Date-based filtering with automatic timezone handling
175
- - **Count**: Get the number of matching records
176
- - **Get Entity Info**: Retrieve metadata about the entity
177
- - **Get Field Info**: Retrieve field definitions for the selected entity
178
-
179
- For webhook resources (Company Webhook, Contact Webhook, Configuration Item Webhook, Ticket Webhook, Ticket Note Webhook), the following operations are available:
180
- - **Get**: Retrieve a single webhook by ID
181
- - **Get Many**: Retrieve multiple webhooks with basic filtering
182
- - **Delete**: Remove a webhook
183
-
184
- ### Webhook Trigger
185
-
186
- The node includes an Autotask Trigger node that can receive webhook events from Autotask. The trigger supports:
187
-
188
- - Events for multiple entity types (Companies, Contacts, Tickets, Configuration Items, Ticket Notes)
189
- - Create, Update, and Delete events
190
- - Field selection for webhook payloads (specify which fields to include)
191
- - Resource exclusion (exclude specific resources from triggering the workflow)
192
- - Email notifications for webhook delivery failures
193
- - Threshold notifications for monitoring webhook performance
194
- - Automatic webhook registration and cleanup
195
- - Secure payload verification with HMAC signatures
196
-
197
- ### Advanced Features
198
-
199
- - **Resource Mapping**: Dynamically map fields based on entity definitions
200
- - **Advanced Filtering**: Build complex queries with multiple conditions
201
- - **Column Selection**: Choose specific fields to return in get operations
202
- - **Picklist Label Enrichment**: Automatically add human-readable labels for picklist fields
203
- - **Reference Label Enrichment**: Add human-readable labels for reference fields
204
- - **UDF Flattening**: Bring user-defined fields up to the top level of response objects for easier access
205
- - **File-based Caching**: Improved performance with persistent caching that can be shared between workflows and runs
206
- - **Timezone Handling**: Automatic conversion between local time and UTC
207
- - **API Usage Monitoring**: Check current API usage thresholds and limits using the API Threshold resource to help prevent hitting rate limits and ensure smooth operations
208
-
209
- ### API Threshold Resource
210
-
211
- The API Threshold resource provides a simple way to monitor your Autotask API usage limits and current consumption. This helps users:
212
- - Track how many API requests have been made in the current timeframe
213
- - See the maximum allowed requests (threshold limit)
214
- - View the usage as a percentage and categorized level (Normal, Moderate, High, Critical)
215
- - Calculate remaining available requests
216
- - Monitor timeframe duration for rate limits
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.
219
-
220
- ### AI Tool Integration
221
-
222
- This node can be used as a tool by AI agents in n8n workflows. This allows AI agents to interact with Autotask PSA, performing operations like retrieving company information, creating tickets, or updating contacts.
223
-
224
- #### Requirements
225
-
226
- Currently, n8n only allows core nodes to be used as tools by default. To use this community node as a tool, you need to:
227
-
228
- 1. Set the environment variable `N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE` to `true` when running n8n.
229
- 2. Add the Autotask node as a tool in your AI agent workflow.
230
-
231
- #### Environment Variable Configuration
232
-
233
- For the node to be usable as an AI tool, you must set the following environment variable:
234
-
235
- ```bash
236
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
237
- ```
238
-
239
- This can be done by:
240
- - Adding it to your .env file
241
- - Setting it in your system environment variables
242
- - Including it in your Docker or container configuration
243
- - Adding it to your startup command (e.g., `N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true n8n start`)
244
-
245
- Without this environment variable set to `true`, n8n will not allow AI agents to use this community node as a tool.
246
-
247
- #### Example AI Tool Usage
248
-
249
- An AI agent might use the Autotask node to:
250
- - Retrieve information about a company or contact
251
- - Create a new ticket based on user input
252
- - Update the status of an existing ticket
253
- - Add notes to a ticket or company record
254
- - Search for tickets matching specific criteria
255
-
256
- ## Usage
257
-
258
- ### Basic Example: Creating a Ticket
259
-
260
- 1. Add an **Autotask** node to your workflow
261
- 2. Select **Ticket** as the resource
262
- 3. Select **Create** as the operation
263
- 4. Configure the required fields (Title, Status, etc.)
264
- 5. Connect to a trigger or previous node
265
- 6. Execute the workflow
266
-
267
- ### Intermediate Example: Querying Projects with Filters
268
-
269
- 1. Add an **Autotask** node to your workflow
270
- 2. Select **Project** as the resource
271
- 3. Select **Get Many** as the operation
272
- 4. Add filter conditions (e.g., Status equals "Active")
273
- 5. Choose whether to retrieve all results or limit the number:
274
- - Toggle "Get All" to true to retrieve all matching records
275
- - Toggle "Get All" to false and set "Max Records" (1-500) to limit the results
276
- 6. Connect to a trigger or previous node
277
- 7. Execute the workflow
278
-
279
- ### Advanced Example: Using Column Selection and Reference Labels
280
-
281
- 1. Add an **Autotask** node to your workflow
282
- 2. Select **Ticket** as the resource
283
- 3. Select **Get Many** as the operation
284
- 4. Add filter conditions as needed
285
- 5. Enable **Select Columns** to choose specific fields to return
286
- 6. Select only the fields you need in the response (improves performance)
287
- 7. Enable **Add Picklist Labels** to get human-readable values for picklist fields
288
- 8. Enable **Add Reference Labels** to get human-readable values for reference fields
289
- 9. Enable **Flatten User-Defined Fields** to bring UDFs to the top level of response objects
290
- 10. Execute the workflow to get tickets with only the selected fields and human-readable labels
291
-
292
- ### Advanced Example: Complex Filtering with Get Many Advanced
293
-
294
- 1. Add an **Autotask** node to your workflow
295
- 2. Select **Ticket** as the resource
296
- 3. Select **Get Many Advanced** as the operation
297
- 4. Build a complex filter, for example:
298
- ```json
299
- {
300
- "filter": [
301
- {
302
- "op": "and",
303
- "items": [
304
- {
305
- "field": "status",
306
- "op": "noteq",
307
- "value": 5
308
- },
309
- {
310
- "op": "or",
311
- "items": [
312
- {
313
- "field": "priority",
314
- "op": "eq",
315
- "value": 6
316
- },
317
- {
318
- "field": "dueDateTime",
319
- "op": "lt",
320
- "value": "{{ $now.plus(3, 'days').toLocal()}}"
321
- }
322
- ]
323
- }
324
- ]
325
- }
326
- ]
327
- }
328
- ```
329
- [Valid filter operators and filter documentation can be found here](https://ww15.autotask.net/help/DeveloperHelp/Content/APIs/REST/API_Calls/REST_Basic_Query_Calls.htm?Highlight=filter#List2)
330
- 5. Choose whether to retrieve all results or limit the number:
331
- - Toggle "Get All" to true to retrieve all matching records
332
- - Toggle "Get All" to false and set "Max Records" (1-500) to limit the results
333
- 6. Enable **Select Columns** to choose specific fields to return
334
- 7. Enable **Add Reference Labels** and **Add Picklist Labels** for human-readable values
335
- 8. Execute the workflow to retrieve tickets that are not complete AND either have priority 6 OR are due within the next 3 days
336
-
337
- ### Example: Monitoring API Usage with API Threshold
338
-
339
- 1. Add an **Autotask** node to your workflow
340
- 2. Select **API Threshold** as the resource
341
- 3. The operation **Get API Usage** will be automatically selected (it's the only available operation)
342
- 4. Execute the node to receive current API usage information including:
343
- - Current usage count
344
- - Maximum threshold (limit)
345
- - Usage percentage
346
- - Usage level (Normal, Moderate, High, Critical)
347
- - Remaining requests
348
- - Timeframe duration
349
- 5. You can use this information with IF nodes to implement conditional logic:
350
- - Pause workflows when usage is too high
351
- - Throttle requests during peak usage periods
352
- - Log warnings when approaching limits
353
- - Only execute non-critical operations when usage is below certain thresholds
354
-
355
- ### Advanced Example: Working with Parent-Child Relationships
356
-
357
- Many Autotask entities have parent-child relationships (e.g., Companies and Contacts). To work with these:
358
-
359
- 1. First, retrieve or create the parent entity
360
- 2. Use the parent entity's ID in the child entity operations
361
- 3. For example, to create a Contact for a Company:
362
- - First node: Get or create the Company
363
- - Second node: Create a Contact with the Company ID
364
-
365
- ### Example: Setting Up a Webhook Trigger
366
-
367
- 1. Add an **Autotask Trigger** node to your workflow
368
- 2. Select the entity type to monitor (Companies, Contacts, Tickets, etc.)
369
- 3. Select the events to subscribe to (Create, Update, Delete)
370
- 4. Configure the webhook URL (n8n will handle this automatically)
371
- 5. Optionally specify fields to include in the webhook payload
372
- 6. Optionally exclude specific resources from triggering the workflow
373
- 7. Configure email notifications for webhook delivery failures if needed
374
- 8. Save and activate the workflow
375
- 9. The node will automatically register the webhook with Autotask
376
- 10. When events occur in Autotask, they will trigger your workflow
377
- 11. When the workflow is deactivated, the webhook will be automatically removed
378
-
379
- ## Configuration
380
-
381
- ### Caching Options
382
-
383
- The node includes an enhanced file-based caching system to improve performance by reducing API calls:
384
-
385
- - **Enable Field Caching**: Toggle caching on/off
386
- - **Cache TTL**: How long to cache field values (in seconds)
387
- - **Cache Entity Info**: Whether to cache entity information and field definitions
388
- - **Entity Info TTL**: How long to cache entity information
389
- - **Cache Reference Fields**: Whether to cache reference field values
390
- - **Reference Fields TTL**: How long to cache reference field values
391
- - **Cache Picklists**: Whether to cache picklist values
392
- - **Picklists TTL**: How long to cache picklist values
393
- - **File-based Cache**: Cache is stored in files that can be shared between workflows and runs
394
- - **Cache Directory**: Optional path to a directory where cache files will be stored
395
-
396
- > **IMPORTANT**: This node uses dynamic picklists and field enrichers to convert numerical values into human-readable labels through dynamic lookups. It's strongly recommended to keep caching enabled to avoid excessive API calls. Without caching, each picklist and reference field lookup requires separate API calls, which can quickly consume your API rate limits, especially in workflows with many operations or large data sets.
397
-
398
- ### Label Enrichment and Field Processing
399
-
400
- The node provides options to enrich entities with human-readable labels and simplify field access:
401
-
402
- - **Add Picklist Labels**: Adds "_label" fields for picklist values (e.g., Status_label: "In Progress")
403
- - **Add Reference Labels**: Adds "_label" fields for reference values (e.g., Company_label: "Acme Corporation")
404
- - **Flatten User-Defined Fields**: When enabled, brings UDFs up to the top level of each response object for easier access instead of being nested in the userDefinedFields array (maintains the original array for backward compatibility)
405
-
406
- ### Column Selection
407
-
408
- To improve performance and reduce payload size, you can select specific columns to return:
409
-
410
- - **Select Columns**: Choose which fields to include in the response
411
- - Works with all get operations (get, getMany, getManyAdvanced)
412
- - Compatible with label enrichment features
413
-
414
- ### Timezone Handling
415
-
416
- All dates and times in the Autotask API are in UTC. The node automatically converts between your selected timezone and UTC:
417
-
418
- - When creating or updating records, local times are converted to UTC
419
- - When retrieving records, UTC times are converted to your local timezone
420
- - The timezone is configured in the credentials
421
- - For Search Filter operations, input dates are thoroughly converted to UTC using the configured timezone, ensuring consistency with API requirements
422
- - Output dates from all operations are converted to the configured local timezone for easier workflow handling
423
-
424
- ## Limitations
425
-
426
- ### API Limits
427
-
428
- - Maximum 500 records per page in query results
429
- - Maximum 50 pages per query operation
430
- - Maximum 500 OR conditions in filters
431
- - Maximum 1 User Defined Field per query
432
-
433
- ### Entity-Specific Limitations
434
-
435
- - Some entities may not support all operations (e.g., Project Phases cannot be deleted)
436
- - Parent-child relationships require specific handling
437
- - Some fields may be read-only or have specific validation rules
438
-
439
- ### Performance Considerations
440
-
441
- - Large queries may be slow and should be optimised with filters
442
- - Column selection can significantly improve performance by reducing payload size
443
- - Complex workflows with many API calls may hit rate limits
444
- - Disabling caching when using picklist or reference label enrichment can lead to a high volume of API calls, potentially triggering rate limits. Each field being enriched requires a separate API call when cache is not available.
445
-
446
- ## Troubleshooting
447
-
448
- ### Common Issues
449
-
450
- - **Authentication Errors**: Verify your API credentials and ensure the API user has appropriate permissions
451
- - **Field Validation Errors**: Check field requirements in the Autotask API documentation
452
- - **Rate Limiting**: If you encounter rate limiting, reduce the frequency of API calls or implement retry logic
453
-
454
- ### Reporting Bugs
455
-
456
- If you encounter any bugs or issues with this integration:
457
-
458
- 1. Check the [GitHub Issues](https://github.com/msoukhomlinov/n8n-nodes-autotask/issues) to see if the problem has already been reported
459
- 2. If not, please submit a new issue with:
460
- - A clear description of the problem
461
- - Steps to reproduce the issue
462
- - Expected vs actual behaviour
463
- - Your environment details (n8n version, Node.js version)
464
- - Any relevant error messages or screenshots
465
-
466
- Bug reports should be submitted via GitHub at: https://github.com/msoukhomlinov/n8n-nodes-autotask/issues
467
-
468
- ## Resources
469
-
470
- - [Autotask API Documentation](https://ww6.autotask.net/help/developerhelp/Content/APIs/REST/REST_API_Home.htm)
471
- - [n8n Documentation](https://docs.n8n.io/)
472
- - [GitHub Repository](https://github.com/msoukhomlinov/n8n-nodes-autotask)
473
-
474
- ## Support
475
-
476
- If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
477
-
478
- [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
479
-
480
- Your support helps maintain this project and develop new features.
481
-
482
- ## License
483
-
484
- [MIT](LICENSE)
1
+ # n8n-nodes-autotask
2
+
3
+ ![n8n-nodes-autotask](https://img.shields.io/badge/n8n--nodes--autotask-0.9.6-blue)
4
+ ![License](https://img.shields.io/badge/license-MIT-green)
5
+
6
+ [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
7
+
8
+ > **IMPORTANT**: After updating this node to a new version, a restart of your n8n instance is highly recommended to ensure all changes are properly applied.
9
+
10
+ This is an n8n community node for integrating with Autotask PSA. It provides a comprehensive set of operations to interact with Autotask entities through their REST API.
11
+
12
+ ![Overview of n8n-nodes-autotask](./overview.gif)
13
+
14
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
15
+
16
+ [Installation](#installation)
17
+ [Authentication](#authentication)
18
+ [Features](#features)
19
+ [Usage](#usage)
20
+ [Configuration](#configuration)
21
+ [Limitations](#limitations)
22
+ [Troubleshooting](#troubleshooting)
23
+ [Resources](#resources)
24
+ [Support](#support)
25
+ [License](#license)
26
+
27
+ ## Installation
28
+
29
+ Follow these steps to install this node:
30
+
31
+ ```bash
32
+ # Install with npm
33
+ npm install n8n-nodes-autotask
34
+
35
+ # Install with pnpm
36
+ pnpm install n8n-nodes-autotask
37
+ ```
38
+
39
+ **Requirements:**
40
+ - n8n version 1.0.0 or later
41
+ - Node.js version 18.10 or later
42
+ - pnpm version 9.1 or later (if using pnpm)
43
+
44
+ ## Authentication
45
+
46
+ To use this node, you need to have API access to your Autotask instance. Follow these steps to set up authentication:
47
+
48
+ 1. In Autotask, go to **Admin > API User Security**
49
+ 2. Create or select an API user
50
+ 3. Note the API Integration Code, Username, and Secret
51
+ 4. In n8n, create a new credential of type **Autotask API**
52
+ 5. Enter your API Integration Code, Username, and Secret
53
+ 6. Select your Autotask zone
54
+ 7. Select your timezone (affects how dates and times are displayed and entered)
55
+ 8. Configure caching options as needed (this will cache dynamically fetched field picklists)
56
+
57
+ ## Features
58
+
59
+ ### Supported Resources
60
+
61
+ The node supports the following Autotask resources:
62
+
63
+ | Resource | Description |
64
+ |----------|-------------|
65
+ | API Threshold | Check Autotask API usage limits and current usage levels |
66
+ | Billing Code | Manage billing codes for time entries and charges |
67
+ | Company | Manage organisations in Autotask |
68
+ | Company Alert | Manage alerts associated with companies |
69
+ | Company Location | Manage locations for companies |
70
+ | Company Note | Manage notes attached to companies |
71
+ | Company Site Configuration | Manage company site configurations and user-defined fields for customer companies |
72
+ | Company Webhook | Manage webhooks for company events |
73
+ | Configuration Item | Manage configuration items (CIs) for companies |
74
+ | Configuration Item Billing Product Association | Manage product associations for configuration items |
75
+ | Configuration Item Category | Manage categories for configuration items |
76
+ | Configuration Item Category UDF Association | Manage UDF associations for CI categories |
77
+ | Configuration Item DNS Record | Manage DNS records for configuration items |
78
+ | Configuration Item Note | Manage notes for configuration items |
79
+ | Configuration Item Related Item | Manage related items for configuration items |
80
+ | Configuration Item SSL Subject Alternative Name | Manage SSL alternative names for configuration items |
81
+ | Configuration Item Type | Manage types for configuration items |
82
+ | Configuration Item Webhook | Manage webhooks for configuration item events |
83
+ | Contact | Manage contacts associated with companies |
84
+ | Contact Groups | Manage contact groups |
85
+ | Contact Group Contacts | Manage contacts within contact groups |
86
+ | Contact Webhook | Manage webhooks for contact events |
87
+ | Contract | Manage contracts for companies |
88
+ | Contract Billing Rules | Manage billing rules for contracts |
89
+ | Contract Block | Manage block hour contracts |
90
+ | Contract Block Hour Factor | Manage hour factors for block hour contracts |
91
+ | Contract Charge | Manage charges associated with contracts |
92
+ | Contract Exclusion Billing Codes | Manage excluded billing codes for contracts |
93
+ | Contract Exclusion Roles | Manage excluded roles for contracts |
94
+ | Contract Exclusion Set Excluded Roles | Manage excluded roles within exclusion sets |
95
+ | Contract Exclusion Set Excluded Work Types | Manage excluded work types within exclusion sets |
96
+ | Contract Exclusion Sets | Manage exclusion sets for contracts |
97
+ | Contract Milestone | Manage milestones for contracts |
98
+ | Contract Note | Manage notes attached to contracts |
99
+ | Contract Rate | Manage rates for contract services |
100
+ | Contract Retainers | Manage retainers for contracts |
101
+ | Contract Role Costs | Manage role costs for contracts |
102
+ | Contract Service | Manage services within contracts |
103
+ | Contract Service Adjustments | Manage adjustments for contract services |
104
+ | Contract Service Bundle Adjustments | Manage adjustments for service bundles |
105
+ | Contract Service Bundles | Manage service bundles within contracts |
106
+ | Contract Service Bundle Units | Manage service bundle units |
107
+ | Contract Service Unit | Manage service units for contracts |
108
+ | Contract Ticket Purchases | Manage ticket purchases for contracts |
109
+ | Countries | Query countries, which are used in address information for companies, contacts, and resources |
110
+ | Domain Registrars | Manage domain registrars |
111
+ | Holiday | Manage holiday dates |
112
+ | Holiday Set | Manage holiday sets for resources |
113
+ | Invoices | Manage invoices |
114
+ | Notification History | View notification history |
115
+ | Opportunity | Manage sales opportunities |
116
+ | Product | Manage products in the catalogue |
117
+ | Product Vendors | Manage vendor associations for products |
118
+ | Project | Manage projects |
119
+ | Project Charge | Manage charges associated with projects |
120
+ | Project Note | Manage notes attached to projects |
121
+ | Project Phase | Manage phases within projects |
122
+ | Project Task | Manage tasks within projects |
123
+ | Quote | Manage quotes for opportunities with pricing for products, services, and labor |
124
+ | Quote Item | Manage line items for quotes including products, services, and labor |
125
+ | Quote Location | Manage shipping and billing address information for quotes |
126
+ | Quote Template | Query quote templates that define content and appearance of quotes |
127
+ | Resource | Manage staff resources |
128
+ | Resource Role | Manage department/role relationships, service desk queues, and service desk roles |
129
+ | Roles | Manage roles in the system |
130
+ | Search Filter | Build advanced search filters |
131
+ | Service | Manage services offered to clients |
132
+ | Service Call | Manage service calls |
133
+ | Service Call Task | Manage tasks associated with service calls |
134
+ | Service Call Task Resource | Manage resources assigned to service call tasks |
135
+ | Service Call Ticket | Manage tickets linked to service calls |
136
+ | Service Call Ticket Resource | Manage resources assigned to service call tickets |
137
+ | Survey | Manage customer surveys |
138
+ | Survey Results | Manage results from customer surveys |
139
+ | Ticket | Manage service tickets |
140
+ | Ticket History | View historical changes to tickets |
141
+ | Ticket Note | Manage notes attached to tickets |
142
+ | Ticket Note Webhook | Manage webhooks for ticket note events |
143
+ | Ticket Webhook | Manage webhooks for ticket events |
144
+ | Time Entry | Manage time entries for billing |
145
+
146
+ ### Operations
147
+
148
+ For most resources, the following operations are available:
149
+
150
+ - **Create**: Add new records
151
+ - **Read**: Retrieve a single record by ID
152
+ - **Update**: Modify existing records
153
+ - **Delete**: Remove records
154
+ - **Get Many**: Retrieve multiple records with basic filtering options. This operation allows you to:
155
+ - Filter records using simple field conditions (equals)
156
+ - Filtering on User Defined Fields (UDFs)
157
+ - Automatically paginate through large result sets
158
+ - Choose to get all results or limit to a specific number (1-500)
159
+ - Set a maximum number of records to return when not retrieving all records
160
+ - Select specific columns to return in the response
161
+ - Add human-readable labels for picklist and reference fields
162
+ - Flatten User-Defined Fields for easier access in workflows
163
+ - **Get Many Advanced**: Build complex queries with multiple filter conditions and logical operators. This operation provides:
164
+ - Support for complex AND/OR logic in filters
165
+ - Nested condition groups for sophisticated queries
166
+ - Filtering on User Defined Fields (UDFs)
167
+ - Advanced operators like contains, beginsWith, endsWith, exists, notExists
168
+ - Support for IN and NOT IN operators with multiple values
169
+ - Choose to get all results or limit to a specific number (1-500)
170
+ - Set a maximum number of records to return when not retrieving all records
171
+ - Select specific columns to return in the response
172
+ - Add human-readable labels for picklist and reference fields
173
+ - Flatten User-Defined Fields for easier access in workflows
174
+ - Date-based filtering with automatic timezone handling
175
+ - **Count**: Get the number of matching records
176
+ - **Get Entity Info**: Retrieve metadata about the entity
177
+ - **Get Field Info**: Retrieve field definitions for the selected entity
178
+
179
+ For webhook resources (Company Webhook, Contact Webhook, Configuration Item Webhook, Ticket Webhook, Ticket Note Webhook), the following operations are available:
180
+ - **Get**: Retrieve a single webhook by ID
181
+ - **Get Many**: Retrieve multiple webhooks with basic filtering
182
+ - **Delete**: Remove a webhook
183
+
184
+ ### Webhook Trigger
185
+
186
+ The node includes an Autotask Trigger node that can receive webhook events from Autotask. The trigger supports:
187
+
188
+ - Events for multiple entity types (Companies, Contacts, Tickets, Configuration Items, Ticket Notes)
189
+ - Create, Update, and Delete events
190
+ - Field selection for webhook payloads (specify which fields to include)
191
+ - Resource exclusion (exclude specific resources from triggering the workflow)
192
+ - Email notifications for webhook delivery failures
193
+ - Threshold notifications for monitoring webhook performance
194
+ - Automatic webhook registration and cleanup
195
+ - Secure payload verification with HMAC signatures
196
+
197
+ ### Advanced Features
198
+
199
+ - **Resource Mapping**: Dynamically map fields based on entity definitions
200
+ - **Advanced Filtering**: Build complex queries with multiple conditions
201
+ - **Column Selection**: Choose specific fields to return in get operations
202
+ - **Picklist Label Enrichment**: Automatically add human-readable labels for picklist fields
203
+ - **Reference Label Enrichment**: Add human-readable labels for reference fields
204
+ - **UDF Flattening**: Bring user-defined fields up to the top level of response objects for easier access
205
+ - **File-based Caching**: Improved performance with persistent caching that can be shared between workflows and runs
206
+ - **Timezone Handling**: Automatic conversion between local time and UTC
207
+ - **API Usage Monitoring**: Check current API usage thresholds and limits using the API Threshold resource to help prevent hitting rate limits and ensure smooth operations
208
+
209
+ ### API Threshold Resource
210
+
211
+ The API Threshold resource provides a simple way to monitor your Autotask API usage limits and current consumption. This helps users:
212
+ - Track how many API requests have been made in the current timeframe
213
+ - See the maximum allowed requests (threshold limit)
214
+ - View the usage as a percentage and categorized level (Normal, Moderate, High, Critical)
215
+ - Calculate remaining available requests
216
+ - Monitor timeframe duration for rate limits
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.
219
+
220
+ ### AI Agent Playbook
221
+
222
+ This node is optimised for AI agents and tool-calling systems with specialised features designed for autonomous operation.
223
+
224
+ #### Quick Start for AI Agents
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)
343
+
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
349
+
350
+ #### Environment Setup
351
+
352
+ For AI tool usage, set this environment variable:
353
+
354
+ ```bash
355
+ N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
356
+ ```
357
+
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
466
+
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
476
+
477
+ #### Troubleshooting
478
+
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
483
+
484
+ ## Usage
485
+
486
+ ### Basic Example: Creating a Ticket
487
+
488
+ 1. Add an **Autotask** node to your workflow
489
+ 2. Select **Ticket** as the resource
490
+ 3. Select **Create** as the operation
491
+ 4. Configure the required fields (Title, Status, etc.)
492
+ 5. Connect to a trigger or previous node
493
+ 6. Execute the workflow
494
+
495
+ ### Intermediate Example: Querying Projects with Filters
496
+
497
+ 1. Add an **Autotask** node to your workflow
498
+ 2. Select **Project** as the resource
499
+ 3. Select **Get Many** as the operation
500
+ 4. Add filter conditions (e.g., Status equals "Active")
501
+ 5. Choose whether to retrieve all results or limit the number:
502
+ - Toggle "Get All" to true to retrieve all matching records
503
+ - Toggle "Get All" to false and set "Max Records" (1-500) to limit the results
504
+ 6. Connect to a trigger or previous node
505
+ 7. Execute the workflow
506
+
507
+ ### Advanced Example: Using Column Selection and Reference Labels
508
+
509
+ 1. Add an **Autotask** node to your workflow
510
+ 2. Select **Ticket** as the resource
511
+ 3. Select **Get Many** as the operation
512
+ 4. Add filter conditions as needed
513
+ 5. Enable **Select Columns** to choose specific fields to return
514
+ 6. Select only the fields you need in the response (improves performance)
515
+ 7. Enable **Add Picklist Labels** to get human-readable values for picklist fields
516
+ 8. Enable **Add Reference Labels** to get human-readable values for reference fields
517
+ 9. Enable **Flatten User-Defined Fields** to bring UDFs to the top level of response objects
518
+ 10. Execute the workflow to get tickets with only the selected fields and human-readable labels
519
+
520
+ ### Advanced Example: Complex Filtering with Get Many Advanced
521
+
522
+ 1. Add an **Autotask** node to your workflow
523
+ 2. Select **Ticket** as the resource
524
+ 3. Select **Get Many Advanced** as the operation
525
+ 4. Build a complex filter, for example:
526
+ ```json
527
+ {
528
+ "filter": [
529
+ {
530
+ "op": "and",
531
+ "items": [
532
+ {
533
+ "field": "status",
534
+ "op": "noteq",
535
+ "value": 5
536
+ },
537
+ {
538
+ "op": "or",
539
+ "items": [
540
+ {
541
+ "field": "priority",
542
+ "op": "eq",
543
+ "value": 6
544
+ },
545
+ {
546
+ "field": "dueDateTime",
547
+ "op": "lt",
548
+ "value": "{{ $now.plus(3, 'days').toLocal()}}"
549
+ }
550
+ ]
551
+ }
552
+ ]
553
+ }
554
+ ]
555
+ }
556
+ ```
557
+ [Valid filter operators and filter documentation can be found here](https://ww15.autotask.net/help/DeveloperHelp/Content/APIs/REST/API_Calls/REST_Basic_Query_Calls.htm?Highlight=filter#List2)
558
+ 5. Choose whether to retrieve all results or limit the number:
559
+ - Toggle "Get All" to true to retrieve all matching records
560
+ - Toggle "Get All" to false and set "Max Records" (1-500) to limit the results
561
+ 6. Enable **Select Columns** to choose specific fields to return
562
+ 7. Enable **Add Reference Labels** and **Add Picklist Labels** for human-readable values
563
+ 8. Execute the workflow to retrieve tickets that are not complete AND either have priority 6 OR are due within the next 3 days
564
+
565
+ ### Example: Monitoring API Usage with API Threshold
566
+
567
+ 1. Add an **Autotask** node to your workflow
568
+ 2. Select **API Threshold** as the resource
569
+ 3. The operation **Get API Usage** will be automatically selected (it's the only available operation)
570
+ 4. Execute the node to receive current API usage information including:
571
+ - Current usage count
572
+ - Maximum threshold (limit)
573
+ - Usage percentage
574
+ - Usage level (Normal, Moderate, High, Critical)
575
+ - Remaining requests
576
+ - Timeframe duration
577
+ 5. You can use this information with IF nodes to implement conditional logic:
578
+ - Pause workflows when usage is too high
579
+ - Throttle requests during peak usage periods
580
+ - Log warnings when approaching limits
581
+ - Only execute non-critical operations when usage is below certain thresholds
582
+
583
+ ### Advanced Example: Working with Parent-Child Relationships
584
+
585
+ Many Autotask entities have parent-child relationships (e.g., Companies and Contacts). To work with these:
586
+
587
+ 1. First, retrieve or create the parent entity
588
+ 2. Use the parent entity's ID in the child entity operations
589
+ 3. For example, to create a Contact for a Company:
590
+ - First node: Get or create the Company
591
+ - Second node: Create a Contact with the Company ID
592
+
593
+ ### Example: Setting Up a Webhook Trigger
594
+
595
+ 1. Add an **Autotask Trigger** node to your workflow
596
+ 2. Select the entity type to monitor (Companies, Contacts, Tickets, etc.)
597
+ 3. Select the events to subscribe to (Create, Update, Delete)
598
+ 4. Configure the webhook URL (n8n will handle this automatically)
599
+ 5. Optionally specify fields to include in the webhook payload
600
+ 6. Optionally exclude specific resources from triggering the workflow
601
+ 7. Configure email notifications for webhook delivery failures if needed
602
+ 8. Save and activate the workflow
603
+ 9. The node will automatically register the webhook with Autotask
604
+ 10. When events occur in Autotask, they will trigger your workflow
605
+ 11. When the workflow is deactivated, the webhook will be automatically removed
606
+
607
+ ## Configuration
608
+
609
+ ### Caching Options
610
+
611
+ The node includes an enhanced file-based caching system to improve performance by reducing API calls:
612
+
613
+ - **Enable Field Caching**: Toggle caching on/off
614
+ - **Cache TTL**: How long to cache field values (in seconds)
615
+ - **Cache Entity Info**: Whether to cache entity information and field definitions
616
+ - **Entity Info TTL**: How long to cache entity information
617
+ - **Cache Reference Fields**: Whether to cache reference field values
618
+ - **Reference Fields TTL**: How long to cache reference field values
619
+ - **Cache Picklists**: Whether to cache picklist values
620
+ - **Picklists TTL**: How long to cache picklist values
621
+ - **File-based Cache**: Cache is stored in files that can be shared between workflows and runs
622
+ - **Cache Directory**: Optional path to a directory where cache files will be stored
623
+
624
+ > **IMPORTANT**: This node uses dynamic picklists and field enrichers to convert numerical values into human-readable labels through dynamic lookups. It's strongly recommended to keep caching enabled to avoid excessive API calls. Without caching, each picklist and reference field lookup requires separate API calls, which can quickly consume your API rate limits, especially in workflows with many operations or large data sets.
625
+
626
+ ### Label Enrichment and Field Processing
627
+
628
+ The node provides options to enrich entities with human-readable labels and simplify field access:
629
+
630
+ - **Add Picklist Labels**: Adds "_label" fields for picklist values (e.g., Status_label: "In Progress")
631
+ - **Add Reference Labels**: Adds "_label" fields for reference values (e.g., Company_label: "Acme Corporation")
632
+ - **Flatten User-Defined Fields**: When enabled, brings UDFs up to the top level of each response object for easier access instead of being nested in the userDefinedFields array (maintains the original array for backward compatibility)
633
+
634
+ ### Column Selection
635
+
636
+ To improve performance and reduce payload size, you can select specific columns to return:
637
+
638
+ - **Select Columns**: Choose which fields to include in the response
639
+ - Works with all get operations (get, getMany, getManyAdvanced)
640
+ - Compatible with label enrichment features
641
+
642
+ ### Timezone Handling
643
+
644
+ All dates and times in the Autotask API are in UTC. The node automatically converts between your selected timezone and UTC:
645
+
646
+ - When creating or updating records, local times are converted to UTC
647
+ - When retrieving records, UTC times are converted to your local timezone
648
+ - The timezone is configured in the credentials
649
+ - For Search Filter operations, input dates are thoroughly converted to UTC using the configured timezone, ensuring consistency with API requirements
650
+ - Output dates from all operations are converted to the configured local timezone for easier workflow handling
651
+
652
+ ## Limitations
653
+
654
+ ### API Limits
655
+
656
+ - Maximum 500 records per page in query results
657
+ - Maximum 50 pages per query operation
658
+ - Maximum 500 OR conditions in filters
659
+ - Maximum 1 User Defined Field per query
660
+
661
+ ### Entity-Specific Limitations
662
+
663
+ - Some entities may not support all operations (e.g., Project Phases cannot be deleted)
664
+ - Parent-child relationships require specific handling
665
+ - Some fields may be read-only or have specific validation rules
666
+
667
+ ### Performance Considerations
668
+
669
+ - Large queries may be slow and should be optimised with filters
670
+ - Column selection can significantly improve performance by reducing payload size
671
+ - Complex workflows with many API calls may hit rate limits
672
+ - Disabling caching when using picklist or reference label enrichment can lead to a high volume of API calls, potentially triggering rate limits. Each field being enriched requires a separate API call when cache is not available.
673
+
674
+ ## Troubleshooting
675
+
676
+ ### Common Issues
677
+
678
+ - **Authentication Errors**: Verify your API credentials and ensure the API user has appropriate permissions
679
+ - **Field Validation Errors**: Check field requirements in the Autotask API documentation
680
+ - **Rate Limiting**: If you encounter rate limiting, reduce the frequency of API calls or implement retry logic
681
+
682
+ ### Reporting Bugs
683
+
684
+ If you encounter any bugs or issues with this integration:
685
+
686
+ 1. Check the [GitHub Issues](https://github.com/msoukhomlinov/n8n-nodes-autotask/issues) to see if the problem has already been reported
687
+ 2. If not, please submit a new issue with:
688
+ - A clear description of the problem
689
+ - Steps to reproduce the issue
690
+ - Expected vs actual behaviour
691
+ - Your environment details (n8n version, Node.js version)
692
+ - Any relevant error messages or screenshots
693
+
694
+ Bug reports should be submitted via GitHub at: https://github.com/msoukhomlinov/n8n-nodes-autotask/issues
695
+
696
+ ## Resources
697
+
698
+ - [Autotask API Documentation](https://ww6.autotask.net/help/developerhelp/Content/APIs/REST/REST_API_Home.htm)
699
+ - [n8n Documentation](https://docs.n8n.io/)
700
+ - [GitHub Repository](https://github.com/msoukhomlinov/n8n-nodes-autotask)
701
+
702
+ ## Support
703
+
704
+ If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
705
+
706
+ [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
707
+
708
+ Your support helps maintain this project and develop new features.
709
+
710
+ ## License
711
+
712
+ [MIT](LICENSE)