n8n-nodes-mautic-advanced 1.0.0 → 1.2.0

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 (53) hide show
  1. package/README.md +356 -356
  2. package/dist/credentials/MauticAdvancedApi.credentials.js +69 -69
  3. package/dist/credentials/MauticAdvancedOAuth2Api.credentials.js +78 -78
  4. package/dist/nodes/MauticAdvanced/CampaignContactDescription.js +66 -66
  5. package/dist/nodes/MauticAdvanced/CampaignDescription.js +449 -449
  6. package/dist/nodes/MauticAdvanced/CategoryDescription.js +442 -442
  7. package/dist/nodes/MauticAdvanced/CompanyContactDescription.js +64 -64
  8. package/dist/nodes/MauticAdvanced/CompanyDescription.js +608 -608
  9. package/dist/nodes/MauticAdvanced/ContactDescription.js +2359 -2359
  10. package/dist/nodes/MauticAdvanced/ContactSegmentDescription.js +66 -66
  11. package/dist/nodes/MauticAdvanced/EmailDescription.js +612 -612
  12. package/dist/nodes/MauticAdvanced/FieldDescription.js +718 -718
  13. package/dist/nodes/MauticAdvanced/GenericFunctions.js +177 -168
  14. package/dist/nodes/MauticAdvanced/MauticAdvanced.node.js +599 -543
  15. package/dist/nodes/MauticAdvanced/MauticAdvancedAiTools.node.js +361 -364
  16. package/dist/nodes/MauticAdvanced/MauticAdvancedIcon.svg +12 -12
  17. package/dist/nodes/MauticAdvanced/MauticAdvancedTrigger.node.js +171 -171
  18. package/dist/nodes/MauticAdvanced/NoteDescription.js +296 -296
  19. package/dist/nodes/MauticAdvanced/NotificationDescription.js +436 -436
  20. package/dist/nodes/MauticAdvanced/RoleDescription.js +305 -305
  21. package/dist/nodes/MauticAdvanced/SegmentDescription.js +407 -407
  22. package/dist/nodes/MauticAdvanced/SegmentEmailDescription.js +46 -46
  23. package/dist/nodes/MauticAdvanced/StatsDescription.js +177 -177
  24. package/dist/nodes/MauticAdvanced/TagDescription.js +260 -260
  25. package/dist/nodes/MauticAdvanced/ThemeDescription.js +129 -129
  26. package/dist/nodes/MauticAdvanced/UserDescription.js +484 -484
  27. package/dist/nodes/MauticAdvanced/ai-tools/description-builders.js +128 -128
  28. package/dist/nodes/MauticAdvanced/ai-tools/error-formatter.js +78 -62
  29. package/dist/nodes/MauticAdvanced/ai-tools/runtime.js +34 -33
  30. package/dist/nodes/MauticAdvanced/ai-tools/schema-generator.js +687 -692
  31. package/dist/nodes/MauticAdvanced/ai-tools/tool-executor.js +691 -650
  32. package/dist/nodes/MauticAdvanced/operations/CampaignOperations.js +105 -105
  33. package/dist/nodes/MauticAdvanced/operations/CompanyOperations.js +170 -170
  34. package/dist/nodes/MauticAdvanced/operations/ContactOperations.js +669 -663
  35. package/dist/nodes/MauticAdvanced/operations/EmailOperations.js +202 -202
  36. package/dist/nodes/MauticAdvanced/operations/FieldOperations.js +169 -169
  37. package/dist/nodes/MauticAdvanced/operations/MiscellaneousOperations.js +248 -248
  38. package/dist/nodes/MauticAdvanced/operations/NoteOperations.js +99 -99
  39. package/dist/nodes/MauticAdvanced/operations/NotificationOperations.js +137 -137
  40. package/dist/nodes/MauticAdvanced/operations/RoleOperations.js +118 -118
  41. package/dist/nodes/MauticAdvanced/operations/SegmentOperations.js +106 -106
  42. package/dist/nodes/MauticAdvanced/operations/StatsOperations.js +109 -109
  43. package/dist/nodes/MauticAdvanced/operations/TagOperations.js +203 -203
  44. package/dist/nodes/MauticAdvanced/operations/ThemeOperations.js +174 -209
  45. package/dist/nodes/MauticAdvanced/operations/UserOperations.js +163 -163
  46. package/dist/nodes/MauticAdvanced/utils/ApiHelpers.js +169 -147
  47. package/dist/nodes/MauticAdvanced/utils/DataHelpers.js +181 -136
  48. package/dist/nodes/MauticAdvanced/utils/ValidationHelpers.js +122 -122
  49. package/dist/nodes/MauticAdvanced/utils/authErrorHelpers.js +59 -0
  50. package/dist/nodes/MauticAdvanced/utils/authenticatedRequest.js +66 -0
  51. package/dist/nodes/MauticAdvanced/utils/loadOptionsCache.js +102 -0
  52. package/dist/nodes/MauticAdvanced/utils/oauthRequestQueue.js +53 -0
  53. package/package.json +76 -74
package/README.md CHANGED
@@ -1,356 +1,356 @@
1
- # n8n Mautic Advanced Node
2
-
3
- [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
4
-
5
- > **Note:** This is an **unofficial** community node, not affiliated with or endorsed by n8n GmbH. It was built on the back of n8n's official Mautic node because the official node does not provide the API coverage needed for many real-world Mautic workflows (e.g. notes, users, roles, stats, themes, emails, fields, notifications, advanced filtering, and more).
6
-
7
- Enhanced n8n node for Mautic with comprehensive API coverage including tags, campaigns, categories, notifications, and advanced contact management.
8
-
9
- ## 📋 Table of Contents
10
-
11
- - [What Makes This "Advanced"?](#what-makes-this-advanced)
12
- - [Features](#features)
13
- - [Supported Resources and Operations](#supported-resources-and-operations)
14
- - [Installation](#installation)
15
- - [Authentication](#authentication)
16
- - [Advanced Features](#advanced-features)
17
- - [Usage Examples](#usage-examples)
18
- - [Development](#development)
19
- - [Troubleshooting](#troubleshooting)
20
- - [Changelog](#changelog)
21
- - [Support](#support)
22
- - [License](#license)
23
-
24
- ## What Makes This "Advanced"?
25
-
26
- The official n8n Mautic node covers basic contact and company operations but lacks support for many Mautic API endpoints. This unofficial community node extends that foundation with:
27
-
28
- - **🏷️ Complete Tag Management**: Full CRUD operations for tags (missing in the standard node)
29
- - **📊 Campaign Operations**: Create, clone, update, and manage campaigns
30
- - **📁 Category Management**: Handle categories with bundle and color support
31
- - **🔔 Notification Management**: Full CRUD operations for notifications with scheduling and language support
32
- - **🔗 Advanced Relationship Management**: Sophisticated contact-to-campaign and contact-to-company associations
33
- - **📧 Enhanced Email Operations**: Segment-based email sending capabilities
34
- - **👥 Extended Contact Operations**: UTM tag management, activity tracking, device information, and notes
35
- - **🏢 Complete Company Management**: Full company lifecycle with custom fields and address support
36
- - **🔍 Advanced Filtering**: Where filters, DNC filtering, and field selection
37
- - **📅 Smart Date Handling**: Automatic date formatting for Mautic API compatibility
38
-
39
- ## Features
40
-
41
- ### 🚀 Core Features
42
- - **Comprehensive API Coverage**: All major Mautic API endpoints supported
43
- - **Advanced Filtering**: Where filters with nested conditions (andX/orX)
44
- - **DNC Management**: Filter contacts by Do Not Contact status
45
- - **Field Selection**: Choose which fields to return for Contact operations
46
- - **Pagination Support**: Automatic handling of large datasets
47
- - **Custom Fields**: Full support for custom field management
48
- - **Error Handling**: Robust error handling and validation
49
-
50
- ### 🔐 Authentication
51
- - **API Credentials**: Simple API key authentication
52
- - **OAuth2**: Full OAuth2 flow support for secure authentication
53
-
54
- ### 📊 Data Management
55
- - **RAW Data Options**: Control data output format
56
- - **System Fields**: Built-in support for system fields
57
- - **Date Formatting**: Automatic UTC date formatting
58
- - **Deduplication**: Prevents duplicate records in paginated results
59
-
60
- ## Supported Resources and Operations
61
-
62
- ### 🏢 Companies
63
- - **Create** a new company with full address and custom field support
64
- - **Get** a company by ID
65
- - **Get Many** companies with filtering and pagination
66
- - **Update** company details
67
- - **Delete** a company
68
-
69
- ### 👥 Contacts (Enhanced)
70
- - **Create** a new contact with extensive field options
71
- - **Get** a contact by ID with field selection
72
- - **Get Many** contacts with advanced filtering and DNC options
73
- - **Update** contact details
74
- - **Delete** a contact
75
- - **Delete Batch** multiple contacts in one operation
76
- - **Send Email** to a contact
77
- - **Edit Contact Points** (add/subtract points)
78
- - **Edit Do Not Contact List** (add/remove from DNC)
79
- - **Add/Remove UTM Tags** for tracking
80
- - **Get Notes** associated with a contact
81
- - **Get Activity** history for a contact
82
- - **Get Companies** associated with a contact
83
- - **Get Devices** used by a contact
84
-
85
- ### 🏷️ Tags
86
- - **Create** a new tag with description
87
- - **Get** a tag by ID
88
- - **Get Many** tags with search capabilities
89
- - **Update** tag name and description
90
- - **Delete** a tag
91
-
92
- ### 📊 Campaigns
93
- - **Create** a new campaign
94
- - **Get** a campaign by ID
95
- - **Get All** campaigns
96
- - **Update** campaign details
97
- - **Delete** a campaign
98
- - **Clone** an existing campaign
99
- - **Get Contacts** in a campaign
100
-
101
- ### 📁 Categories
102
- - **Create** a new category with bundle and color settings
103
- - **Get** a category by ID
104
- - **Get Many** categories
105
- - **Update** category details
106
- - **Delete** a category
107
-
108
- ### 🔔 Notifications
109
- - **Create** a new notification with scheduling and language support
110
- - **Get** a notification by ID
111
- - **Get Many** notifications with filtering
112
- - **Update** notification details
113
- - **Delete** a notification
114
-
115
- ### 📋 Segments
116
- - **Create** a new segment
117
- - **Get** a segment by ID
118
- - **Get Many** segments with filtering
119
- - **Update** segment details
120
- - **Delete** a segment
121
-
122
- ### 🔗 Relationship Management
123
- - **Campaign Contact**: Add/remove contacts to/from campaigns
124
- - **Company Contact**: Add/remove contacts to/from companies
125
- - **Contact Segment**: Add/remove contacts to/from segments
126
-
127
- ### 📧 Email Operations
128
- - **Segment Email**: Send emails to segments
129
-
130
- ### 👤 Users
131
- - **Create** a new Mautic user (administrator) with role, password, and profile fields
132
- - **Get** a user by ID
133
- - **Get Many** users with basic filtering and pagination
134
- - **Update** user details including role, profile fields, and password
135
- - **Delete** a user
136
-
137
- ### 🔐 Roles
138
- - **Create** a new role with name, description, and permissions
139
- - **Get** a role by ID
140
- - **Get Many** roles with filtering and pagination
141
- - **Update** role details including permissions
142
- - **Delete** a role
143
-
144
- ### 📈 Stats
145
- - **Get Available Tables** to list all statistical tables and their columns
146
- - **Get Stats** from a specific table with filtering, ordering, and pagination
147
-
148
- ## Installation
149
-
150
- ### Method 1: npm (Recommended)
151
- ```bash
152
- npm install n8n-nodes-mautic-advanced
153
- ```
154
-
155
- ### Method 2: Manual Installation
156
- 1. Clone this repository:
157
- ```bash
158
- git clone https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced.git
159
- cd n8n-nodes-mautic-advanced
160
- ```
161
-
162
- 2. Install dependencies:
163
- ```bash
164
- npm install
165
- ```
166
-
167
- 3. Build the node:
168
- ```bash
169
- npm run build
170
- ```
171
-
172
- 4. Link to your n8n installation:
173
- ```bash
174
- npm link
175
- cd /path/to/your/n8n/installation
176
- npm link n8n-nodes-mautic-advanced
177
- ```
178
-
179
- ## Authentication
180
-
181
- ### API Credentials
182
- 1. Go to your Mautic instance
183
- 2. Navigate to **Settings** → **API Credentials**
184
- 3. Create a new API credential
185
- 4. Copy the **Public Key** and **Secret Key**
186
- 5. In n8n, add a new Mautic Advanced credential
187
- 6. Select **Credentials** authentication method
188
- 7. Enter your Mautic URL, Public Key, and Secret Key
189
-
190
- ### OAuth2
191
- 1. In n8n, add a new Mautic Advanced credential
192
- 2. Select **OAuth2** authentication method
193
- 3. Enter your Mautic URL
194
- 4. Follow the OAuth2 authorization flow
195
-
196
- ## Advanced Features
197
-
198
- ### Where Filters
199
- Advanced filtering for Contact > Get Many operations:
200
- - **Nested Conditions**: Support for andX/orX logical operators
201
- - **Multiple Expressions**: eq, neq, lt, lte, gt, gte, between, in, isNull, isNotNull
202
- - **Custom Fields**: Filter by any custom or system field
203
- - **Date Filtering**: Automatic date formatting for Mautic API
204
-
205
- ### DNC Filtering
206
- Filter contacts by Do Not Contact status:
207
- - **Email DNC Only**: Contacts with email DNC enabled
208
- - **SMS DNC Only**: Contacts with SMS DNC enabled
209
- - **Any DNC Only**: Contacts with any DNC enabled
210
-
211
- ### Field Selection
212
- Choose which fields to return for Contact operations:
213
- - **System Fields**: date_added, date_modified, id, owner_id
214
- - **Custom Fields**: Any custom field defined in Mautic
215
- - **All Fields**: Return complete contact data
216
-
217
- ### Date Formatting
218
- Automatic date formatting for known date fields:
219
- - **Format**: YYYY-MM-DD HH:mm:ss UTC
220
- - **Compatibility**: Ensures Mautic API compatibility
221
- - **Fields**: date_added, date_modified, lastActive, etc.
222
-
223
- ## Usage Examples
224
-
225
- ### Create a Contact with Tags
226
- ```javascript
227
- // Contact Create operation
228
- {
229
- "email": "john.doe@example.com",
230
- "firstName": "John",
231
- "lastName": "Doe",
232
- "additionalFields": {
233
- "tags": ["customer", "vip"],
234
- "company": "Example Corp",
235
- "phone": "+1234567890"
236
- }
237
- }
238
- ```
239
-
240
- ### Filter Contacts with Where Conditions
241
- ```javascript
242
- // Contact Get Many with Where filter
243
- {
244
- "where": {
245
- "conditions": [
246
- {
247
- "col": "email",
248
- "expr": "neq",
249
- "val": ""
250
- },
251
- {
252
- "col": "date_added",
253
- "expr": "gte",
254
- "val": "2024-01-01"
255
- }
256
- ]
257
- }
258
- }
259
- ```
260
-
261
- ### Send Email to Segment
262
- ```javascript
263
- // Segment Email operation
264
- {
265
- "segmentId": "123",
266
- "emailId": "456",
267
- "options": {
268
- "sendToNewOnly": true
269
- }
270
- }
271
- ```
272
-
273
- ## Development
274
-
275
- ### Prerequisites
276
- - Node.js 16+
277
- - npm or yarn
278
- - n8n development environment
279
-
280
- ### Commands
281
- ```bash
282
- # Install dependencies
283
- npm install
284
-
285
- # Build the node
286
- npm run build
287
-
288
- # Watch for changes (development)
289
- npm run dev
290
-
291
- # Check for linting errors
292
- npm run lint
293
-
294
- # Fix linting errors
295
- npm run lint:fix
296
-
297
- # Format code
298
- npm run format
299
- ```
300
-
301
- ### Project Structure
302
- ```
303
- ├── credentials/ # Authentication credentials
304
- ├── nodes/ # Node implementations
305
- │ └── MauticAdvanced/ # Main node files
306
- ├── dist/ # Compiled output
307
- ├── package.json # Project configuration
308
- └── README.md # This file
309
- ```
310
-
311
- ## Troubleshooting
312
-
313
- ### Common Issues
314
-
315
- #### "Could not get parameter 'options'" Error
316
- **Cause**: Missing Options parameter in node definition
317
- **Solution**: Update to latest version (0.3.2+) which includes all required Options parameters
318
-
319
- #### Authentication Errors
320
- **Cause**: Incorrect credentials or URL
321
- **Solution**:
322
- - Verify Mautic URL format (https://your-mautic.com)
323
- - Check API credentials are active
324
- - Ensure proper permissions for API access
325
-
326
- #### Date Filter Issues
327
- **Cause**: Incorrect date format
328
- **Solution**: Use YYYY-MM-DD format for date filters
329
-
330
- #### Pagination Problems
331
- **Cause**: Large datasets causing timeouts
332
- **Solution**: Use "Return All" option or set appropriate limits
333
-
334
- ### Getting Help
335
- 1. Check the [Changelog](CHANGELOG.md) for recent fixes
336
- 2. Search existing [Issues](https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced/issues)
337
- 3. Create a new issue with detailed information
338
-
339
- ## Support
340
-
341
- If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
342
-
343
- [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
344
-
345
- Your support helps maintain this project and develop new features.
346
-
347
- ## License
348
-
349
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
350
-
351
- ## Credits
352
-
353
- - Built on top of n8n's official Mautic node — extended with additional API coverage where the official node falls short
354
- - Built with [n8n](https://n8n.io/) workflow automation platform
355
- - Uses [change-case](https://github.com/blakeembrey/change-case) for string manipulation
356
- - Uses a custom icon to distinguish from the official n8n Mautic node
1
+ # n8n Mautic Advanced Node
2
+
3
+ [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
4
+
5
+ > **Note:** This is an **unofficial** community node, not affiliated with or endorsed by n8n GmbH. It was built on the back of n8n's official Mautic node because the official node does not provide the API coverage needed for many real-world Mautic workflows (e.g. notes, users, roles, stats, themes, emails, fields, notifications, advanced filtering, and more).
6
+
7
+ Enhanced n8n node for Mautic with comprehensive API coverage including tags, campaigns, categories, notifications, and advanced contact management.
8
+
9
+ ## 📋 Table of Contents
10
+
11
+ - [What Makes This "Advanced"?](#what-makes-this-advanced)
12
+ - [Features](#features)
13
+ - [Supported Resources and Operations](#supported-resources-and-operations)
14
+ - [Installation](#installation)
15
+ - [Authentication](#authentication)
16
+ - [Advanced Features](#advanced-features)
17
+ - [Usage Examples](#usage-examples)
18
+ - [Development](#development)
19
+ - [Troubleshooting](#troubleshooting)
20
+ - [Changelog](#changelog)
21
+ - [Support](#support)
22
+ - [License](#license)
23
+
24
+ ## What Makes This "Advanced"?
25
+
26
+ The official n8n Mautic node covers basic contact and company operations but lacks support for many Mautic API endpoints. This unofficial community node extends that foundation with:
27
+
28
+ - **🏷️ Complete Tag Management**: Full CRUD operations for tags (missing in the standard node)
29
+ - **📊 Campaign Operations**: Create, clone, update, and manage campaigns
30
+ - **📁 Category Management**: Handle categories with bundle and color support
31
+ - **🔔 Notification Management**: Full CRUD operations for notifications with scheduling and language support
32
+ - **🔗 Advanced Relationship Management**: Sophisticated contact-to-campaign and contact-to-company associations
33
+ - **📧 Enhanced Email Operations**: Segment-based email sending capabilities
34
+ - **👥 Extended Contact Operations**: UTM tag management, activity tracking, device information, and notes
35
+ - **🏢 Complete Company Management**: Full company lifecycle with custom fields and address support
36
+ - **🔍 Advanced Filtering**: Where filters, DNC filtering, and field selection
37
+ - **📅 Smart Date Handling**: Automatic date formatting for Mautic API compatibility
38
+
39
+ ## Features
40
+
41
+ ### 🚀 Core Features
42
+ - **Comprehensive API Coverage**: All major Mautic API endpoints supported
43
+ - **Advanced Filtering**: Where filters with nested conditions (andX/orX)
44
+ - **DNC Management**: Filter contacts by Do Not Contact status
45
+ - **Field Selection**: Choose which fields to return for Contact operations
46
+ - **Pagination Support**: Automatic handling of large datasets
47
+ - **Custom Fields**: Full support for custom field management
48
+ - **Error Handling**: Robust error handling and validation
49
+
50
+ ### 🔐 Authentication
51
+ - **API Credentials**: Simple API key authentication
52
+ - **OAuth2**: Full OAuth2 flow support for secure authentication
53
+
54
+ ### 📊 Data Management
55
+ - **RAW Data Options**: Control data output format
56
+ - **System Fields**: Built-in support for system fields
57
+ - **Date Formatting**: Automatic UTC date formatting
58
+ - **Deduplication**: Prevents duplicate records in paginated results
59
+
60
+ ## Supported Resources and Operations
61
+
62
+ ### 🏢 Companies
63
+ - **Create** a new company with full address and custom field support
64
+ - **Get** a company by ID
65
+ - **Get Many** companies with filtering and pagination
66
+ - **Update** company details
67
+ - **Delete** a company
68
+
69
+ ### 👥 Contacts (Enhanced)
70
+ - **Create** a new contact with extensive field options
71
+ - **Get** a contact by ID with field selection
72
+ - **Get Many** contacts with advanced filtering and DNC options
73
+ - **Update** contact details
74
+ - **Delete** a contact
75
+ - **Delete Batch** multiple contacts in one operation
76
+ - **Send Email** to a contact
77
+ - **Edit Contact Points** (add/subtract points)
78
+ - **Edit Do Not Contact List** (add/remove from DNC)
79
+ - **Add/Remove UTM Tags** for tracking
80
+ - **Get Notes** associated with a contact
81
+ - **Get Activity** history for a contact
82
+ - **Get Companies** associated with a contact
83
+ - **Get Devices** used by a contact
84
+
85
+ ### 🏷️ Tags
86
+ - **Create** a new tag with description
87
+ - **Get** a tag by ID
88
+ - **Get Many** tags with search capabilities
89
+ - **Update** tag name and description
90
+ - **Delete** a tag
91
+
92
+ ### 📊 Campaigns
93
+ - **Create** a new campaign
94
+ - **Get** a campaign by ID
95
+ - **Get All** campaigns
96
+ - **Update** campaign details
97
+ - **Delete** a campaign
98
+ - **Clone** an existing campaign
99
+ - **Get Contacts** in a campaign
100
+
101
+ ### 📁 Categories
102
+ - **Create** a new category with bundle and color settings
103
+ - **Get** a category by ID
104
+ - **Get Many** categories
105
+ - **Update** category details
106
+ - **Delete** a category
107
+
108
+ ### 🔔 Notifications
109
+ - **Create** a new notification with scheduling and language support
110
+ - **Get** a notification by ID
111
+ - **Get Many** notifications with filtering
112
+ - **Update** notification details
113
+ - **Delete** a notification
114
+
115
+ ### 📋 Segments
116
+ - **Create** a new segment
117
+ - **Get** a segment by ID
118
+ - **Get Many** segments with filtering
119
+ - **Update** segment details
120
+ - **Delete** a segment
121
+
122
+ ### 🔗 Relationship Management
123
+ - **Campaign Contact**: Add/remove contacts to/from campaigns
124
+ - **Company Contact**: Add/remove contacts to/from companies
125
+ - **Contact Segment**: Add/remove contacts to/from segments
126
+
127
+ ### 📧 Email Operations
128
+ - **Segment Email**: Send emails to segments
129
+
130
+ ### 👤 Users
131
+ - **Create** a new Mautic user (administrator) with role, password, and profile fields
132
+ - **Get** a user by ID
133
+ - **Get Many** users with basic filtering and pagination
134
+ - **Update** user details including role, profile fields, and password
135
+ - **Delete** a user
136
+
137
+ ### 🔐 Roles
138
+ - **Create** a new role with name, description, and permissions
139
+ - **Get** a role by ID
140
+ - **Get Many** roles with filtering and pagination
141
+ - **Update** role details including permissions
142
+ - **Delete** a role
143
+
144
+ ### 📈 Stats
145
+ - **Get Available Tables** to list all statistical tables and their columns
146
+ - **Get Stats** from a specific table with filtering, ordering, and pagination
147
+
148
+ ## Installation
149
+
150
+ ### Method 1: npm (Recommended)
151
+ ```bash
152
+ npm install n8n-nodes-mautic-advanced
153
+ ```
154
+
155
+ ### Method 2: Manual Installation
156
+ 1. Clone this repository:
157
+ ```bash
158
+ git clone https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced.git
159
+ cd n8n-nodes-mautic-advanced
160
+ ```
161
+
162
+ 2. Install dependencies:
163
+ ```bash
164
+ npm install
165
+ ```
166
+
167
+ 3. Build the node:
168
+ ```bash
169
+ npm run build
170
+ ```
171
+
172
+ 4. Link to your n8n installation:
173
+ ```bash
174
+ npm link
175
+ cd /path/to/your/n8n/installation
176
+ npm link n8n-nodes-mautic-advanced
177
+ ```
178
+
179
+ ## Authentication
180
+
181
+ ### API Credentials
182
+ 1. Go to your Mautic instance
183
+ 2. Navigate to **Settings** → **API Credentials**
184
+ 3. Create a new API credential
185
+ 4. Copy the **Public Key** and **Secret Key**
186
+ 5. In n8n, add a new Mautic Advanced credential
187
+ 6. Select **Credentials** authentication method
188
+ 7. Enter your Mautic URL, Public Key, and Secret Key
189
+
190
+ ### OAuth2
191
+ 1. In n8n, add a new Mautic Advanced credential
192
+ 2. Select **OAuth2** authentication method
193
+ 3. Enter your Mautic URL
194
+ 4. Follow the OAuth2 authorization flow
195
+
196
+ ## Advanced Features
197
+
198
+ ### Where Filters
199
+ Advanced filtering for Contact > Get Many operations:
200
+ - **Nested Conditions**: Support for andX/orX logical operators
201
+ - **Multiple Expressions**: eq, neq, lt, lte, gt, gte, between, in, isNull, isNotNull
202
+ - **Custom Fields**: Filter by any custom or system field
203
+ - **Date Filtering**: Automatic date formatting for Mautic API
204
+
205
+ ### DNC Filtering
206
+ Filter contacts by Do Not Contact status:
207
+ - **Email DNC Only**: Contacts with email DNC enabled
208
+ - **SMS DNC Only**: Contacts with SMS DNC enabled
209
+ - **Any DNC Only**: Contacts with any DNC enabled
210
+
211
+ ### Field Selection
212
+ Choose which fields to return for Contact operations:
213
+ - **System Fields**: date_added, date_modified, id, owner_id
214
+ - **Custom Fields**: Any custom field defined in Mautic
215
+ - **All Fields**: Return complete contact data
216
+
217
+ ### Date Formatting
218
+ Automatic date formatting for known date fields:
219
+ - **Format**: YYYY-MM-DD HH:mm:ss UTC
220
+ - **Compatibility**: Ensures Mautic API compatibility
221
+ - **Fields**: date_added, date_modified, lastActive, etc.
222
+
223
+ ## Usage Examples
224
+
225
+ ### Create a Contact with Tags
226
+ ```javascript
227
+ // Contact Create operation
228
+ {
229
+ "email": "john.doe@example.com",
230
+ "firstName": "John",
231
+ "lastName": "Doe",
232
+ "additionalFields": {
233
+ "tags": ["customer", "vip"],
234
+ "company": "Example Corp",
235
+ "phone": "+1234567890"
236
+ }
237
+ }
238
+ ```
239
+
240
+ ### Filter Contacts with Where Conditions
241
+ ```javascript
242
+ // Contact Get Many with Where filter
243
+ {
244
+ "where": {
245
+ "conditions": [
246
+ {
247
+ "col": "email",
248
+ "expr": "neq",
249
+ "val": ""
250
+ },
251
+ {
252
+ "col": "date_added",
253
+ "expr": "gte",
254
+ "val": "2024-01-01"
255
+ }
256
+ ]
257
+ }
258
+ }
259
+ ```
260
+
261
+ ### Send Email to Segment
262
+ ```javascript
263
+ // Segment Email operation
264
+ {
265
+ "segmentId": "123",
266
+ "emailId": "456",
267
+ "options": {
268
+ "sendToNewOnly": true
269
+ }
270
+ }
271
+ ```
272
+
273
+ ## Development
274
+
275
+ ### Prerequisites
276
+ - Node.js 16+
277
+ - npm or yarn
278
+ - n8n development environment
279
+
280
+ ### Commands
281
+ ```bash
282
+ # Install dependencies
283
+ npm install
284
+
285
+ # Build the node
286
+ npm run build
287
+
288
+ # Watch for changes (development)
289
+ npm run dev
290
+
291
+ # Check for linting errors
292
+ npm run lint
293
+
294
+ # Fix linting errors
295
+ npm run lint:fix
296
+
297
+ # Format code
298
+ npm run format
299
+ ```
300
+
301
+ ### Project Structure
302
+ ```
303
+ ├── credentials/ # Authentication credentials
304
+ ├── nodes/ # Node implementations
305
+ │ └── MauticAdvanced/ # Main node files
306
+ ├── dist/ # Compiled output
307
+ ├── package.json # Project configuration
308
+ └── README.md # This file
309
+ ```
310
+
311
+ ## Troubleshooting
312
+
313
+ ### Common Issues
314
+
315
+ #### "Could not get parameter 'options'" Error
316
+ **Cause**: Missing Options parameter in node definition
317
+ **Solution**: Update to latest version (0.3.2+) which includes all required Options parameters
318
+
319
+ #### Authentication Errors
320
+ **Cause**: Incorrect credentials or URL
321
+ **Solution**:
322
+ - Verify Mautic URL format (https://your-mautic.com)
323
+ - Check API credentials are active
324
+ - Ensure proper permissions for API access
325
+
326
+ #### Date Filter Issues
327
+ **Cause**: Incorrect date format
328
+ **Solution**: Use YYYY-MM-DD format for date filters
329
+
330
+ #### Pagination Problems
331
+ **Cause**: Large datasets causing timeouts
332
+ **Solution**: Use "Return All" option or set appropriate limits
333
+
334
+ ### Getting Help
335
+ 1. Check the [Changelog](CHANGELOG.md) for recent fixes
336
+ 2. Search existing [Issues](https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced/issues)
337
+ 3. Create a new issue with detailed information
338
+
339
+ ## Support
340
+
341
+ If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
342
+
343
+ [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow.svg)](https://buymeacoffee.com/msoukhomlinov)
344
+
345
+ Your support helps maintain this project and develop new features.
346
+
347
+ ## License
348
+
349
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
350
+
351
+ ## Credits
352
+
353
+ - Built on top of n8n's official Mautic node — extended with additional API coverage where the official node falls short
354
+ - Built with [n8n](https://n8n.io/) workflow automation platform
355
+ - Uses [change-case](https://github.com/blakeembrey/change-case) for string manipulation
356
+ - Uses a custom icon to distinguish from the official n8n Mautic node