n8n-nodes-mautic-advanced 0.7.2 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +353 -353
- package/dist/nodes/MauticAdvanced/ContactDescription.js +162 -36
- package/dist/nodes/MauticAdvanced/MauticAdvanced.node.js +33 -2
- package/dist/nodes/MauticAdvanced/MauticAdvancedTrigger.node.js +1 -1
- package/dist/nodes/MauticAdvanced/{MauticAdvanced.svg → mauticadvanced.svg} +10 -10
- package/dist/nodes/MauticAdvanced/operations/ContactOperations.js +73 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,353 +1,353 @@
|
|
|
1
|
-
# n8n Mautic Advanced Node
|
|
2
|
-
|
|
3
|
-
[](https://buymeacoffee.com/msoukhomlinov)
|
|
4
|
-
|
|
5
|
-
Enhanced n8n node for Mautic with comprehensive API coverage including tags, campaigns, categories, notifications, 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)
|
|
21
|
-
|
|
22
|
-
## What Makes This "Advanced"?
|
|
23
|
-
|
|
24
|
-
This enhanced version extends the standard n8n Mautic node with:
|
|
25
|
-
|
|
26
|
-
- **🏷️ Complete Tag Management**: Full CRUD operations for tags (missing in the standard node)
|
|
27
|
-
- **📊 Campaign Operations**: Create, clone, update, and manage campaigns
|
|
28
|
-
- **📁 Category Management**: Handle categories with bundle and color support
|
|
29
|
-
- **🔔 Notification Management**: Full CRUD operations for notifications with scheduling and language support
|
|
30
|
-
- **🔗 Advanced Relationship Management**: Sophisticated contact-to-campaign and contact-to-company associations
|
|
31
|
-
- **📧 Enhanced Email Operations**: Segment-based email sending capabilities
|
|
32
|
-
- **👥 Extended Contact Operations**: UTM tag management, activity tracking, device information, and notes
|
|
33
|
-
- **🏢 Complete Company Management**: Full company lifecycle with custom fields and address support
|
|
34
|
-
- **🔍 Advanced Filtering**: Where filters, DNC filtering, and field selection
|
|
35
|
-
- **📅 Smart Date Handling**: Automatic date formatting for Mautic API compatibility
|
|
36
|
-
|
|
37
|
-
## Features
|
|
38
|
-
|
|
39
|
-
### 🚀 Core Features
|
|
40
|
-
- **Comprehensive API Coverage**: All major Mautic API endpoints supported
|
|
41
|
-
- **Advanced Filtering**: Where filters with nested conditions (andX/orX)
|
|
42
|
-
- **DNC Management**: Filter contacts by Do Not Contact status
|
|
43
|
-
- **Field Selection**: Choose which fields to return for Contact operations
|
|
44
|
-
- **Pagination Support**: Automatic handling of large datasets
|
|
45
|
-
- **Custom Fields**: Full support for custom field management
|
|
46
|
-
- **Error Handling**: Robust error handling and validation
|
|
47
|
-
|
|
48
|
-
### 🔐 Authentication
|
|
49
|
-
- **API Credentials**: Simple API key authentication
|
|
50
|
-
- **OAuth2**: Full OAuth2 flow support for secure authentication
|
|
51
|
-
|
|
52
|
-
### 📊 Data Management
|
|
53
|
-
- **RAW Data Options**: Control data output format
|
|
54
|
-
- **System Fields**: Built-in support for system fields
|
|
55
|
-
- **Date Formatting**: Automatic UTC date formatting
|
|
56
|
-
- **Deduplication**: Prevents duplicate records in paginated results
|
|
57
|
-
|
|
58
|
-
## Supported Resources and Operations
|
|
59
|
-
|
|
60
|
-
### 🏢 Companies
|
|
61
|
-
- **Create** a new company with full address and custom field support
|
|
62
|
-
- **Get** a company by ID
|
|
63
|
-
- **Get Many** companies with filtering and pagination
|
|
64
|
-
- **Update** company details
|
|
65
|
-
- **Delete** a company
|
|
66
|
-
|
|
67
|
-
### 👥 Contacts (Enhanced)
|
|
68
|
-
- **Create** a new contact with extensive field options
|
|
69
|
-
- **Get** a contact by ID with field selection
|
|
70
|
-
- **Get Many** contacts with advanced filtering and DNC options
|
|
71
|
-
- **Update** contact details
|
|
72
|
-
- **Delete** a contact
|
|
73
|
-
- **Delete Batch** multiple contacts in one operation
|
|
74
|
-
- **Send Email** to a contact
|
|
75
|
-
- **Edit Contact Points** (add/subtract points)
|
|
76
|
-
- **Edit Do Not Contact List** (add/remove from DNC)
|
|
77
|
-
- **Add/Remove UTM Tags** for tracking
|
|
78
|
-
- **Get Notes** associated with a contact
|
|
79
|
-
- **Get Activity** history for a contact
|
|
80
|
-
- **Get Companies** associated with a contact
|
|
81
|
-
- **Get Devices** used by a contact
|
|
82
|
-
|
|
83
|
-
### 🏷️ Tags
|
|
84
|
-
- **Create** a new tag with description
|
|
85
|
-
- **Get** a tag by ID
|
|
86
|
-
- **Get Many** tags with search capabilities
|
|
87
|
-
- **Update** tag name and description
|
|
88
|
-
- **Delete** a tag
|
|
89
|
-
|
|
90
|
-
### 📊 Campaigns
|
|
91
|
-
- **Create** a new campaign
|
|
92
|
-
- **Get** a campaign by ID
|
|
93
|
-
- **Get All** campaigns
|
|
94
|
-
- **Update** campaign details
|
|
95
|
-
- **Delete** a campaign
|
|
96
|
-
- **Clone** an existing campaign
|
|
97
|
-
- **Get Contacts** in a campaign
|
|
98
|
-
|
|
99
|
-
### 📁 Categories
|
|
100
|
-
- **Create** a new category with bundle and color settings
|
|
101
|
-
- **Get** a category by ID
|
|
102
|
-
- **Get Many** categories
|
|
103
|
-
- **Update** category details
|
|
104
|
-
- **Delete** a category
|
|
105
|
-
|
|
106
|
-
### 🔔 Notifications
|
|
107
|
-
- **Create** a new notification with scheduling and language support
|
|
108
|
-
- **Get** a notification by ID
|
|
109
|
-
- **Get Many** notifications with filtering
|
|
110
|
-
- **Update** notification details
|
|
111
|
-
- **Delete** a notification
|
|
112
|
-
|
|
113
|
-
### 📋 Segments
|
|
114
|
-
- **Create** a new segment
|
|
115
|
-
- **Get** a segment by ID
|
|
116
|
-
- **Get Many** segments with filtering
|
|
117
|
-
- **Update** segment details
|
|
118
|
-
- **Delete** a segment
|
|
119
|
-
|
|
120
|
-
### 🔗 Relationship Management
|
|
121
|
-
- **Campaign Contact**: Add/remove contacts to/from campaigns
|
|
122
|
-
- **Company Contact**: Add/remove contacts to/from companies
|
|
123
|
-
- **Contact Segment**: Add/remove contacts to/from segments
|
|
124
|
-
|
|
125
|
-
### 📧 Email Operations
|
|
126
|
-
- **Segment Email**: Send emails to segments
|
|
127
|
-
|
|
128
|
-
### 👤 Users
|
|
129
|
-
- **Create** a new Mautic user (administrator) with role, password, and profile fields
|
|
130
|
-
- **Get** a user by ID
|
|
131
|
-
- **Get Many** users with basic filtering and pagination
|
|
132
|
-
- **Update** user details including role, profile fields, and password
|
|
133
|
-
- **Delete** a user
|
|
134
|
-
|
|
135
|
-
### 🔐 Roles
|
|
136
|
-
- **Create** a new role with name, description, and permissions
|
|
137
|
-
- **Get** a role by ID
|
|
138
|
-
- **Get Many** roles with filtering and pagination
|
|
139
|
-
- **Update** role details including permissions
|
|
140
|
-
- **Delete** a role
|
|
141
|
-
|
|
142
|
-
### 📈 Stats
|
|
143
|
-
- **Get Available Tables** to list all statistical tables and their columns
|
|
144
|
-
- **Get Stats** from a specific table with filtering, ordering, and pagination
|
|
145
|
-
|
|
146
|
-
## Installation
|
|
147
|
-
|
|
148
|
-
### Method 1: npm (Recommended)
|
|
149
|
-
```bash
|
|
150
|
-
npm install n8n-nodes-mautic-advanced
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Method 2: Manual Installation
|
|
154
|
-
1. Clone this repository:
|
|
155
|
-
```bash
|
|
156
|
-
git clone https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced.git
|
|
157
|
-
cd n8n-nodes-mautic-advanced
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
2. Install dependencies:
|
|
161
|
-
```bash
|
|
162
|
-
npm install
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
3. Build the node:
|
|
166
|
-
```bash
|
|
167
|
-
npm run build
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
4. Link to your n8n installation:
|
|
171
|
-
```bash
|
|
172
|
-
npm link
|
|
173
|
-
cd /path/to/your/n8n/installation
|
|
174
|
-
npm link n8n-nodes-mautic-advanced
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Authentication
|
|
178
|
-
|
|
179
|
-
### API Credentials
|
|
180
|
-
1. Go to your Mautic instance
|
|
181
|
-
2. Navigate to **Settings** → **API Credentials**
|
|
182
|
-
3. Create a new API credential
|
|
183
|
-
4. Copy the **Public Key** and **Secret Key**
|
|
184
|
-
5. In n8n, add a new Mautic Advanced credential
|
|
185
|
-
6. Select **Credentials** authentication method
|
|
186
|
-
7. Enter your Mautic URL, Public Key, and Secret Key
|
|
187
|
-
|
|
188
|
-
### OAuth2
|
|
189
|
-
1. In n8n, add a new Mautic Advanced credential
|
|
190
|
-
2. Select **OAuth2** authentication method
|
|
191
|
-
3. Enter your Mautic URL
|
|
192
|
-
4. Follow the OAuth2 authorization flow
|
|
193
|
-
|
|
194
|
-
## Advanced Features
|
|
195
|
-
|
|
196
|
-
### Where Filters
|
|
197
|
-
Advanced filtering for Contact > Get Many operations:
|
|
198
|
-
- **Nested Conditions**: Support for andX/orX logical operators
|
|
199
|
-
- **Multiple Expressions**: eq, neq, lt, lte, gt, gte, between, in, isNull, isNotNull
|
|
200
|
-
- **Custom Fields**: Filter by any custom or system field
|
|
201
|
-
- **Date Filtering**: Automatic date formatting for Mautic API
|
|
202
|
-
|
|
203
|
-
### DNC Filtering
|
|
204
|
-
Filter contacts by Do Not Contact status:
|
|
205
|
-
- **Email DNC Only**: Contacts with email DNC enabled
|
|
206
|
-
- **SMS DNC Only**: Contacts with SMS DNC enabled
|
|
207
|
-
- **Any DNC Only**: Contacts with any DNC enabled
|
|
208
|
-
|
|
209
|
-
### Field Selection
|
|
210
|
-
Choose which fields to return for Contact operations:
|
|
211
|
-
- **System Fields**: date_added, date_modified, id, owner_id
|
|
212
|
-
- **Custom Fields**: Any custom field defined in Mautic
|
|
213
|
-
- **All Fields**: Return complete contact data
|
|
214
|
-
|
|
215
|
-
### Date Formatting
|
|
216
|
-
Automatic date formatting for known date fields:
|
|
217
|
-
- **Format**: YYYY-MM-DD HH:mm:ss UTC
|
|
218
|
-
- **Compatibility**: Ensures Mautic API compatibility
|
|
219
|
-
- **Fields**: date_added, date_modified, lastActive, etc.
|
|
220
|
-
|
|
221
|
-
## Usage Examples
|
|
222
|
-
|
|
223
|
-
### Create a Contact with Tags
|
|
224
|
-
```javascript
|
|
225
|
-
// Contact Create operation
|
|
226
|
-
{
|
|
227
|
-
"email": "john.doe@example.com",
|
|
228
|
-
"firstName": "John",
|
|
229
|
-
"lastName": "Doe",
|
|
230
|
-
"additionalFields": {
|
|
231
|
-
"tags": ["customer", "vip"],
|
|
232
|
-
"company": "Example Corp",
|
|
233
|
-
"phone": "+1234567890"
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### Filter Contacts with Where Conditions
|
|
239
|
-
```javascript
|
|
240
|
-
// Contact Get Many with Where filter
|
|
241
|
-
{
|
|
242
|
-
"where": {
|
|
243
|
-
"conditions": [
|
|
244
|
-
{
|
|
245
|
-
"col": "email",
|
|
246
|
-
"expr": "neq",
|
|
247
|
-
"val": ""
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
"col": "date_added",
|
|
251
|
-
"expr": "gte",
|
|
252
|
-
"val": "2024-01-01"
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Send Email to Segment
|
|
260
|
-
```javascript
|
|
261
|
-
// Segment Email operation
|
|
262
|
-
{
|
|
263
|
-
"segmentId": "123",
|
|
264
|
-
"emailId": "456",
|
|
265
|
-
"options": {
|
|
266
|
-
"sendToNewOnly": true
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
## Development
|
|
272
|
-
|
|
273
|
-
### Prerequisites
|
|
274
|
-
- Node.js 16+
|
|
275
|
-
- npm or yarn
|
|
276
|
-
- n8n development environment
|
|
277
|
-
|
|
278
|
-
### Commands
|
|
279
|
-
```bash
|
|
280
|
-
# Install dependencies
|
|
281
|
-
npm install
|
|
282
|
-
|
|
283
|
-
# Build the node
|
|
284
|
-
npm run build
|
|
285
|
-
|
|
286
|
-
# Watch for changes (development)
|
|
287
|
-
npm run dev
|
|
288
|
-
|
|
289
|
-
# Check for linting errors
|
|
290
|
-
npm run lint
|
|
291
|
-
|
|
292
|
-
# Fix linting errors
|
|
293
|
-
npm run lint:fix
|
|
294
|
-
|
|
295
|
-
# Format code
|
|
296
|
-
npm run format
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### Project Structure
|
|
300
|
-
```
|
|
301
|
-
├── credentials/ # Authentication credentials
|
|
302
|
-
├── nodes/ # Node implementations
|
|
303
|
-
│ └── MauticAdvanced/ # Main node files
|
|
304
|
-
├── dist/ # Compiled output
|
|
305
|
-
├── package.json # Project configuration
|
|
306
|
-
└── README.md # This file
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
## Troubleshooting
|
|
310
|
-
|
|
311
|
-
### Common Issues
|
|
312
|
-
|
|
313
|
-
#### "Could not get parameter 'options'" Error
|
|
314
|
-
**Cause**: Missing Options parameter in node definition
|
|
315
|
-
**Solution**: Update to latest version (0.3.2+) which includes all required Options parameters
|
|
316
|
-
|
|
317
|
-
#### Authentication Errors
|
|
318
|
-
**Cause**: Incorrect credentials or URL
|
|
319
|
-
**Solution**:
|
|
320
|
-
- Verify Mautic URL format (https://your-mautic.com)
|
|
321
|
-
- Check API credentials are active
|
|
322
|
-
- Ensure proper permissions for API access
|
|
323
|
-
|
|
324
|
-
#### Date Filter Issues
|
|
325
|
-
**Cause**: Incorrect date format
|
|
326
|
-
**Solution**: Use YYYY-MM-DD format for date filters
|
|
327
|
-
|
|
328
|
-
#### Pagination Problems
|
|
329
|
-
**Cause**: Large datasets causing timeouts
|
|
330
|
-
**Solution**: Use "Return All" option or set appropriate limits
|
|
331
|
-
|
|
332
|
-
### Getting Help
|
|
333
|
-
1. Check the [Changelog](CHANGELOG.md) for recent fixes
|
|
334
|
-
2. Search existing [Issues](https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced/issues)
|
|
335
|
-
3. Create a new issue with detailed information
|
|
336
|
-
|
|
337
|
-
## Support
|
|
338
|
-
|
|
339
|
-
If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
|
|
340
|
-
|
|
341
|
-
[](https://buymeacoffee.com/msoukhomlinov)
|
|
342
|
-
|
|
343
|
-
Your support helps maintain this project and develop new features.
|
|
344
|
-
|
|
345
|
-
## License
|
|
346
|
-
|
|
347
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
348
|
-
|
|
349
|
-
## Credits
|
|
350
|
-
|
|
351
|
-
- Built with [n8n](https://n8n.io/) workflow automation platform
|
|
352
|
-
- Uses [change-case](https://github.com/blakeembrey/change-case) for string manipulation
|
|
353
|
-
- Icons and design inspired by n8n community standards
|
|
1
|
+
# n8n Mautic Advanced Node
|
|
2
|
+
|
|
3
|
+
[](https://buymeacoffee.com/msoukhomlinov)
|
|
4
|
+
|
|
5
|
+
Enhanced n8n node for Mautic with comprehensive API coverage including tags, campaigns, categories, notifications, 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)
|
|
21
|
+
|
|
22
|
+
## What Makes This "Advanced"?
|
|
23
|
+
|
|
24
|
+
This enhanced version extends the standard n8n Mautic node with:
|
|
25
|
+
|
|
26
|
+
- **🏷️ Complete Tag Management**: Full CRUD operations for tags (missing in the standard node)
|
|
27
|
+
- **📊 Campaign Operations**: Create, clone, update, and manage campaigns
|
|
28
|
+
- **📁 Category Management**: Handle categories with bundle and color support
|
|
29
|
+
- **🔔 Notification Management**: Full CRUD operations for notifications with scheduling and language support
|
|
30
|
+
- **🔗 Advanced Relationship Management**: Sophisticated contact-to-campaign and contact-to-company associations
|
|
31
|
+
- **📧 Enhanced Email Operations**: Segment-based email sending capabilities
|
|
32
|
+
- **👥 Extended Contact Operations**: UTM tag management, activity tracking, device information, and notes
|
|
33
|
+
- **🏢 Complete Company Management**: Full company lifecycle with custom fields and address support
|
|
34
|
+
- **🔍 Advanced Filtering**: Where filters, DNC filtering, and field selection
|
|
35
|
+
- **📅 Smart Date Handling**: Automatic date formatting for Mautic API compatibility
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
### 🚀 Core Features
|
|
40
|
+
- **Comprehensive API Coverage**: All major Mautic API endpoints supported
|
|
41
|
+
- **Advanced Filtering**: Where filters with nested conditions (andX/orX)
|
|
42
|
+
- **DNC Management**: Filter contacts by Do Not Contact status
|
|
43
|
+
- **Field Selection**: Choose which fields to return for Contact operations
|
|
44
|
+
- **Pagination Support**: Automatic handling of large datasets
|
|
45
|
+
- **Custom Fields**: Full support for custom field management
|
|
46
|
+
- **Error Handling**: Robust error handling and validation
|
|
47
|
+
|
|
48
|
+
### 🔐 Authentication
|
|
49
|
+
- **API Credentials**: Simple API key authentication
|
|
50
|
+
- **OAuth2**: Full OAuth2 flow support for secure authentication
|
|
51
|
+
|
|
52
|
+
### 📊 Data Management
|
|
53
|
+
- **RAW Data Options**: Control data output format
|
|
54
|
+
- **System Fields**: Built-in support for system fields
|
|
55
|
+
- **Date Formatting**: Automatic UTC date formatting
|
|
56
|
+
- **Deduplication**: Prevents duplicate records in paginated results
|
|
57
|
+
|
|
58
|
+
## Supported Resources and Operations
|
|
59
|
+
|
|
60
|
+
### 🏢 Companies
|
|
61
|
+
- **Create** a new company with full address and custom field support
|
|
62
|
+
- **Get** a company by ID
|
|
63
|
+
- **Get Many** companies with filtering and pagination
|
|
64
|
+
- **Update** company details
|
|
65
|
+
- **Delete** a company
|
|
66
|
+
|
|
67
|
+
### 👥 Contacts (Enhanced)
|
|
68
|
+
- **Create** a new contact with extensive field options
|
|
69
|
+
- **Get** a contact by ID with field selection
|
|
70
|
+
- **Get Many** contacts with advanced filtering and DNC options
|
|
71
|
+
- **Update** contact details
|
|
72
|
+
- **Delete** a contact
|
|
73
|
+
- **Delete Batch** multiple contacts in one operation
|
|
74
|
+
- **Send Email** to a contact
|
|
75
|
+
- **Edit Contact Points** (add/subtract points)
|
|
76
|
+
- **Edit Do Not Contact List** (add/remove from DNC)
|
|
77
|
+
- **Add/Remove UTM Tags** for tracking
|
|
78
|
+
- **Get Notes** associated with a contact
|
|
79
|
+
- **Get Activity** history for a contact
|
|
80
|
+
- **Get Companies** associated with a contact
|
|
81
|
+
- **Get Devices** used by a contact
|
|
82
|
+
|
|
83
|
+
### 🏷️ Tags
|
|
84
|
+
- **Create** a new tag with description
|
|
85
|
+
- **Get** a tag by ID
|
|
86
|
+
- **Get Many** tags with search capabilities
|
|
87
|
+
- **Update** tag name and description
|
|
88
|
+
- **Delete** a tag
|
|
89
|
+
|
|
90
|
+
### 📊 Campaigns
|
|
91
|
+
- **Create** a new campaign
|
|
92
|
+
- **Get** a campaign by ID
|
|
93
|
+
- **Get All** campaigns
|
|
94
|
+
- **Update** campaign details
|
|
95
|
+
- **Delete** a campaign
|
|
96
|
+
- **Clone** an existing campaign
|
|
97
|
+
- **Get Contacts** in a campaign
|
|
98
|
+
|
|
99
|
+
### 📁 Categories
|
|
100
|
+
- **Create** a new category with bundle and color settings
|
|
101
|
+
- **Get** a category by ID
|
|
102
|
+
- **Get Many** categories
|
|
103
|
+
- **Update** category details
|
|
104
|
+
- **Delete** a category
|
|
105
|
+
|
|
106
|
+
### 🔔 Notifications
|
|
107
|
+
- **Create** a new notification with scheduling and language support
|
|
108
|
+
- **Get** a notification by ID
|
|
109
|
+
- **Get Many** notifications with filtering
|
|
110
|
+
- **Update** notification details
|
|
111
|
+
- **Delete** a notification
|
|
112
|
+
|
|
113
|
+
### 📋 Segments
|
|
114
|
+
- **Create** a new segment
|
|
115
|
+
- **Get** a segment by ID
|
|
116
|
+
- **Get Many** segments with filtering
|
|
117
|
+
- **Update** segment details
|
|
118
|
+
- **Delete** a segment
|
|
119
|
+
|
|
120
|
+
### 🔗 Relationship Management
|
|
121
|
+
- **Campaign Contact**: Add/remove contacts to/from campaigns
|
|
122
|
+
- **Company Contact**: Add/remove contacts to/from companies
|
|
123
|
+
- **Contact Segment**: Add/remove contacts to/from segments
|
|
124
|
+
|
|
125
|
+
### 📧 Email Operations
|
|
126
|
+
- **Segment Email**: Send emails to segments
|
|
127
|
+
|
|
128
|
+
### 👤 Users
|
|
129
|
+
- **Create** a new Mautic user (administrator) with role, password, and profile fields
|
|
130
|
+
- **Get** a user by ID
|
|
131
|
+
- **Get Many** users with basic filtering and pagination
|
|
132
|
+
- **Update** user details including role, profile fields, and password
|
|
133
|
+
- **Delete** a user
|
|
134
|
+
|
|
135
|
+
### 🔐 Roles
|
|
136
|
+
- **Create** a new role with name, description, and permissions
|
|
137
|
+
- **Get** a role by ID
|
|
138
|
+
- **Get Many** roles with filtering and pagination
|
|
139
|
+
- **Update** role details including permissions
|
|
140
|
+
- **Delete** a role
|
|
141
|
+
|
|
142
|
+
### 📈 Stats
|
|
143
|
+
- **Get Available Tables** to list all statistical tables and their columns
|
|
144
|
+
- **Get Stats** from a specific table with filtering, ordering, and pagination
|
|
145
|
+
|
|
146
|
+
## Installation
|
|
147
|
+
|
|
148
|
+
### Method 1: npm (Recommended)
|
|
149
|
+
```bash
|
|
150
|
+
npm install n8n-nodes-mautic-advanced
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Method 2: Manual Installation
|
|
154
|
+
1. Clone this repository:
|
|
155
|
+
```bash
|
|
156
|
+
git clone https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced.git
|
|
157
|
+
cd n8n-nodes-mautic-advanced
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
2. Install dependencies:
|
|
161
|
+
```bash
|
|
162
|
+
npm install
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
3. Build the node:
|
|
166
|
+
```bash
|
|
167
|
+
npm run build
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
4. Link to your n8n installation:
|
|
171
|
+
```bash
|
|
172
|
+
npm link
|
|
173
|
+
cd /path/to/your/n8n/installation
|
|
174
|
+
npm link n8n-nodes-mautic-advanced
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Authentication
|
|
178
|
+
|
|
179
|
+
### API Credentials
|
|
180
|
+
1. Go to your Mautic instance
|
|
181
|
+
2. Navigate to **Settings** → **API Credentials**
|
|
182
|
+
3. Create a new API credential
|
|
183
|
+
4. Copy the **Public Key** and **Secret Key**
|
|
184
|
+
5. In n8n, add a new Mautic Advanced credential
|
|
185
|
+
6. Select **Credentials** authentication method
|
|
186
|
+
7. Enter your Mautic URL, Public Key, and Secret Key
|
|
187
|
+
|
|
188
|
+
### OAuth2
|
|
189
|
+
1. In n8n, add a new Mautic Advanced credential
|
|
190
|
+
2. Select **OAuth2** authentication method
|
|
191
|
+
3. Enter your Mautic URL
|
|
192
|
+
4. Follow the OAuth2 authorization flow
|
|
193
|
+
|
|
194
|
+
## Advanced Features
|
|
195
|
+
|
|
196
|
+
### Where Filters
|
|
197
|
+
Advanced filtering for Contact > Get Many operations:
|
|
198
|
+
- **Nested Conditions**: Support for andX/orX logical operators
|
|
199
|
+
- **Multiple Expressions**: eq, neq, lt, lte, gt, gte, between, in, isNull, isNotNull
|
|
200
|
+
- **Custom Fields**: Filter by any custom or system field
|
|
201
|
+
- **Date Filtering**: Automatic date formatting for Mautic API
|
|
202
|
+
|
|
203
|
+
### DNC Filtering
|
|
204
|
+
Filter contacts by Do Not Contact status:
|
|
205
|
+
- **Email DNC Only**: Contacts with email DNC enabled
|
|
206
|
+
- **SMS DNC Only**: Contacts with SMS DNC enabled
|
|
207
|
+
- **Any DNC Only**: Contacts with any DNC enabled
|
|
208
|
+
|
|
209
|
+
### Field Selection
|
|
210
|
+
Choose which fields to return for Contact operations:
|
|
211
|
+
- **System Fields**: date_added, date_modified, id, owner_id
|
|
212
|
+
- **Custom Fields**: Any custom field defined in Mautic
|
|
213
|
+
- **All Fields**: Return complete contact data
|
|
214
|
+
|
|
215
|
+
### Date Formatting
|
|
216
|
+
Automatic date formatting for known date fields:
|
|
217
|
+
- **Format**: YYYY-MM-DD HH:mm:ss UTC
|
|
218
|
+
- **Compatibility**: Ensures Mautic API compatibility
|
|
219
|
+
- **Fields**: date_added, date_modified, lastActive, etc.
|
|
220
|
+
|
|
221
|
+
## Usage Examples
|
|
222
|
+
|
|
223
|
+
### Create a Contact with Tags
|
|
224
|
+
```javascript
|
|
225
|
+
// Contact Create operation
|
|
226
|
+
{
|
|
227
|
+
"email": "john.doe@example.com",
|
|
228
|
+
"firstName": "John",
|
|
229
|
+
"lastName": "Doe",
|
|
230
|
+
"additionalFields": {
|
|
231
|
+
"tags": ["customer", "vip"],
|
|
232
|
+
"company": "Example Corp",
|
|
233
|
+
"phone": "+1234567890"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Filter Contacts with Where Conditions
|
|
239
|
+
```javascript
|
|
240
|
+
// Contact Get Many with Where filter
|
|
241
|
+
{
|
|
242
|
+
"where": {
|
|
243
|
+
"conditions": [
|
|
244
|
+
{
|
|
245
|
+
"col": "email",
|
|
246
|
+
"expr": "neq",
|
|
247
|
+
"val": ""
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"col": "date_added",
|
|
251
|
+
"expr": "gte",
|
|
252
|
+
"val": "2024-01-01"
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Send Email to Segment
|
|
260
|
+
```javascript
|
|
261
|
+
// Segment Email operation
|
|
262
|
+
{
|
|
263
|
+
"segmentId": "123",
|
|
264
|
+
"emailId": "456",
|
|
265
|
+
"options": {
|
|
266
|
+
"sendToNewOnly": true
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Development
|
|
272
|
+
|
|
273
|
+
### Prerequisites
|
|
274
|
+
- Node.js 16+
|
|
275
|
+
- npm or yarn
|
|
276
|
+
- n8n development environment
|
|
277
|
+
|
|
278
|
+
### Commands
|
|
279
|
+
```bash
|
|
280
|
+
# Install dependencies
|
|
281
|
+
npm install
|
|
282
|
+
|
|
283
|
+
# Build the node
|
|
284
|
+
npm run build
|
|
285
|
+
|
|
286
|
+
# Watch for changes (development)
|
|
287
|
+
npm run dev
|
|
288
|
+
|
|
289
|
+
# Check for linting errors
|
|
290
|
+
npm run lint
|
|
291
|
+
|
|
292
|
+
# Fix linting errors
|
|
293
|
+
npm run lint:fix
|
|
294
|
+
|
|
295
|
+
# Format code
|
|
296
|
+
npm run format
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Project Structure
|
|
300
|
+
```
|
|
301
|
+
├── credentials/ # Authentication credentials
|
|
302
|
+
├── nodes/ # Node implementations
|
|
303
|
+
│ └── MauticAdvanced/ # Main node files
|
|
304
|
+
├── dist/ # Compiled output
|
|
305
|
+
├── package.json # Project configuration
|
|
306
|
+
└── README.md # This file
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Troubleshooting
|
|
310
|
+
|
|
311
|
+
### Common Issues
|
|
312
|
+
|
|
313
|
+
#### "Could not get parameter 'options'" Error
|
|
314
|
+
**Cause**: Missing Options parameter in node definition
|
|
315
|
+
**Solution**: Update to latest version (0.3.2+) which includes all required Options parameters
|
|
316
|
+
|
|
317
|
+
#### Authentication Errors
|
|
318
|
+
**Cause**: Incorrect credentials or URL
|
|
319
|
+
**Solution**:
|
|
320
|
+
- Verify Mautic URL format (https://your-mautic.com)
|
|
321
|
+
- Check API credentials are active
|
|
322
|
+
- Ensure proper permissions for API access
|
|
323
|
+
|
|
324
|
+
#### Date Filter Issues
|
|
325
|
+
**Cause**: Incorrect date format
|
|
326
|
+
**Solution**: Use YYYY-MM-DD format for date filters
|
|
327
|
+
|
|
328
|
+
#### Pagination Problems
|
|
329
|
+
**Cause**: Large datasets causing timeouts
|
|
330
|
+
**Solution**: Use "Return All" option or set appropriate limits
|
|
331
|
+
|
|
332
|
+
### Getting Help
|
|
333
|
+
1. Check the [Changelog](CHANGELOG.md) for recent fixes
|
|
334
|
+
2. Search existing [Issues](https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced/issues)
|
|
335
|
+
3. Create a new issue with detailed information
|
|
336
|
+
|
|
337
|
+
## Support
|
|
338
|
+
|
|
339
|
+
If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
|
|
340
|
+
|
|
341
|
+
[](https://buymeacoffee.com/msoukhomlinov)
|
|
342
|
+
|
|
343
|
+
Your support helps maintain this project and develop new features.
|
|
344
|
+
|
|
345
|
+
## License
|
|
346
|
+
|
|
347
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
348
|
+
|
|
349
|
+
## Credits
|
|
350
|
+
|
|
351
|
+
- Built with [n8n](https://n8n.io/) workflow automation platform
|
|
352
|
+
- Uses [change-case](https://github.com/blakeembrey/change-case) for string manipulation
|
|
353
|
+
- Icons and design inspired by n8n community standards
|
|
@@ -1452,6 +1452,36 @@ exports.contactFields = [
|
|
|
1452
1452
|
},
|
|
1453
1453
|
},
|
|
1454
1454
|
options: [
|
|
1455
|
+
{
|
|
1456
|
+
displayName: 'Any Do Not Contact Only',
|
|
1457
|
+
name: 'anyDncOnly',
|
|
1458
|
+
type: 'boolean',
|
|
1459
|
+
default: false,
|
|
1460
|
+
description: 'Return only contacts with any Do Not Contact enabled',
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
displayName: 'Campaign(s)',
|
|
1464
|
+
name: 'campaigns',
|
|
1465
|
+
type: 'multiOptions',
|
|
1466
|
+
typeOptions: {
|
|
1467
|
+
loadOptionsMethod: 'getCampaigns',
|
|
1468
|
+
},
|
|
1469
|
+
displayOptions: {
|
|
1470
|
+
show: {
|
|
1471
|
+
'/resource': ['contact'],
|
|
1472
|
+
'/operation': ['getAll'],
|
|
1473
|
+
},
|
|
1474
|
+
},
|
|
1475
|
+
default: [],
|
|
1476
|
+
description: 'Filter contacts by membership in one or more campaigns. Uses Mautic search syntax (campaign:id) under the hood.',
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
displayName: 'Email Do Not Contact Only',
|
|
1480
|
+
name: 'emailDncOnly',
|
|
1481
|
+
type: 'boolean',
|
|
1482
|
+
default: false,
|
|
1483
|
+
description: 'Return only contacts with Email Do Not Contact enabled',
|
|
1484
|
+
},
|
|
1455
1485
|
{
|
|
1456
1486
|
displayName: 'Fields to Return',
|
|
1457
1487
|
name: 'fieldsToReturn',
|
|
@@ -1463,17 +1493,17 @@ exports.contactFields = [
|
|
|
1463
1493
|
description: 'Select which fields to include in the output. Leave empty to return all fields.',
|
|
1464
1494
|
},
|
|
1465
1495
|
{
|
|
1466
|
-
displayName: '
|
|
1467
|
-
name: '
|
|
1468
|
-
type: '
|
|
1496
|
+
displayName: 'Minimal',
|
|
1497
|
+
name: 'minimal',
|
|
1498
|
+
type: 'boolean',
|
|
1469
1499
|
displayOptions: {
|
|
1470
1500
|
show: {
|
|
1471
1501
|
'/resource': ['contact'],
|
|
1472
1502
|
'/operation': ['getAll'],
|
|
1473
1503
|
},
|
|
1474
1504
|
},
|
|
1475
|
-
default:
|
|
1476
|
-
description: '
|
|
1505
|
+
default: false,
|
|
1506
|
+
description: 'Whether to return array of entities without additional lists in it',
|
|
1477
1507
|
},
|
|
1478
1508
|
{
|
|
1479
1509
|
displayName: 'Order By',
|
|
@@ -1511,6 +1541,22 @@ exports.contactFields = [
|
|
|
1511
1541
|
],
|
|
1512
1542
|
description: 'Sort direction: ASC or DESC',
|
|
1513
1543
|
},
|
|
1544
|
+
{
|
|
1545
|
+
displayName: 'Owner(s)',
|
|
1546
|
+
name: 'owners',
|
|
1547
|
+
type: 'multiOptions',
|
|
1548
|
+
typeOptions: {
|
|
1549
|
+
loadOptionsMethod: 'getOwners',
|
|
1550
|
+
},
|
|
1551
|
+
displayOptions: {
|
|
1552
|
+
show: {
|
|
1553
|
+
'/resource': ['contact'],
|
|
1554
|
+
'/operation': ['getAll'],
|
|
1555
|
+
},
|
|
1556
|
+
},
|
|
1557
|
+
default: [],
|
|
1558
|
+
description: 'Filter contacts by owner (assigned user). Uses Mautic search syntax (owner:id) under the hood.',
|
|
1559
|
+
},
|
|
1514
1560
|
{
|
|
1515
1561
|
displayName: 'Published Only',
|
|
1516
1562
|
name: 'publishedOnly',
|
|
@@ -1525,17 +1571,125 @@ exports.contactFields = [
|
|
|
1525
1571
|
description: 'Whether to return currently published entities',
|
|
1526
1572
|
},
|
|
1527
1573
|
{
|
|
1528
|
-
displayName: '
|
|
1529
|
-
name: '
|
|
1574
|
+
displayName: 'RAW Data',
|
|
1575
|
+
name: 'rawData',
|
|
1530
1576
|
type: 'boolean',
|
|
1577
|
+
default: true,
|
|
1578
|
+
description: 'By default only the data of the fields get returned. If this option gets set the RAW response with all data gets returned.',
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
displayName: 'Search',
|
|
1582
|
+
name: 'search',
|
|
1583
|
+
type: 'string',
|
|
1531
1584
|
displayOptions: {
|
|
1532
1585
|
show: {
|
|
1533
1586
|
'/resource': ['contact'],
|
|
1534
1587
|
'/operation': ['getAll'],
|
|
1535
1588
|
},
|
|
1536
1589
|
},
|
|
1590
|
+
default: '',
|
|
1591
|
+
description: 'String or search command to filter entities by',
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
displayName: 'Segment Match Type',
|
|
1595
|
+
name: 'segmentMatchType',
|
|
1596
|
+
type: 'options',
|
|
1597
|
+
options: [
|
|
1598
|
+
{
|
|
1599
|
+
name: 'Any Selected Segment',
|
|
1600
|
+
value: 'any',
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
name: 'All Selected Segments',
|
|
1604
|
+
value: 'all',
|
|
1605
|
+
},
|
|
1606
|
+
],
|
|
1607
|
+
displayOptions: {
|
|
1608
|
+
show: {
|
|
1609
|
+
'/resource': ['contact'],
|
|
1610
|
+
'/operation': ['getAll'],
|
|
1611
|
+
},
|
|
1612
|
+
},
|
|
1613
|
+
default: 'any',
|
|
1614
|
+
description: 'When multiple segments are selected, choose whether to return contacts in any selected segment or only those that are in all selected segments.',
|
|
1615
|
+
},
|
|
1616
|
+
{
|
|
1617
|
+
displayName: 'Segment(s)',
|
|
1618
|
+
name: 'segments',
|
|
1619
|
+
type: 'multiOptions',
|
|
1620
|
+
typeOptions: {
|
|
1621
|
+
loadOptionsMethod: 'getSegmentAliases',
|
|
1622
|
+
},
|
|
1623
|
+
displayOptions: {
|
|
1624
|
+
show: {
|
|
1625
|
+
'/resource': ['contact'],
|
|
1626
|
+
'/operation': ['getAll'],
|
|
1627
|
+
},
|
|
1628
|
+
},
|
|
1629
|
+
default: [],
|
|
1630
|
+
description: 'Filter contacts by membership in one or more segments. Uses Mautic search syntax (segment:alias) under the hood.',
|
|
1631
|
+
},
|
|
1632
|
+
{
|
|
1633
|
+
displayName: 'SMS Do Not Contact Only',
|
|
1634
|
+
name: 'smsDncOnly',
|
|
1635
|
+
type: 'boolean',
|
|
1537
1636
|
default: false,
|
|
1538
|
-
description: '
|
|
1637
|
+
description: 'Return only contacts with SMS Do Not Contact enabled',
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
displayName: 'Stage(s)',
|
|
1641
|
+
name: 'stages',
|
|
1642
|
+
type: 'multiOptions',
|
|
1643
|
+
typeOptions: {
|
|
1644
|
+
loadOptionsMethod: 'getStages',
|
|
1645
|
+
},
|
|
1646
|
+
displayOptions: {
|
|
1647
|
+
show: {
|
|
1648
|
+
'/resource': ['contact'],
|
|
1649
|
+
'/operation': ['getAll'],
|
|
1650
|
+
},
|
|
1651
|
+
},
|
|
1652
|
+
default: [],
|
|
1653
|
+
description: 'Filter contacts by one or more stages. Uses Mautic search syntax (stage:id) under the hood.',
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
displayName: 'Tag Match Type',
|
|
1657
|
+
name: 'tagMatchType',
|
|
1658
|
+
type: 'options',
|
|
1659
|
+
options: [
|
|
1660
|
+
{
|
|
1661
|
+
name: 'Any Selected Tag',
|
|
1662
|
+
value: 'any',
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
name: 'All Selected Tags',
|
|
1666
|
+
value: 'all',
|
|
1667
|
+
},
|
|
1668
|
+
],
|
|
1669
|
+
displayOptions: {
|
|
1670
|
+
show: {
|
|
1671
|
+
'/resource': ['contact'],
|
|
1672
|
+
'/operation': ['getAll'],
|
|
1673
|
+
},
|
|
1674
|
+
},
|
|
1675
|
+
default: 'any',
|
|
1676
|
+
description: 'When multiple tags are selected, choose whether to return contacts with any selected tag or only those with all selected tags.',
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
displayName: 'Tag(s)',
|
|
1680
|
+
name: 'tags',
|
|
1681
|
+
type: 'multiOptions',
|
|
1682
|
+
typeOptions: {
|
|
1683
|
+
loadOptionsMethod: 'getTags',
|
|
1684
|
+
},
|
|
1685
|
+
displayOptions: {
|
|
1686
|
+
show: {
|
|
1687
|
+
'/resource': ['contact'],
|
|
1688
|
+
'/operation': ['getAll'],
|
|
1689
|
+
},
|
|
1690
|
+
},
|
|
1691
|
+
default: [],
|
|
1692
|
+
description: 'Filter contacts by one or more tags. Uses Mautic search syntax (tag:name) under the hood.',
|
|
1539
1693
|
},
|
|
1540
1694
|
{
|
|
1541
1695
|
displayName: 'Where',
|
|
@@ -1664,34 +1818,6 @@ exports.contactFields = [
|
|
|
1664
1818
|
},
|
|
1665
1819
|
],
|
|
1666
1820
|
},
|
|
1667
|
-
{
|
|
1668
|
-
displayName: 'Email Do Not Contact Only',
|
|
1669
|
-
name: 'emailDncOnly',
|
|
1670
|
-
type: 'boolean',
|
|
1671
|
-
default: false,
|
|
1672
|
-
description: 'Return only contacts with Email Do Not Contact enabled',
|
|
1673
|
-
},
|
|
1674
|
-
{
|
|
1675
|
-
displayName: 'SMS Do Not Contact Only',
|
|
1676
|
-
name: 'smsDncOnly',
|
|
1677
|
-
type: 'boolean',
|
|
1678
|
-
default: false,
|
|
1679
|
-
description: 'Return only contacts with SMS Do Not Contact enabled',
|
|
1680
|
-
},
|
|
1681
|
-
{
|
|
1682
|
-
displayName: 'Any Do Not Contact Only',
|
|
1683
|
-
name: 'anyDncOnly',
|
|
1684
|
-
type: 'boolean',
|
|
1685
|
-
default: false,
|
|
1686
|
-
description: 'Return only contacts with any Do Not Contact enabled',
|
|
1687
|
-
},
|
|
1688
|
-
{
|
|
1689
|
-
displayName: 'RAW Data',
|
|
1690
|
-
name: 'rawData',
|
|
1691
|
-
type: 'boolean',
|
|
1692
|
-
default: true,
|
|
1693
|
-
description: 'By default only the data of the fields get returned. If this option gets set the RAW response with all data gets returned.',
|
|
1694
|
-
},
|
|
1695
1821
|
],
|
|
1696
1822
|
},
|
|
1697
1823
|
/* -------------------------------------------------------------------------- */
|
|
@@ -37,7 +37,7 @@ class MauticAdvanced {
|
|
|
37
37
|
this.description = {
|
|
38
38
|
displayName: 'Mautic Advanced',
|
|
39
39
|
name: 'mauticAdvanced',
|
|
40
|
-
icon: 'file:
|
|
40
|
+
icon: 'file:mauticadvanced.svg',
|
|
41
41
|
group: ['output'],
|
|
42
42
|
version: 1,
|
|
43
43
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
@@ -297,7 +297,7 @@ class MauticAdvanced {
|
|
|
297
297
|
// select them easily
|
|
298
298
|
async getSegments() {
|
|
299
299
|
const returnData = [];
|
|
300
|
-
const segments = await GenericFunctions_1.mauticApiRequestAllItems.call(this, '
|
|
300
|
+
const segments = await GenericFunctions_1.mauticApiRequestAllItems.call(this, 'lists', 'GET', '/segments');
|
|
301
301
|
for (const segment of segments) {
|
|
302
302
|
returnData.push({
|
|
303
303
|
name: segment.name,
|
|
@@ -306,6 +306,37 @@ class MauticAdvanced {
|
|
|
306
306
|
}
|
|
307
307
|
return returnData;
|
|
308
308
|
},
|
|
309
|
+
// Get all the available segments (by alias) for search filtering
|
|
310
|
+
async getSegmentAliases() {
|
|
311
|
+
const returnData = [];
|
|
312
|
+
const segments = await GenericFunctions_1.mauticApiRequestAllItems.call(this, 'lists', 'GET', '/segments');
|
|
313
|
+
for (const segment of segments) {
|
|
314
|
+
// Use alias if available, otherwise skip (alias is required for search syntax)
|
|
315
|
+
const alias = segment.alias || segment.id?.toString();
|
|
316
|
+
if (alias) {
|
|
317
|
+
returnData.push({
|
|
318
|
+
name: segment.name || alias,
|
|
319
|
+
value: alias,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return returnData;
|
|
324
|
+
},
|
|
325
|
+
// Get all the available owners (users) for filtering
|
|
326
|
+
async getOwners() {
|
|
327
|
+
const returnData = [];
|
|
328
|
+
const response = await GenericFunctions_1.mauticApiRequest.call(this, 'GET', '/contacts/list/owners');
|
|
329
|
+
const owners = response || [];
|
|
330
|
+
for (const owner of owners) {
|
|
331
|
+
returnData.push({
|
|
332
|
+
name: `${owner.firstName || ''} ${owner.lastName || ''}`.trim() ||
|
|
333
|
+
owner.username ||
|
|
334
|
+
`User ${owner.id}`,
|
|
335
|
+
value: owner.id,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
return returnData;
|
|
339
|
+
},
|
|
309
340
|
// Get all the available campaings to display them to user so that they can
|
|
310
341
|
// select them easily
|
|
311
342
|
async getCampaigns() {
|
|
@@ -8,7 +8,7 @@ class MauticAdvancedTrigger {
|
|
|
8
8
|
this.description = {
|
|
9
9
|
displayName: 'Mautic Advanced Trigger',
|
|
10
10
|
name: 'mauticAdvancedTrigger',
|
|
11
|
-
icon: 'file:
|
|
11
|
+
icon: 'file:mauticadvanced.svg',
|
|
12
12
|
group: ['trigger'],
|
|
13
13
|
version: 1,
|
|
14
14
|
description: 'Handle Mautic events via webhooks',
|
|
@@ -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
|
-
/>
|
|
10
|
-
</svg
|
|
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
|
+
</svg>
|
|
@@ -165,6 +165,59 @@ async function getAllContacts(context, itemIndex) {
|
|
|
165
165
|
const returnAll = (0, ApiHelpers_1.getOptionalParam)(context, 'returnAll', itemIndex, false);
|
|
166
166
|
const options = (0, ApiHelpers_1.getOptionalParam)(context, 'options', itemIndex, {});
|
|
167
167
|
const qs = (0, DataHelpers_1.buildQueryFromOptions)(options);
|
|
168
|
+
// Build search expression from structured filters
|
|
169
|
+
const searchParts = [];
|
|
170
|
+
// Segment filter
|
|
171
|
+
const segments = options.segments;
|
|
172
|
+
if (Array.isArray(segments) && segments.length > 0) {
|
|
173
|
+
const segmentMatchType = options.segmentMatchType || 'any';
|
|
174
|
+
const filterExpr = buildSearchFilterExpression(segments, 'segment', segmentMatchType);
|
|
175
|
+
if (filterExpr)
|
|
176
|
+
searchParts.push(filterExpr);
|
|
177
|
+
}
|
|
178
|
+
// Tag filter
|
|
179
|
+
const tags = options.tags;
|
|
180
|
+
if (Array.isArray(tags) && tags.length > 0) {
|
|
181
|
+
const tagMatchType = options.tagMatchType || 'any';
|
|
182
|
+
const filterExpr = buildSearchFilterExpression(tags, 'tag', tagMatchType);
|
|
183
|
+
if (filterExpr)
|
|
184
|
+
searchParts.push(filterExpr);
|
|
185
|
+
}
|
|
186
|
+
// Owner filter (always OR for multiple owners - a contact can only have one owner)
|
|
187
|
+
const owners = options.owners;
|
|
188
|
+
if (Array.isArray(owners) && owners.length > 0) {
|
|
189
|
+
const filterExpr = buildSearchFilterExpression(owners, 'owner', 'any');
|
|
190
|
+
if (filterExpr)
|
|
191
|
+
searchParts.push(filterExpr);
|
|
192
|
+
}
|
|
193
|
+
// Stage filter (always OR for multiple stages - a contact can only be in one stage)
|
|
194
|
+
const stages = options.stages;
|
|
195
|
+
if (Array.isArray(stages) && stages.length > 0) {
|
|
196
|
+
const filterExpr = buildSearchFilterExpression(stages, 'stage', 'any');
|
|
197
|
+
if (filterExpr)
|
|
198
|
+
searchParts.push(filterExpr);
|
|
199
|
+
}
|
|
200
|
+
// Campaign filter (OR for multiple campaigns)
|
|
201
|
+
const campaigns = options.campaigns;
|
|
202
|
+
if (Array.isArray(campaigns) && campaigns.length > 0) {
|
|
203
|
+
const filterExpr = buildSearchFilterExpression(campaigns, 'campaign', 'any');
|
|
204
|
+
if (filterExpr)
|
|
205
|
+
searchParts.push(filterExpr);
|
|
206
|
+
}
|
|
207
|
+
// Combine all structured filters with AND
|
|
208
|
+
if (searchParts.length > 0) {
|
|
209
|
+
const structuredSearch = searchParts.length === 1
|
|
210
|
+
? searchParts[0]
|
|
211
|
+
: searchParts.map((part) => `(${part})`).join(' AND ');
|
|
212
|
+
// Merge with raw search if provided
|
|
213
|
+
const rawSearch = options.search;
|
|
214
|
+
if (rawSearch && rawSearch.trim().length > 0) {
|
|
215
|
+
qs.search = `${structuredSearch} AND (${rawSearch})`;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
qs.search = structuredSearch;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
168
221
|
if (!qs.orderBy)
|
|
169
222
|
qs.orderBy = 'id';
|
|
170
223
|
if (!qs.orderByDir)
|
|
@@ -421,6 +474,26 @@ async function getAllContactActivity(context, itemIndex) {
|
|
|
421
474
|
const result = await (0, ApiHelpers_1.makePaginatedRequest)(context, 'events', 'GET', `/contacts/activity`, {}, qs);
|
|
422
475
|
return (0, DataHelpers_1.convertNumericStrings)(result);
|
|
423
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* Build a Mautic search filter expression from an array of values.
|
|
479
|
+
* @param values Array of filter values (IDs, aliases, or names)
|
|
480
|
+
* @param filterType The Mautic search filter type (e.g., 'segment', 'tag', 'owner', 'stage', 'campaign')
|
|
481
|
+
* @param matchType 'any' for OR logic, 'all' for AND logic
|
|
482
|
+
* @returns The search expression string, or empty string if no valid values
|
|
483
|
+
*/
|
|
484
|
+
function buildSearchFilterExpression(values, filterType, matchType) {
|
|
485
|
+
const filters = values
|
|
486
|
+
.map((value) => `${filterType}:${value}`)
|
|
487
|
+
.filter((expr) => expr.trim().length > 0);
|
|
488
|
+
if (filters.length === 0) {
|
|
489
|
+
return '';
|
|
490
|
+
}
|
|
491
|
+
if (filters.length === 1) {
|
|
492
|
+
return filters[0];
|
|
493
|
+
}
|
|
494
|
+
const operator = matchType === 'all' ? ' AND ' : ' OR ';
|
|
495
|
+
return filters.join(operator);
|
|
496
|
+
}
|
|
424
497
|
function normalizeTagsInput(tagsInput) {
|
|
425
498
|
// Handle different input formats for tags
|
|
426
499
|
// If it's already an array of strings, return as is
|
package/package.json
CHANGED