n8n-nodes-mautic-advanced 0.4.0 → 0.4.1
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 +335 -335
- package/dist/nodes/MauticAdvanced/CategoryDescription.js +147 -13
- package/dist/nodes/MauticAdvanced/ContactDescription.js +52 -0
- package/dist/nodes/MauticAdvanced/{MauticAdvanced.svg → mauticadvanced.svg} +9 -9
- package/dist/nodes/MauticAdvanced/operations/ContactOperations.js +27 -2
- package/dist/nodes/MauticAdvanced/operations/MiscellaneousOperations.js +11 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,335 +1,335 @@
|
|
|
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
|
-
## Installation
|
|
129
|
-
|
|
130
|
-
### Method 1: npm (Recommended)
|
|
131
|
-
```bash
|
|
132
|
-
npm install n8n-nodes-mautic-advanced
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Method 2: Manual Installation
|
|
136
|
-
1. Clone this repository:
|
|
137
|
-
```bash
|
|
138
|
-
git clone https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced.git
|
|
139
|
-
cd n8n-nodes-mautic-advanced
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
2. Install dependencies:
|
|
143
|
-
```bash
|
|
144
|
-
npm install
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
3. Build the node:
|
|
148
|
-
```bash
|
|
149
|
-
npm run build
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
4. Link to your n8n installation:
|
|
153
|
-
```bash
|
|
154
|
-
npm link
|
|
155
|
-
cd /path/to/your/n8n/installation
|
|
156
|
-
npm link n8n-nodes-mautic-advanced
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Authentication
|
|
160
|
-
|
|
161
|
-
### API Credentials
|
|
162
|
-
1. Go to your Mautic instance
|
|
163
|
-
2. Navigate to **Settings** → **API Credentials**
|
|
164
|
-
3. Create a new API credential
|
|
165
|
-
4. Copy the **Public Key** and **Secret Key**
|
|
166
|
-
5. In n8n, add a new Mautic Advanced credential
|
|
167
|
-
6. Select **Credentials** authentication method
|
|
168
|
-
7. Enter your Mautic URL, Public Key, and Secret Key
|
|
169
|
-
|
|
170
|
-
### OAuth2
|
|
171
|
-
1. In n8n, add a new Mautic Advanced credential
|
|
172
|
-
2. Select **OAuth2** authentication method
|
|
173
|
-
3. Enter your Mautic URL
|
|
174
|
-
4. Follow the OAuth2 authorization flow
|
|
175
|
-
|
|
176
|
-
## Advanced Features
|
|
177
|
-
|
|
178
|
-
### Where Filters
|
|
179
|
-
Advanced filtering for Contact > Get Many operations:
|
|
180
|
-
- **Nested Conditions**: Support for andX/orX logical operators
|
|
181
|
-
- **Multiple Expressions**: eq, neq, lt, lte, gt, gte, between, in, isNull, isNotNull
|
|
182
|
-
- **Custom Fields**: Filter by any custom or system field
|
|
183
|
-
- **Date Filtering**: Automatic date formatting for Mautic API
|
|
184
|
-
|
|
185
|
-
### DNC Filtering
|
|
186
|
-
Filter contacts by Do Not Contact status:
|
|
187
|
-
- **Email DNC Only**: Contacts with email DNC enabled
|
|
188
|
-
- **SMS DNC Only**: Contacts with SMS DNC enabled
|
|
189
|
-
- **Any DNC Only**: Contacts with any DNC enabled
|
|
190
|
-
|
|
191
|
-
### Field Selection
|
|
192
|
-
Choose which fields to return for Contact operations:
|
|
193
|
-
- **System Fields**: date_added, date_modified, id, owner_id
|
|
194
|
-
- **Custom Fields**: Any custom field defined in Mautic
|
|
195
|
-
- **All Fields**: Return complete contact data
|
|
196
|
-
|
|
197
|
-
### Date Formatting
|
|
198
|
-
Automatic date formatting for known date fields:
|
|
199
|
-
- **Format**: YYYY-MM-DD HH:mm:ss UTC
|
|
200
|
-
- **Compatibility**: Ensures Mautic API compatibility
|
|
201
|
-
- **Fields**: date_added, date_modified, lastActive, etc.
|
|
202
|
-
|
|
203
|
-
## Usage Examples
|
|
204
|
-
|
|
205
|
-
### Create a Contact with Tags
|
|
206
|
-
```javascript
|
|
207
|
-
// Contact Create operation
|
|
208
|
-
{
|
|
209
|
-
"email": "john.doe@example.com",
|
|
210
|
-
"firstName": "John",
|
|
211
|
-
"lastName": "Doe",
|
|
212
|
-
"additionalFields": {
|
|
213
|
-
"tags": ["customer", "vip"],
|
|
214
|
-
"company": "Example Corp",
|
|
215
|
-
"phone": "+1234567890"
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Filter Contacts with Where Conditions
|
|
221
|
-
```javascript
|
|
222
|
-
// Contact Get Many with Where filter
|
|
223
|
-
{
|
|
224
|
-
"where": {
|
|
225
|
-
"conditions": [
|
|
226
|
-
{
|
|
227
|
-
"col": "email",
|
|
228
|
-
"expr": "neq",
|
|
229
|
-
"val": ""
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
"col": "date_added",
|
|
233
|
-
"expr": "gte",
|
|
234
|
-
"val": "2024-01-01"
|
|
235
|
-
}
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### Send Email to Segment
|
|
242
|
-
```javascript
|
|
243
|
-
// Segment Email operation
|
|
244
|
-
{
|
|
245
|
-
"segmentId": "123",
|
|
246
|
-
"emailId": "456",
|
|
247
|
-
"options": {
|
|
248
|
-
"sendToNewOnly": true
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Development
|
|
254
|
-
|
|
255
|
-
### Prerequisites
|
|
256
|
-
- Node.js 16+
|
|
257
|
-
- npm or yarn
|
|
258
|
-
- n8n development environment
|
|
259
|
-
|
|
260
|
-
### Commands
|
|
261
|
-
```bash
|
|
262
|
-
# Install dependencies
|
|
263
|
-
npm install
|
|
264
|
-
|
|
265
|
-
# Build the node
|
|
266
|
-
npm run build
|
|
267
|
-
|
|
268
|
-
# Watch for changes (development)
|
|
269
|
-
npm run dev
|
|
270
|
-
|
|
271
|
-
# Check for linting errors
|
|
272
|
-
npm run lint
|
|
273
|
-
|
|
274
|
-
# Fix linting errors
|
|
275
|
-
npm run lint:fix
|
|
276
|
-
|
|
277
|
-
# Format code
|
|
278
|
-
npm run format
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
### Project Structure
|
|
282
|
-
```
|
|
283
|
-
├── credentials/ # Authentication credentials
|
|
284
|
-
├── nodes/ # Node implementations
|
|
285
|
-
│ └── MauticAdvanced/ # Main node files
|
|
286
|
-
├── dist/ # Compiled output
|
|
287
|
-
├── package.json # Project configuration
|
|
288
|
-
└── README.md # This file
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Troubleshooting
|
|
292
|
-
|
|
293
|
-
### Common Issues
|
|
294
|
-
|
|
295
|
-
#### "Could not get parameter 'options'" Error
|
|
296
|
-
**Cause**: Missing Options parameter in node definition
|
|
297
|
-
**Solution**: Update to latest version (0.3.2+) which includes all required Options parameters
|
|
298
|
-
|
|
299
|
-
#### Authentication Errors
|
|
300
|
-
**Cause**: Incorrect credentials or URL
|
|
301
|
-
**Solution**:
|
|
302
|
-
- Verify Mautic URL format (https://your-mautic.com)
|
|
303
|
-
- Check API credentials are active
|
|
304
|
-
- Ensure proper permissions for API access
|
|
305
|
-
|
|
306
|
-
#### Date Filter Issues
|
|
307
|
-
**Cause**: Incorrect date format
|
|
308
|
-
**Solution**: Use YYYY-MM-DD format for date filters
|
|
309
|
-
|
|
310
|
-
#### Pagination Problems
|
|
311
|
-
**Cause**: Large datasets causing timeouts
|
|
312
|
-
**Solution**: Use "Return All" option or set appropriate limits
|
|
313
|
-
|
|
314
|
-
### Getting Help
|
|
315
|
-
1. Check the [Changelog](CHANGELOG.md) for recent fixes
|
|
316
|
-
2. Search existing [Issues](https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced/issues)
|
|
317
|
-
3. Create a new issue with detailed information
|
|
318
|
-
|
|
319
|
-
## Support
|
|
320
|
-
|
|
321
|
-
If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
|
|
322
|
-
|
|
323
|
-
[](https://buymeacoffee.com/msoukhomlinov)
|
|
324
|
-
|
|
325
|
-
Your support helps maintain this project and develop new features.
|
|
326
|
-
|
|
327
|
-
## License
|
|
328
|
-
|
|
329
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
330
|
-
|
|
331
|
-
## Credits
|
|
332
|
-
|
|
333
|
-
- Built with [n8n](https://n8n.io/) workflow automation platform
|
|
334
|
-
- Uses [change-case](https://github.com/blakeembrey/change-case) for string manipulation
|
|
335
|
-
- 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
|
+
## Installation
|
|
129
|
+
|
|
130
|
+
### Method 1: npm (Recommended)
|
|
131
|
+
```bash
|
|
132
|
+
npm install n8n-nodes-mautic-advanced
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Method 2: Manual Installation
|
|
136
|
+
1. Clone this repository:
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced.git
|
|
139
|
+
cd n8n-nodes-mautic-advanced
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
2. Install dependencies:
|
|
143
|
+
```bash
|
|
144
|
+
npm install
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
3. Build the node:
|
|
148
|
+
```bash
|
|
149
|
+
npm run build
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
4. Link to your n8n installation:
|
|
153
|
+
```bash
|
|
154
|
+
npm link
|
|
155
|
+
cd /path/to/your/n8n/installation
|
|
156
|
+
npm link n8n-nodes-mautic-advanced
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Authentication
|
|
160
|
+
|
|
161
|
+
### API Credentials
|
|
162
|
+
1. Go to your Mautic instance
|
|
163
|
+
2. Navigate to **Settings** → **API Credentials**
|
|
164
|
+
3. Create a new API credential
|
|
165
|
+
4. Copy the **Public Key** and **Secret Key**
|
|
166
|
+
5. In n8n, add a new Mautic Advanced credential
|
|
167
|
+
6. Select **Credentials** authentication method
|
|
168
|
+
7. Enter your Mautic URL, Public Key, and Secret Key
|
|
169
|
+
|
|
170
|
+
### OAuth2
|
|
171
|
+
1. In n8n, add a new Mautic Advanced credential
|
|
172
|
+
2. Select **OAuth2** authentication method
|
|
173
|
+
3. Enter your Mautic URL
|
|
174
|
+
4. Follow the OAuth2 authorization flow
|
|
175
|
+
|
|
176
|
+
## Advanced Features
|
|
177
|
+
|
|
178
|
+
### Where Filters
|
|
179
|
+
Advanced filtering for Contact > Get Many operations:
|
|
180
|
+
- **Nested Conditions**: Support for andX/orX logical operators
|
|
181
|
+
- **Multiple Expressions**: eq, neq, lt, lte, gt, gte, between, in, isNull, isNotNull
|
|
182
|
+
- **Custom Fields**: Filter by any custom or system field
|
|
183
|
+
- **Date Filtering**: Automatic date formatting for Mautic API
|
|
184
|
+
|
|
185
|
+
### DNC Filtering
|
|
186
|
+
Filter contacts by Do Not Contact status:
|
|
187
|
+
- **Email DNC Only**: Contacts with email DNC enabled
|
|
188
|
+
- **SMS DNC Only**: Contacts with SMS DNC enabled
|
|
189
|
+
- **Any DNC Only**: Contacts with any DNC enabled
|
|
190
|
+
|
|
191
|
+
### Field Selection
|
|
192
|
+
Choose which fields to return for Contact operations:
|
|
193
|
+
- **System Fields**: date_added, date_modified, id, owner_id
|
|
194
|
+
- **Custom Fields**: Any custom field defined in Mautic
|
|
195
|
+
- **All Fields**: Return complete contact data
|
|
196
|
+
|
|
197
|
+
### Date Formatting
|
|
198
|
+
Automatic date formatting for known date fields:
|
|
199
|
+
- **Format**: YYYY-MM-DD HH:mm:ss UTC
|
|
200
|
+
- **Compatibility**: Ensures Mautic API compatibility
|
|
201
|
+
- **Fields**: date_added, date_modified, lastActive, etc.
|
|
202
|
+
|
|
203
|
+
## Usage Examples
|
|
204
|
+
|
|
205
|
+
### Create a Contact with Tags
|
|
206
|
+
```javascript
|
|
207
|
+
// Contact Create operation
|
|
208
|
+
{
|
|
209
|
+
"email": "john.doe@example.com",
|
|
210
|
+
"firstName": "John",
|
|
211
|
+
"lastName": "Doe",
|
|
212
|
+
"additionalFields": {
|
|
213
|
+
"tags": ["customer", "vip"],
|
|
214
|
+
"company": "Example Corp",
|
|
215
|
+
"phone": "+1234567890"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Filter Contacts with Where Conditions
|
|
221
|
+
```javascript
|
|
222
|
+
// Contact Get Many with Where filter
|
|
223
|
+
{
|
|
224
|
+
"where": {
|
|
225
|
+
"conditions": [
|
|
226
|
+
{
|
|
227
|
+
"col": "email",
|
|
228
|
+
"expr": "neq",
|
|
229
|
+
"val": ""
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"col": "date_added",
|
|
233
|
+
"expr": "gte",
|
|
234
|
+
"val": "2024-01-01"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Send Email to Segment
|
|
242
|
+
```javascript
|
|
243
|
+
// Segment Email operation
|
|
244
|
+
{
|
|
245
|
+
"segmentId": "123",
|
|
246
|
+
"emailId": "456",
|
|
247
|
+
"options": {
|
|
248
|
+
"sendToNewOnly": true
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Development
|
|
254
|
+
|
|
255
|
+
### Prerequisites
|
|
256
|
+
- Node.js 16+
|
|
257
|
+
- npm or yarn
|
|
258
|
+
- n8n development environment
|
|
259
|
+
|
|
260
|
+
### Commands
|
|
261
|
+
```bash
|
|
262
|
+
# Install dependencies
|
|
263
|
+
npm install
|
|
264
|
+
|
|
265
|
+
# Build the node
|
|
266
|
+
npm run build
|
|
267
|
+
|
|
268
|
+
# Watch for changes (development)
|
|
269
|
+
npm run dev
|
|
270
|
+
|
|
271
|
+
# Check for linting errors
|
|
272
|
+
npm run lint
|
|
273
|
+
|
|
274
|
+
# Fix linting errors
|
|
275
|
+
npm run lint:fix
|
|
276
|
+
|
|
277
|
+
# Format code
|
|
278
|
+
npm run format
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Project Structure
|
|
282
|
+
```
|
|
283
|
+
├── credentials/ # Authentication credentials
|
|
284
|
+
├── nodes/ # Node implementations
|
|
285
|
+
│ └── MauticAdvanced/ # Main node files
|
|
286
|
+
├── dist/ # Compiled output
|
|
287
|
+
├── package.json # Project configuration
|
|
288
|
+
└── README.md # This file
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Troubleshooting
|
|
292
|
+
|
|
293
|
+
### Common Issues
|
|
294
|
+
|
|
295
|
+
#### "Could not get parameter 'options'" Error
|
|
296
|
+
**Cause**: Missing Options parameter in node definition
|
|
297
|
+
**Solution**: Update to latest version (0.3.2+) which includes all required Options parameters
|
|
298
|
+
|
|
299
|
+
#### Authentication Errors
|
|
300
|
+
**Cause**: Incorrect credentials or URL
|
|
301
|
+
**Solution**:
|
|
302
|
+
- Verify Mautic URL format (https://your-mautic.com)
|
|
303
|
+
- Check API credentials are active
|
|
304
|
+
- Ensure proper permissions for API access
|
|
305
|
+
|
|
306
|
+
#### Date Filter Issues
|
|
307
|
+
**Cause**: Incorrect date format
|
|
308
|
+
**Solution**: Use YYYY-MM-DD format for date filters
|
|
309
|
+
|
|
310
|
+
#### Pagination Problems
|
|
311
|
+
**Cause**: Large datasets causing timeouts
|
|
312
|
+
**Solution**: Use "Return All" option or set appropriate limits
|
|
313
|
+
|
|
314
|
+
### Getting Help
|
|
315
|
+
1. Check the [Changelog](CHANGELOG.md) for recent fixes
|
|
316
|
+
2. Search existing [Issues](https://github.com/msoukhomlinov/n8n-nodes-mautic-advanced/issues)
|
|
317
|
+
3. Create a new issue with detailed information
|
|
318
|
+
|
|
319
|
+
## Support
|
|
320
|
+
|
|
321
|
+
If you find this node helpful and want to support its ongoing development, you can buy me a coffee:
|
|
322
|
+
|
|
323
|
+
[](https://buymeacoffee.com/msoukhomlinov)
|
|
324
|
+
|
|
325
|
+
Your support helps maintain this project and develop new features.
|
|
326
|
+
|
|
327
|
+
## License
|
|
328
|
+
|
|
329
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
330
|
+
|
|
331
|
+
## Credits
|
|
332
|
+
|
|
333
|
+
- Built with [n8n](https://n8n.io/) workflow automation platform
|
|
334
|
+
- Uses [change-case](https://github.com/blakeembrey/change-case) for string manipulation
|
|
335
|
+
- Icons and design inspired by n8n community standards
|
|
@@ -63,12 +63,12 @@ exports.categoryFields = [
|
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
65
|
default: '',
|
|
66
|
-
description: 'The title of the category
|
|
66
|
+
description: 'The title or name of the category',
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
displayName: 'Bundle',
|
|
70
70
|
name: 'bundle',
|
|
71
|
-
type: '
|
|
71
|
+
type: 'options',
|
|
72
72
|
required: true,
|
|
73
73
|
displayOptions: {
|
|
74
74
|
show: {
|
|
@@ -76,8 +76,75 @@ exports.categoryFields = [
|
|
|
76
76
|
operation: ['create'],
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
options: [
|
|
80
|
+
{
|
|
81
|
+
name: 'Global',
|
|
82
|
+
value: 'global',
|
|
83
|
+
description: 'Available across all Mautic elements',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'Asset',
|
|
87
|
+
value: 'asset',
|
|
88
|
+
description: 'For downloadable assets',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Campaign',
|
|
92
|
+
value: 'campaign',
|
|
93
|
+
description: 'For marketing campaigns',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Email',
|
|
97
|
+
value: 'email',
|
|
98
|
+
description: 'For email templates',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Focus Items',
|
|
102
|
+
value: 'plugin:focus',
|
|
103
|
+
description: 'For focus items',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'Form',
|
|
107
|
+
value: 'form',
|
|
108
|
+
description: 'For forms',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'Marketing Messages',
|
|
112
|
+
value: 'messages',
|
|
113
|
+
description: 'For marketing messages',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'Page',
|
|
117
|
+
value: 'page',
|
|
118
|
+
description: 'For landing pages',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'Point',
|
|
122
|
+
value: 'point',
|
|
123
|
+
description: 'For point actions',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'Segment',
|
|
127
|
+
value: 'segment',
|
|
128
|
+
description: 'For contact segments',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'Text Message',
|
|
132
|
+
value: 'sms',
|
|
133
|
+
description: 'For SMS/text messages',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'Social Monitoring',
|
|
137
|
+
value: 'plugin:mauticSocial',
|
|
138
|
+
description: 'For social monitoring',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: 'Stage',
|
|
142
|
+
value: 'stage',
|
|
143
|
+
description: 'For contact stages',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
default: 'global',
|
|
147
|
+
description: 'The bundle where the category will be available. Determines which Mautic elements can use this category',
|
|
81
148
|
},
|
|
82
149
|
{
|
|
83
150
|
displayName: 'Description',
|
|
@@ -90,12 +157,12 @@ exports.categoryFields = [
|
|
|
90
157
|
},
|
|
91
158
|
},
|
|
92
159
|
default: '',
|
|
93
|
-
description: '
|
|
160
|
+
description: 'Optional description of the category to help identify its purpose',
|
|
94
161
|
},
|
|
95
162
|
{
|
|
96
163
|
displayName: 'Color',
|
|
97
164
|
name: 'color',
|
|
98
|
-
type: '
|
|
165
|
+
type: 'color',
|
|
99
166
|
displayOptions: {
|
|
100
167
|
show: {
|
|
101
168
|
resource: ['category'],
|
|
@@ -103,7 +170,7 @@ exports.categoryFields = [
|
|
|
103
170
|
},
|
|
104
171
|
},
|
|
105
172
|
default: '',
|
|
106
|
-
description: '
|
|
173
|
+
description: 'Color for visual organisation and identification of the category in Mautic',
|
|
107
174
|
},
|
|
108
175
|
/* -------------------------------------------------------------------------- */
|
|
109
176
|
/* category:update */
|
|
@@ -153,28 +220,95 @@ exports.categoryFields = [
|
|
|
153
220
|
name: 'title',
|
|
154
221
|
type: 'string',
|
|
155
222
|
default: '',
|
|
156
|
-
description: 'The new title of the category',
|
|
223
|
+
description: 'The new title or name of the category',
|
|
157
224
|
},
|
|
158
225
|
{
|
|
159
226
|
displayName: 'Bundle',
|
|
160
227
|
name: 'bundle',
|
|
161
|
-
type: '
|
|
228
|
+
type: 'options',
|
|
162
229
|
default: '',
|
|
163
|
-
|
|
230
|
+
options: [
|
|
231
|
+
{
|
|
232
|
+
name: 'Global',
|
|
233
|
+
value: 'global',
|
|
234
|
+
description: 'Available across all Mautic elements',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'Asset',
|
|
238
|
+
value: 'asset',
|
|
239
|
+
description: 'For downloadable assets',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: 'Campaign',
|
|
243
|
+
value: 'campaign',
|
|
244
|
+
description: 'For marketing campaigns',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'Email',
|
|
248
|
+
value: 'email',
|
|
249
|
+
description: 'For email templates',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'Focus Items',
|
|
253
|
+
value: 'plugin:focus',
|
|
254
|
+
description: 'For focus items',
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: 'Form',
|
|
258
|
+
value: 'form',
|
|
259
|
+
description: 'For forms',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'Marketing Messages',
|
|
263
|
+
value: 'messages',
|
|
264
|
+
description: 'For marketing messages',
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: 'Page',
|
|
268
|
+
value: 'page',
|
|
269
|
+
description: 'For landing pages',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'Point',
|
|
273
|
+
value: 'point',
|
|
274
|
+
description: 'For point actions',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'Segment',
|
|
278
|
+
value: 'segment',
|
|
279
|
+
description: 'For contact segments',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'Text Message',
|
|
283
|
+
value: 'sms',
|
|
284
|
+
description: 'For SMS/text messages',
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: 'Social Monitoring',
|
|
288
|
+
value: 'plugin:mauticSocial',
|
|
289
|
+
description: 'For social monitoring',
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'Stage',
|
|
293
|
+
value: 'stage',
|
|
294
|
+
description: 'For contact stages',
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
description: 'The bundle where the category will be available. Determines which Mautic elements can use this category',
|
|
164
298
|
},
|
|
165
299
|
{
|
|
166
300
|
displayName: 'Description',
|
|
167
301
|
name: 'description',
|
|
168
302
|
type: 'string',
|
|
169
303
|
default: '',
|
|
170
|
-
description: '
|
|
304
|
+
description: 'Optional description of the category to help identify its purpose',
|
|
171
305
|
},
|
|
172
306
|
{
|
|
173
307
|
displayName: 'Color',
|
|
174
308
|
name: 'color',
|
|
175
|
-
type: '
|
|
309
|
+
type: 'color',
|
|
176
310
|
default: '',
|
|
177
|
-
description: '
|
|
311
|
+
description: 'Color for visual organisation and identification of the category in Mautic',
|
|
178
312
|
},
|
|
179
313
|
],
|
|
180
314
|
},
|
|
@@ -1727,6 +1727,58 @@ exports.contactFields = [
|
|
|
1727
1727
|
},
|
|
1728
1728
|
default: '',
|
|
1729
1729
|
},
|
|
1730
|
+
{
|
|
1731
|
+
displayName: 'Tokens',
|
|
1732
|
+
name: 'tokensUi',
|
|
1733
|
+
type: 'fixedCollection',
|
|
1734
|
+
typeOptions: {
|
|
1735
|
+
multipleValues: true,
|
|
1736
|
+
},
|
|
1737
|
+
placeholder: 'Add Token',
|
|
1738
|
+
description: 'Custom tokens to pass to the email template. These will be available as {token_name} in your email template.',
|
|
1739
|
+
default: {},
|
|
1740
|
+
displayOptions: {
|
|
1741
|
+
show: {
|
|
1742
|
+
resource: ['contact'],
|
|
1743
|
+
operation: ['sendEmail'],
|
|
1744
|
+
},
|
|
1745
|
+
},
|
|
1746
|
+
options: [
|
|
1747
|
+
{
|
|
1748
|
+
name: 'tokenValues',
|
|
1749
|
+
displayName: 'Token',
|
|
1750
|
+
values: [
|
|
1751
|
+
{
|
|
1752
|
+
displayName: 'Token Name',
|
|
1753
|
+
name: 'tokenKey',
|
|
1754
|
+
type: 'string',
|
|
1755
|
+
default: '',
|
|
1756
|
+
description: 'The token name (e.g., "order_id", "customer_name")',
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
displayName: 'Token Value',
|
|
1760
|
+
name: 'tokenValue',
|
|
1761
|
+
type: 'string',
|
|
1762
|
+
default: '',
|
|
1763
|
+
description: 'The token value (e.g., "12345", "John")',
|
|
1764
|
+
},
|
|
1765
|
+
],
|
|
1766
|
+
},
|
|
1767
|
+
],
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
displayName: 'Asset Attachments',
|
|
1771
|
+
name: 'assetAttachments',
|
|
1772
|
+
type: 'string',
|
|
1773
|
+
description: 'Comma-separated list of asset IDs to attach to the email',
|
|
1774
|
+
default: '',
|
|
1775
|
+
displayOptions: {
|
|
1776
|
+
show: {
|
|
1777
|
+
resource: ['contact'],
|
|
1778
|
+
operation: ['sendEmail'],
|
|
1779
|
+
},
|
|
1780
|
+
},
|
|
1781
|
+
},
|
|
1730
1782
|
/* -------------------------------------------------------------------------- */
|
|
1731
1783
|
/* contact:getNotes */
|
|
1732
1784
|
/* -------------------------------------------------------------------------- */
|
|
@@ -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>
|
|
@@ -220,8 +220,33 @@ async function deleteContact(context, itemIndex) {
|
|
|
220
220
|
}
|
|
221
221
|
async function sendEmailToContact(context, itemIndex) {
|
|
222
222
|
const contactId = (0, ApiHelpers_1.getRequiredParam)(context, 'contactId', itemIndex);
|
|
223
|
-
const emailId = (0, ApiHelpers_1.getRequiredParam)(context, '
|
|
224
|
-
const
|
|
223
|
+
const emailId = (0, ApiHelpers_1.getRequiredParam)(context, 'campaignEmailId', itemIndex);
|
|
224
|
+
const tokensUi = (0, ApiHelpers_1.getOptionalParam)(context, 'tokensUi', itemIndex, {});
|
|
225
|
+
const assetAttachments = (0, ApiHelpers_1.getOptionalParam)(context, 'assetAttachments', itemIndex, '');
|
|
226
|
+
// Build request body
|
|
227
|
+
const body = {};
|
|
228
|
+
// Process tokens from key-value pairs UI
|
|
229
|
+
if (tokensUi?.tokenValues && Array.isArray(tokensUi.tokenValues)) {
|
|
230
|
+
const tokens = {};
|
|
231
|
+
for (const tokenItem of tokensUi.tokenValues) {
|
|
232
|
+
if (tokenItem.tokenKey && tokenItem.tokenValue !== undefined) {
|
|
233
|
+
tokens[tokenItem.tokenKey] = tokenItem.tokenValue;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (Object.keys(tokens).length > 0) {
|
|
237
|
+
body.tokens = tokens;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Process asset attachments
|
|
241
|
+
if (assetAttachments && assetAttachments.trim()) {
|
|
242
|
+
body.assetAttachments = assetAttachments
|
|
243
|
+
.split(',')
|
|
244
|
+
.map((id) => id.trim())
|
|
245
|
+
.filter((id) => id.length > 0);
|
|
246
|
+
}
|
|
247
|
+
// Only send body if it has content
|
|
248
|
+
const requestBody = Object.keys(body).length > 0 ? body : {};
|
|
249
|
+
const response = await (0, ApiHelpers_1.makeApiRequest)(context, 'POST', `/emails/${emailId}/contact/${contactId}/send`, requestBody);
|
|
225
250
|
return response;
|
|
226
251
|
}
|
|
227
252
|
async function editContactPoints(context, itemIndex) {
|
|
@@ -198,8 +198,11 @@ async function createCategory(context, itemIndex) {
|
|
|
198
198
|
if (description)
|
|
199
199
|
body.description = description;
|
|
200
200
|
const color = (0, ApiHelpers_1.getOptionalParam)(context, 'color', itemIndex, '');
|
|
201
|
-
if (color)
|
|
202
|
-
|
|
201
|
+
if (color) {
|
|
202
|
+
// Mautic API expects hex color without # prefix (e.g., "b36262")
|
|
203
|
+
// n8n color picker returns with # prefix, so we strip it if present
|
|
204
|
+
body.color = color.startsWith('#') ? color.substring(1) : color;
|
|
205
|
+
}
|
|
203
206
|
const response = await (0, ApiHelpers_1.makeApiRequest)(context, 'POST', '/categories/new', body);
|
|
204
207
|
return response.category;
|
|
205
208
|
}
|
|
@@ -212,8 +215,12 @@ async function updateCategory(context, itemIndex) {
|
|
|
212
215
|
body.title = updateFields.title;
|
|
213
216
|
if (updateFields.description)
|
|
214
217
|
body.description = updateFields.description;
|
|
215
|
-
if (updateFields.color)
|
|
216
|
-
|
|
218
|
+
if (updateFields.color) {
|
|
219
|
+
// Mautic API expects hex color without # prefix (e.g., "b36262")
|
|
220
|
+
// n8n color picker returns with # prefix, so we strip it if present
|
|
221
|
+
const color = updateFields.color;
|
|
222
|
+
body.color = color.startsWith('#') ? color.substring(1) : color;
|
|
223
|
+
}
|
|
217
224
|
if (updateFields.bundle)
|
|
218
225
|
body.bundle = updateFields.bundle;
|
|
219
226
|
const method = createIfNotFound ? 'PUT' : 'PATCH';
|
package/package.json
CHANGED