n8n-nodes-mautic-advanced 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://buymeacoffee.com/msoukhomlinov)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Enhanced n8n node for Mautic with comprehensive API coverage including tags, campaigns, categories, and advanced contact management.
|
|
6
|
+
|
|
7
|
+
## 📋 Table of Contents
|
|
8
|
+
|
|
9
|
+
- [What Makes This "Advanced"?](#what-makes-this-advanced)
|
|
10
|
+
- [Features](#features)
|
|
11
|
+
- [Supported Resources and Operations](#supported-resources-and-operations)
|
|
12
|
+
- [Installation](#installation)
|
|
13
|
+
- [Authentication](#authentication)
|
|
14
|
+
- [Advanced Features](#advanced-features)
|
|
15
|
+
- [Usage Examples](#usage-examples)
|
|
16
|
+
- [Development](#development)
|
|
17
|
+
- [Troubleshooting](#troubleshooting)
|
|
18
|
+
- [Changelog](#changelog)
|
|
19
|
+
- [Support](#support)
|
|
20
|
+
- [License](#license)
|
|
6
21
|
|
|
7
22
|
## What Makes This "Advanced"?
|
|
8
23
|
|
|
@@ -15,12 +30,31 @@ This enhanced version extends the standard n8n Mautic node with:
|
|
|
15
30
|
- **📧 Enhanced Email Operations**: Segment-based email sending capabilities
|
|
16
31
|
- **👥 Extended Contact Operations**: UTM tag management, activity tracking, device information, and notes
|
|
17
32
|
- **🏢 Complete Company Management**: Full company lifecycle with custom fields and address support
|
|
33
|
+
- **🔍 Advanced Filtering**: Where filters, DNC filtering, and field selection
|
|
34
|
+
- **📅 Smart Date Handling**: Automatic date formatting for Mautic API compatibility
|
|
18
35
|
|
|
19
|
-
|
|
36
|
+
## Features
|
|
20
37
|
|
|
21
|
-
|
|
38
|
+
### 🚀 Core Features
|
|
39
|
+
- **Comprehensive API Coverage**: All major Mautic API endpoints supported
|
|
40
|
+
- **Advanced Filtering**: Where filters with nested conditions (andX/orX)
|
|
41
|
+
- **DNC Management**: Filter contacts by Do Not Contact status
|
|
42
|
+
- **Field Selection**: Choose which fields to return for Contact operations
|
|
43
|
+
- **Pagination Support**: Automatic handling of large datasets
|
|
44
|
+
- **Custom Fields**: Full support for custom field management
|
|
45
|
+
- **Error Handling**: Robust error handling and validation
|
|
22
46
|
|
|
23
|
-
|
|
47
|
+
### 🔐 Authentication
|
|
48
|
+
- **API Credentials**: Simple API key authentication
|
|
49
|
+
- **OAuth2**: Full OAuth2 flow support for secure authentication
|
|
50
|
+
|
|
51
|
+
### 📊 Data Management
|
|
52
|
+
- **RAW Data Options**: Control data output format
|
|
53
|
+
- **System Fields**: Built-in support for system fields
|
|
54
|
+
- **Date Formatting**: Automatic UTC date formatting
|
|
55
|
+
- **Deduplication**: Prevents duplicate records in paginated results
|
|
56
|
+
|
|
57
|
+
## Supported Resources and Operations
|
|
24
58
|
|
|
25
59
|
### 🏢 Companies
|
|
26
60
|
- **Create** a new company with full address and custom field support
|
|
@@ -31,10 +65,11 @@ This enhanced Mautic node provides comprehensive support for the following Mauti
|
|
|
31
65
|
|
|
32
66
|
### 👥 Contacts (Enhanced)
|
|
33
67
|
- **Create** a new contact with extensive field options
|
|
34
|
-
- **Get** a contact by ID
|
|
35
|
-
- **Get Many** contacts with advanced filtering
|
|
68
|
+
- **Get** a contact by ID with field selection
|
|
69
|
+
- **Get Many** contacts with advanced filtering and DNC options
|
|
36
70
|
- **Update** contact details
|
|
37
71
|
- **Delete** a contact
|
|
72
|
+
- **Delete Batch** multiple contacts in one operation
|
|
38
73
|
- **Send Email** to a contact
|
|
39
74
|
- **Edit Contact Points** (add/subtract points)
|
|
40
75
|
- **Edit Do Not Contact List** (add/remove from DNC)
|
|
@@ -67,6 +102,13 @@ This enhanced Mautic node provides comprehensive support for the following Mauti
|
|
|
67
102
|
- **Update** category details
|
|
68
103
|
- **Delete** a category
|
|
69
104
|
|
|
105
|
+
### 📋 Segments
|
|
106
|
+
- **Create** a new segment
|
|
107
|
+
- **Get** a segment by ID
|
|
108
|
+
- **Get Many** segments with filtering
|
|
109
|
+
- **Update** segment details
|
|
110
|
+
- **Delete** a segment
|
|
111
|
+
|
|
70
112
|
### 🔗 Relationship Management
|
|
71
113
|
- **Campaign Contact**: Add/remove contacts to/from campaigns
|
|
72
114
|
- **Company Contact**: Add/remove contacts to/from companies
|
|
@@ -77,18 +119,204 @@ This enhanced Mautic node provides comprehensive support for the following Mauti
|
|
|
77
119
|
|
|
78
120
|
## Installation
|
|
79
121
|
|
|
80
|
-
|
|
122
|
+
### Method 1: npm (Recommended)
|
|
123
|
+
```bash
|
|
124
|
+
npm install n8n-nodes-mautic-advanced
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Method 2: Manual Installation
|
|
128
|
+
1. Clone this repository:
|
|
129
|
+
```bash
|
|
130
|
+
git clone https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced.git
|
|
131
|
+
cd n8n-nodes-mautic-advanced
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
2. Install dependencies:
|
|
135
|
+
```bash
|
|
136
|
+
npm install
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
3. Build the node:
|
|
140
|
+
```bash
|
|
141
|
+
npm run build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
4. Link to your n8n installation:
|
|
145
|
+
```bash
|
|
146
|
+
npm link
|
|
147
|
+
cd /path/to/your/n8n/installation
|
|
148
|
+
npm link n8n-nodes-mautic-advanced
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Authentication
|
|
152
|
+
|
|
153
|
+
### API Credentials
|
|
154
|
+
1. Go to your Mautic instance
|
|
155
|
+
2. Navigate to **Settings** → **API Credentials**
|
|
156
|
+
3. Create a new API credential
|
|
157
|
+
4. Copy the **Public Key** and **Secret Key**
|
|
158
|
+
5. In n8n, add a new Mautic Advanced credential
|
|
159
|
+
6. Select **Credentials** authentication method
|
|
160
|
+
7. Enter your Mautic URL, Public Key, and Secret Key
|
|
161
|
+
|
|
162
|
+
### OAuth2
|
|
163
|
+
1. In n8n, add a new Mautic Advanced credential
|
|
164
|
+
2. Select **OAuth2** authentication method
|
|
165
|
+
3. Enter your Mautic URL
|
|
166
|
+
4. Follow the OAuth2 authorization flow
|
|
167
|
+
|
|
168
|
+
## Advanced Features
|
|
169
|
+
|
|
170
|
+
### Where Filters
|
|
171
|
+
Advanced filtering for Contact > Get Many operations:
|
|
172
|
+
- **Nested Conditions**: Support for andX/orX logical operators
|
|
173
|
+
- **Multiple Expressions**: eq, neq, lt, lte, gt, gte, between, in, isNull, isNotNull
|
|
174
|
+
- **Custom Fields**: Filter by any custom or system field
|
|
175
|
+
- **Date Filtering**: Automatic date formatting for Mautic API
|
|
176
|
+
|
|
177
|
+
### DNC Filtering
|
|
178
|
+
Filter contacts by Do Not Contact status:
|
|
179
|
+
- **Email DNC Only**: Contacts with email DNC enabled
|
|
180
|
+
- **SMS DNC Only**: Contacts with SMS DNC enabled
|
|
181
|
+
- **Any DNC Only**: Contacts with any DNC enabled
|
|
182
|
+
|
|
183
|
+
### Field Selection
|
|
184
|
+
Choose which fields to return for Contact operations:
|
|
185
|
+
- **System Fields**: date_added, date_modified, id, owner_id
|
|
186
|
+
- **Custom Fields**: Any custom field defined in Mautic
|
|
187
|
+
- **All Fields**: Return complete contact data
|
|
188
|
+
|
|
189
|
+
### Date Formatting
|
|
190
|
+
Automatic date formatting for known date fields:
|
|
191
|
+
- **Format**: YYYY-MM-DD HH:mm:ss UTC
|
|
192
|
+
- **Compatibility**: Ensures Mautic API compatibility
|
|
193
|
+
- **Fields**: date_added, date_modified, lastActive, etc.
|
|
194
|
+
|
|
195
|
+
## Usage Examples
|
|
196
|
+
|
|
197
|
+
### Create a Contact with Tags
|
|
198
|
+
```javascript
|
|
199
|
+
// Contact Create operation
|
|
200
|
+
{
|
|
201
|
+
"email": "john.doe@example.com",
|
|
202
|
+
"firstName": "John",
|
|
203
|
+
"lastName": "Doe",
|
|
204
|
+
"additionalFields": {
|
|
205
|
+
"tags": ["customer", "vip"],
|
|
206
|
+
"company": "Example Corp",
|
|
207
|
+
"phone": "+1234567890"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
81
211
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
212
|
+
### Filter Contacts with Where Conditions
|
|
213
|
+
```javascript
|
|
214
|
+
// Contact Get Many with Where filter
|
|
215
|
+
{
|
|
216
|
+
"where": {
|
|
217
|
+
"conditions": [
|
|
218
|
+
{
|
|
219
|
+
"col": "email",
|
|
220
|
+
"expr": "neq",
|
|
221
|
+
"val": ""
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"col": "date_added",
|
|
225
|
+
"expr": "gte",
|
|
226
|
+
"val": "2024-01-01"
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Send Email to Segment
|
|
234
|
+
```javascript
|
|
235
|
+
// Segment Email operation
|
|
236
|
+
{
|
|
237
|
+
"segmentId": "123",
|
|
238
|
+
"emailId": "456",
|
|
239
|
+
"options": {
|
|
240
|
+
"sendToNewOnly": true
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
86
244
|
|
|
87
245
|
## Development
|
|
88
246
|
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
247
|
+
### Prerequisites
|
|
248
|
+
- Node.js 16+
|
|
249
|
+
- npm or yarn
|
|
250
|
+
- n8n development environment
|
|
251
|
+
|
|
252
|
+
### Commands
|
|
253
|
+
```bash
|
|
254
|
+
# Install dependencies
|
|
255
|
+
npm install
|
|
256
|
+
|
|
257
|
+
# Build the node
|
|
258
|
+
npm run build
|
|
259
|
+
|
|
260
|
+
# Watch for changes (development)
|
|
261
|
+
npm run dev
|
|
262
|
+
|
|
263
|
+
# Check for linting errors
|
|
264
|
+
npm run lint
|
|
265
|
+
|
|
266
|
+
# Fix linting errors
|
|
267
|
+
npm run lint:fix
|
|
268
|
+
|
|
269
|
+
# Format code
|
|
270
|
+
npm run format
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Project Structure
|
|
274
|
+
```
|
|
275
|
+
├── credentials/ # Authentication credentials
|
|
276
|
+
├── nodes/ # Node implementations
|
|
277
|
+
│ └── MauticAdvanced/ # Main node files
|
|
278
|
+
├── dist/ # Compiled output
|
|
279
|
+
├── package.json # Project configuration
|
|
280
|
+
└── README.md # This file
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Troubleshooting
|
|
284
|
+
|
|
285
|
+
### Common Issues
|
|
286
|
+
|
|
287
|
+
#### "Could not get parameter 'options'" Error
|
|
288
|
+
**Cause**: Missing Options parameter in node definition
|
|
289
|
+
**Solution**: Update to latest version (0.3.2+) which includes all required Options parameters
|
|
290
|
+
|
|
291
|
+
#### Authentication Errors
|
|
292
|
+
**Cause**: Incorrect credentials or URL
|
|
293
|
+
**Solution**:
|
|
294
|
+
- Verify Mautic URL format (https://your-mautic.com)
|
|
295
|
+
- Check API credentials are active
|
|
296
|
+
- Ensure proper permissions for API access
|
|
297
|
+
|
|
298
|
+
#### Date Filter Issues
|
|
299
|
+
**Cause**: Incorrect date format
|
|
300
|
+
**Solution**: Use YYYY-MM-DD format for date filters
|
|
301
|
+
|
|
302
|
+
#### Pagination Problems
|
|
303
|
+
**Cause**: Large datasets causing timeouts
|
|
304
|
+
**Solution**: Use "Return All" option or set appropriate limits
|
|
305
|
+
|
|
306
|
+
### Getting Help
|
|
307
|
+
1. Check the [Changelog](CHANGELOG.md) for recent fixes
|
|
308
|
+
2. Search existing [Issues](https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced/issues)
|
|
309
|
+
3. Create a new issue with detailed information
|
|
310
|
+
|
|
311
|
+
## Changelog
|
|
312
|
+
|
|
313
|
+
See [CHANGELOG.md](CHANGELOG.md) for a complete list of changes and version history.
|
|
314
|
+
|
|
315
|
+
### Recent Highlights
|
|
316
|
+
- **v0.3.2**: Fixed Contact Operations Options Error
|
|
317
|
+
- **v0.3.1**: Date filter formatting improvements
|
|
318
|
+
- **v0.3.0**: Advanced filtering, DNC filtering, field selection
|
|
319
|
+
- **v0.2.5**: Segment support and data extraction fixes
|
|
92
320
|
|
|
93
321
|
## Support
|
|
94
322
|
|
|
@@ -100,4 +328,10 @@ Your support helps maintain this project and develop new features.
|
|
|
100
328
|
|
|
101
329
|
## License
|
|
102
330
|
|
|
103
|
-
MIT License
|
|
331
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
332
|
+
|
|
333
|
+
## Credits
|
|
334
|
+
|
|
335
|
+
- Built with [n8n](https://n8n.io/) workflow automation platform
|
|
336
|
+
- Uses [change-case](https://github.com/blakeembrey/change-case) for string manipulation
|
|
337
|
+
- Icons and design inspired by n8n community standards
|
|
@@ -123,6 +123,28 @@ exports.contactFields = [
|
|
|
123
123
|
},
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Options',
|
|
128
|
+
name: 'options',
|
|
129
|
+
type: 'collection',
|
|
130
|
+
placeholder: 'Add Option',
|
|
131
|
+
default: {},
|
|
132
|
+
displayOptions: {
|
|
133
|
+
show: {
|
|
134
|
+
resource: ['contact'],
|
|
135
|
+
operation: ['create'],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
options: [
|
|
139
|
+
{
|
|
140
|
+
displayName: 'RAW Data',
|
|
141
|
+
name: 'rawData',
|
|
142
|
+
type: 'boolean',
|
|
143
|
+
default: true,
|
|
144
|
+
description: 'By default only the data of the fields get returned. If this option is set, the RAW response with all data gets returned.',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
126
148
|
{
|
|
127
149
|
displayName: 'Email',
|
|
128
150
|
name: 'email',
|
|
@@ -651,6 +673,28 @@ exports.contactFields = [
|
|
|
651
673
|
},
|
|
652
674
|
},
|
|
653
675
|
},
|
|
676
|
+
{
|
|
677
|
+
displayName: 'Options',
|
|
678
|
+
name: 'options',
|
|
679
|
+
type: 'collection',
|
|
680
|
+
placeholder: 'Add Option',
|
|
681
|
+
default: {},
|
|
682
|
+
displayOptions: {
|
|
683
|
+
show: {
|
|
684
|
+
resource: ['contact'],
|
|
685
|
+
operation: ['update'],
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
options: [
|
|
689
|
+
{
|
|
690
|
+
displayName: 'RAW Data',
|
|
691
|
+
name: 'rawData',
|
|
692
|
+
type: 'boolean',
|
|
693
|
+
default: true,
|
|
694
|
+
description: 'By default only the data of the fields get returned. If this option is set, the RAW response with all data gets returned.',
|
|
695
|
+
},
|
|
696
|
+
],
|
|
697
|
+
},
|
|
654
698
|
{
|
|
655
699
|
displayName: 'Update Fields',
|
|
656
700
|
name: 'updateFields',
|
|
@@ -95,6 +95,14 @@ exports.mauticApiRequestAllItems = mauticApiRequestAllItems;
|
|
|
95
95
|
*/
|
|
96
96
|
function serialiseMauticWhere(whereArray, prefix = 'where') {
|
|
97
97
|
const params = {};
|
|
98
|
+
const dateFields = [
|
|
99
|
+
'date_modified',
|
|
100
|
+
'date_added',
|
|
101
|
+
'last_active',
|
|
102
|
+
'date_identified',
|
|
103
|
+
'dateFrom',
|
|
104
|
+
'dateTo',
|
|
105
|
+
];
|
|
98
106
|
whereArray.forEach((condition, idx) => {
|
|
99
107
|
const base = `${prefix}[${idx}]`;
|
|
100
108
|
if (condition.expr === 'andX' || condition.expr === 'orX') {
|
|
@@ -116,8 +124,22 @@ function serialiseMauticWhere(whereArray, prefix = 'where') {
|
|
|
116
124
|
params[`${base}[col]`] = condition.col;
|
|
117
125
|
if (condition.expr)
|
|
118
126
|
params[`${base}[expr]`] = condition.expr;
|
|
119
|
-
if (condition.val !== undefined && condition.val !== '')
|
|
120
|
-
|
|
127
|
+
if (condition.val !== undefined && condition.val !== '') {
|
|
128
|
+
let val = condition.val;
|
|
129
|
+
// Auto-format date values for known date fields
|
|
130
|
+
if (condition.col &&
|
|
131
|
+
dateFields.includes(condition.col) &&
|
|
132
|
+
typeof val === 'string' &&
|
|
133
|
+
(val.includes('T') || val.match(/^\d{4}-\d{2}-\d{2}/))) {
|
|
134
|
+
// Try to parse and format as UTC 'YYYY-MM-DD HH:mm:ss'
|
|
135
|
+
const d = new Date(val);
|
|
136
|
+
if (!isNaN(d.getTime())) {
|
|
137
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
138
|
+
val = `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
params[`${base}[val]`] = val;
|
|
142
|
+
}
|
|
121
143
|
}
|
|
122
144
|
});
|
|
123
145
|
return params;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="349.779" height="349.779">
|
|
2
|
-
<path
|
|
3
|
-
fill="#FFF"
|
|
4
|
-
d="M174.89 349.779C78.612 349.779 0 271.462 0 174.89S78.612 0 174.89 0c23.26 0 45.931 4.417 67.129 13.543 5.889 2.65 8.833 9.422 6.478 15.605-2.649 5.888-9.421 8.833-15.604 6.477-18.549-7.655-37.98-11.482-58.002-11.482-83.323 0-151.041 67.718-151.041 151.041s67.717 151.041 151.04 151.041 151.041-67.718 151.041-151.041c0-17.96-2.944-35.332-9.127-51.819-2.355-6.183.883-12.955 7.066-15.31s12.954.883 15.31 7.066c7.066 19.138 10.6 39.453 10.6 60.063-.001 95.983-78.318 174.595-174.89 174.595"
|
|
5
|
-
/>
|
|
6
|
-
<path
|
|
7
|
-
fill="#FDB933"
|
|
8
|
-
d="m251.44 156.93-27.086 28.264 15.015 63.302h34.153zm-11.187-83.618 9.421 9.422-74.784 79.201-63.891-65.658-36.803 152.219h34.154l20.315-84.5 46.225 50.347 98.927-107.76 9.422 9.716 9.421-53.292z"
|
|
9
|
-
/>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="349.779" height="349.779">
|
|
2
|
+
<path
|
|
3
|
+
fill="#FFF"
|
|
4
|
+
d="M174.89 349.779C78.612 349.779 0 271.462 0 174.89S78.612 0 174.89 0c23.26 0 45.931 4.417 67.129 13.543 5.889 2.65 8.833 9.422 6.478 15.605-2.649 5.888-9.421 8.833-15.604 6.477-18.549-7.655-37.98-11.482-58.002-11.482-83.323 0-151.041 67.718-151.041 151.041s67.717 151.041 151.04 151.041 151.041-67.718 151.041-151.041c0-17.96-2.944-35.332-9.127-51.819-2.355-6.183.883-12.955 7.066-15.31s12.954.883 15.31 7.066c7.066 19.138 10.6 39.453 10.6 60.063-.001 95.983-78.318 174.595-174.89 174.595"
|
|
5
|
+
/>
|
|
6
|
+
<path
|
|
7
|
+
fill="#FDB933"
|
|
8
|
+
d="m251.44 156.93-27.086 28.264 15.015 63.302h34.153zm-11.187-83.618 9.421 9.422-74.784 79.201-63.891-65.658-36.803 152.219h34.154l20.315-84.5 46.225 50.347 98.927-107.76 9.422 9.716 9.421-53.292z"
|
|
9
|
+
/>
|
|
10
10
|
</svg>
|
package/package.json
CHANGED