n8n-nodes-commercetools 0.1.11 → 0.1.13
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/LICENSE.md +19 -19
- package/README.md +747 -747
- package/dist/icons/Commercetools.svg +44 -44
- package/dist/icons/github.dark.svg +3 -3
- package/dist/icons/github.svg +3 -3
- package/dist/nodes/Commercetools/Commercetools.svg +43 -43
- package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js +20 -2
- package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js.map +1 -1
- package/dist/nodes/Commercetools/properties/subscription.properties.js +122 -4
- package/dist/nodes/Commercetools/properties/subscription.properties.js.map +1 -1
- package/dist/nodes/Commercetools/utils/awsInfra.utils.js +228 -228
- package/dist/package.json +6 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/icons/Commercetools.svg +44 -44
- package/icons/github.dark.svg +3 -3
- package/icons/github.svg +3 -3
- package/package.json +63 -63
package/README.md
CHANGED
|
@@ -1,747 +1,747 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
# n8n-nodes-commercetools
|
|
5
|
-
|
|
6
|
-
This repository provides a custom [n8n](https://n8n.io) node for integrating with [Commercetools](https://commercetools.com). It includes all required credentials, node definitions, utilities to interact with the Commercetools API, and **AWS SQS integration with Lambda processing**.
|
|
7
|
-
|
|
8
|
-
## Features
|
|
9
|
-
|
|
10
|
-
- **Complete Commercetools Integration**: Full support for products, categories, and customers
|
|
11
|
-
- **Webhook Product Trigger**: Native trigger for product events; send directly to n8n webhooks or route through AWS SQS/Lambda using the provided automation scripts
|
|
12
|
-
- **AWS SQS + Lambda**: Scalable, reliable event processing with AWS infrastructure (CloudFormation + helper scripts included)
|
|
13
|
-
- **Event Types**: Product Created, Published, and Deleted events
|
|
14
|
-
- **Monitoring**: CloudWatch alarms and logging for production use
|
|
15
|
-
- **Multi-Environment**: Support for dev, staging, and production deployments
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Quick Start
|
|
19
|
-
|
|
20
|
-
**To start developing and testing the Commercetools node:**
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install
|
|
24
|
-
npm run dev
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This will start n8n with the Commercetools node loaded and hot reload enabled.
|
|
28
|
-
|
|
29
|
-
## Webhook Trigger
|
|
30
|
-
|
|
31
|
-
Use the Commercetools Trigger node to receive events directly in n8n.
|
|
32
|
-
|
|
33
|
-
1. Add the **Commercetools Trigger** node and choose **Webhook** as the destination (use the SQS steps below if you prefer queue delivery).
|
|
34
|
-
2. Activate your workflow to generate the webhook URL and set the `WEBHOOK_URL` environment variable in your CommerceTools subscription or Lambda deployment so events post to this URL. The URL typically looks like `https://<n8n-host>/webhook/<path>/commercetools-product-events`.
|
|
35
|
-
3. In CommerceTools, create or update a subscription pointing to that webhook URL and enable the product event types you need (Created, Published, Deleted). If you deploy via Lambda + SQS, ensure the Lambda forwards the payloads to `WEBHOOK_URL` using the provided AWS infrastructure utilities.
|
|
36
|
-
|
|
37
|
-
## AWS SQS + Lambda Integration
|
|
38
|
-
|
|
39
|
-
For production-grade event processing, this node supports AWS SQS queues with Lambda function processing:
|
|
40
|
-
|
|
41
|
-
### Quick Deploy
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
# Deploy AWS infrastructure
|
|
45
|
-
cd aws
|
|
46
|
-
./deploy.sh deploy
|
|
47
|
-
|
|
48
|
-
# Get configuration values
|
|
49
|
-
./deploy.sh outputs
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Configure SQS in n8n
|
|
53
|
-
|
|
54
|
-
1. Add CommerceTools Trigger node to your workflow
|
|
55
|
-
2. Select **"Amazon SQS"** as destination type
|
|
56
|
-
3. Configure with deployment outputs:
|
|
57
|
-
- **AWS Region**: Your deployment region
|
|
58
|
-
- **SQS Queue URL**: From deployment outputs
|
|
59
|
-
- **AWS Access Key ID** and **Secret**: Your AWS credentials
|
|
60
|
-
- **Lambda Function Name**: `commercetools-integration-dev-product-processor`
|
|
61
|
-
- **CTP Project Key**: `n8n-ct-integration`
|
|
62
|
-
- **Product Events**: Select `Product Published`
|
|
63
|
-
|
|
64
|
-
### Benefits of SQS Integration
|
|
65
|
-
|
|
66
|
-
- **Reliability**: Messages are persisted and retried automatically
|
|
67
|
-
- **Scalability**: Lambda scales automatically based on queue depth
|
|
68
|
-
- **Monitoring**: CloudWatch alarms for errors and failed messages
|
|
69
|
-
- **Dead Letter Queue**: Failed messages are preserved for investigation
|
|
70
|
-
- **Cost-Effective**: Pay only for what you use
|
|
71
|
-
|
|
72
|
-
See [aws/README.md](aws/README.md) for detailed configuration and customization options. Additional AWS resources: [AWS_AUTOMATION_PLAN.md](AWS_AUTOMATION_PLAN.md), [AWS_ATTRIBUTE_REFERENCE.md](AWS_ATTRIBUTE_REFERENCE.md), and [AUTOMATIC_SETUP.md](AUTOMATIC_SETUP.md).
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
## Configuration Options
|
|
81
|
-
|
|
82
|
-
Below are the main configuration options and parameters available for the Commercetools node (resource: product or category):
|
|
83
|
-
|
|
84
|
-
### Common Parameters
|
|
85
|
-
- **resource**: Select 'product' or 'category' to access respective operations.
|
|
86
|
-
- **operation**: Choose the desired operation (e.g., create, query, get, update, delete, etc.).
|
|
87
|
-
- **Credentials**: Select your configured Commercetools OAuth2 credentials.
|
|
88
|
-
|
|
89
|
-
### Product Operation-Specific Parameters
|
|
90
|
-
|
|
91
|
-
#### Create Product
|
|
92
|
-
- **productDraft**: JSON object with product details (name, slug, productType, masterVariant, etc.).
|
|
93
|
-
- **additionalFieldsCreate**: Optional fields for additional product properties.
|
|
94
|
-
|
|
95
|
-
#### Query Products
|
|
96
|
-
- **returnAll**: Boolean to return all products (up to 500 per request).
|
|
97
|
-
- **limit**: Number of products to return per request.
|
|
98
|
-
- **offset**: Pagination offset.
|
|
99
|
-
- **additionalFields**: Optional filters, sorting, and predicate variables.
|
|
100
|
-
|
|
101
|
-
#### Search Products
|
|
102
|
-
- **searchRequest**: JSON object for advanced search queries.
|
|
103
|
-
- **additionalFieldsSearch**: Optional search parameters (limit, offset, staged, etc.).
|
|
104
|
-
|
|
105
|
-
#### Get Product / Get By Key
|
|
106
|
-
- **productId** or **productKey**: ID or key of the product to retrieve.
|
|
107
|
-
- **additionalFieldsGet**: Optional fields for expanded data.
|
|
108
|
-
|
|
109
|
-
#### Update Product / Update By Key
|
|
110
|
-
- **productId** or **productKey**: ID or key of the product to update.
|
|
111
|
-
- **version**: Product version (required for updates).
|
|
112
|
-
- **actions**: Array of update actions (JSON).
|
|
113
|
-
- **updateActions**: UI builder that lets you stack multiple product update actions without hand-writing JSON. These can be combined with the `actions` array if you need to mix UI-built and raw payloads.
|
|
114
|
-
- **additionalFieldsUpdate**: Optional fields (dataErasure, dryRun, etc.).
|
|
115
|
-
|
|
116
|
-
#### Delete Product / Delete By Key
|
|
117
|
-
- **productId** or **productKey**: ID or key of the product to delete.
|
|
118
|
-
- **version**: Product version (required for deletion).
|
|
119
|
-
- **additionalFieldsDelete**: Optional fields (dataErasure, etc.).
|
|
120
|
-
|
|
121
|
-
#### Query Product Selections
|
|
122
|
-
- **productId** or **productKey**: ID or key of the product.
|
|
123
|
-
- **additionalFieldsSelections**: Optional fields (expand, limit, offset, withTotal, customParameters).
|
|
124
|
-
|
|
125
|
-
#### Upload Product Image
|
|
126
|
-
- **productId**: ID of the product to upload the image to.
|
|
127
|
-
- **binaryPropertyName**: Name of the binary property containing the image.
|
|
128
|
-
- **additionalFieldsUpload**: Optional fields (variantId, sku, staged, filename, externalUrl, label, customParameters).
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### Customer Operation-Specific Parameters
|
|
132
|
-
|
|
133
|
-
#### Authenticate Customer
|
|
134
|
-
|
|
135
|
-
- **email**: Customer's email.
|
|
136
|
-
- **password**: Customer password.
|
|
137
|
-
|
|
138
|
-
#### Authenticate Customer in Store
|
|
139
|
-
|
|
140
|
-
- **storeKey**: Key of the store.
|
|
141
|
-
- **email**: Customer email.
|
|
142
|
-
- **password**: Customer password.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
#### Change Customer Password
|
|
146
|
-
|
|
147
|
-
- **customerId**: ID of the customer.
|
|
148
|
-
- **version**: Customer version.
|
|
149
|
-
- **passwordToken**: PasswordToken to authenticate.
|
|
150
|
-
- **newPassword**: New password.
|
|
151
|
-
|
|
152
|
-
#### Change Customer Password in Store
|
|
153
|
-
|
|
154
|
-
- **storeKey**: Store key.
|
|
155
|
-
- **customerId**: ID of the customer.
|
|
156
|
-
- **version**: Customer version.
|
|
157
|
-
- **passwordToken**: PasswordToken to authenticate.
|
|
158
|
-
- **newPassword**: New password.
|
|
159
|
-
|
|
160
|
-
#### Check if Customer Exists
|
|
161
|
-
|
|
162
|
-
- **customerId**: Customer ID.
|
|
163
|
-
|
|
164
|
-
#### Check if Customer Exists by Key
|
|
165
|
-
|
|
166
|
-
- **customerKey**: Customer key.
|
|
167
|
-
|
|
168
|
-
#### Check if Any Customer Matches the Query
|
|
169
|
-
|
|
170
|
-
- **where**: Predicate expression.
|
|
171
|
-
- **additionalFieldsCheckQuery**: Optional parameters (store projection, expand).
|
|
172
|
-
|
|
173
|
-
#### Check if Customer Exists in Store
|
|
174
|
-
|
|
175
|
-
- **storeKey**: Store key.
|
|
176
|
-
- **customerId**: Customer ID.
|
|
177
|
-
|
|
178
|
-
#### Check if Customer Exists in Store by Key
|
|
179
|
-
|
|
180
|
-
- **storeKey**: Store key.
|
|
181
|
-
- **customerKey**: Customer key.
|
|
182
|
-
|
|
183
|
-
#### Check if Any Customer Matches the Query in Store
|
|
184
|
-
|
|
185
|
-
- **storeKey**: Store key.
|
|
186
|
-
- **where**: Predicate filter.
|
|
187
|
-
- **additionalFieldsCheckQueryStore**: Optional parameters.
|
|
188
|
-
|
|
189
|
-
#### Create Customer
|
|
190
|
-
|
|
191
|
-
- **customerDraft**: Customer JSON object (email, firstName, lastName, password, custom, etc.).
|
|
192
|
-
- **additionalFieldsCreate**: Optional fields (expand, localeProjection, etc.).
|
|
193
|
-
|
|
194
|
-
#### Create Email Verification Token
|
|
195
|
-
|
|
196
|
-
- **id**: Customer ID.
|
|
197
|
-
- **version**: Customer version.
|
|
198
|
-
|
|
199
|
-
#### Create Email Verification Token in Store
|
|
200
|
-
|
|
201
|
-
- **storeKey**: Store key.
|
|
202
|
-
- **id**: Customer ID.
|
|
203
|
-
- **version**: Customer version.
|
|
204
|
-
- **ttlMinutes**: Optional.
|
|
205
|
-
|
|
206
|
-
#### Create Customer in Store
|
|
207
|
-
|
|
208
|
-
- **storeKey**: Store key.
|
|
209
|
-
- **customerDraft**: Customer draft JSON.
|
|
210
|
-
- **additionalFieldsCreateStore**: Optional fields.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
#### Create Password Reset Token
|
|
214
|
-
|
|
215
|
-
- **email**: Customer email.
|
|
216
|
-
|
|
217
|
-
#### Create Password Reset Token in Store
|
|
218
|
-
|
|
219
|
-
- **storeKey**: Store key.
|
|
220
|
-
- **email**: Customer email.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
#### Delete Customer
|
|
224
|
-
|
|
225
|
-
- **customerId**: ID of the customer.
|
|
226
|
-
- **version**: Version of the customer.
|
|
227
|
-
|
|
228
|
-
#### Delete Customer by Key
|
|
229
|
-
|
|
230
|
-
- **customerKey**: Key of the customer.
|
|
231
|
-
- **version**: Version.
|
|
232
|
-
- **additionalFieldsDeleteKey**: Optional.
|
|
233
|
-
|
|
234
|
-
#### Delete Customer in Store
|
|
235
|
-
|
|
236
|
-
- **storeKey**: Store key.
|
|
237
|
-
- **customerId**: Customer ID.
|
|
238
|
-
- **version**: Version.
|
|
239
|
-
|
|
240
|
-
#### Delete Customer in Store by Key
|
|
241
|
-
|
|
242
|
-
- **storeKey**: Store key.
|
|
243
|
-
- **customerKey**: Customer key.
|
|
244
|
-
- **version**: Version.
|
|
245
|
-
|
|
246
|
-
#### Get Customer
|
|
247
|
-
|
|
248
|
-
- **customerId**: Customer ID.
|
|
249
|
-
- **additionalFieldsGet**: Optional fields (expand, localeProjection).
|
|
250
|
-
|
|
251
|
-
#### Get Customer By Email Token
|
|
252
|
-
|
|
253
|
-
- **emailToken**: Token value.
|
|
254
|
-
- **additionalFieldsGetToken**: Optional.
|
|
255
|
-
|
|
256
|
-
#### Get Customer By Key
|
|
257
|
-
|
|
258
|
-
- **customerKey**: Customer key.
|
|
259
|
-
- **additionalFieldsGetKey**: Optional.
|
|
260
|
-
|
|
261
|
-
#### Get Customer By Password Token
|
|
262
|
-
|
|
263
|
-
- **passwordToken**: Token value.
|
|
264
|
-
- **additionalFieldsGetPassToken**: Optional.
|
|
265
|
-
|
|
266
|
-
#### Get Customer in Store
|
|
267
|
-
|
|
268
|
-
- **storeKey**: Store key.
|
|
269
|
-
- **customerId**: Customer ID.
|
|
270
|
-
- **additionalFieldsGetStore**: Optional.
|
|
271
|
-
|
|
272
|
-
#### Get Customer in Store by Email Token
|
|
273
|
-
|
|
274
|
-
- **storeKey**: Store key.
|
|
275
|
-
- **emailToken**: Token value.
|
|
276
|
-
- **additionalFieldsGetStoreEmailToken**: Optional.
|
|
277
|
-
|
|
278
|
-
#### Get Customer in Store by Key
|
|
279
|
-
|
|
280
|
-
- **storeKey**: Store key.
|
|
281
|
-
- **customerKey**: Customer key.
|
|
282
|
-
- **additionalFieldsGetStoreKey**: Optional.
|
|
283
|
-
|
|
284
|
-
#### Get Customer in Store by Password Token
|
|
285
|
-
|
|
286
|
-
- **storeKey**: Store key.
|
|
287
|
-
- **passwordToken**: Token value.
|
|
288
|
-
- **additionalFieldsGetStorePassToken**: Optional.
|
|
289
|
-
|
|
290
|
-
#### Query Customers
|
|
291
|
-
|
|
292
|
-
- **where**: Predicate expression.
|
|
293
|
-
- **limit**: Number of results.
|
|
294
|
-
- **offset**: Offset for pagination.
|
|
295
|
-
- **sort**: Sorting expressions.
|
|
296
|
-
- **additionalFieldsQuery**: Optional fields.
|
|
297
|
-
|
|
298
|
-
#### Query Customers in Store
|
|
299
|
-
|
|
300
|
-
- **storeKey**: Store key.
|
|
301
|
-
- **where**: Predicate expression.
|
|
302
|
-
- **limit**: Number of results.
|
|
303
|
-
- **offset**: Pagination offset.
|
|
304
|
-
- **sort**: Sorting expression.
|
|
305
|
-
- **additionalFieldsQueryStore**: Optional.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
#### Reset Customer Password
|
|
309
|
-
|
|
310
|
-
- **tokenValue**: Password reset token.
|
|
311
|
-
- **newPassword**: New password.
|
|
312
|
-
- **additionalFieldsResetPwd**: Optional.
|
|
313
|
-
|
|
314
|
-
#### Reset Customer Password in Store
|
|
315
|
-
|
|
316
|
-
- **storeKey**: Store key.
|
|
317
|
-
- **tokenValue**: Token.
|
|
318
|
-
- **newPassword**: New password.
|
|
319
|
-
- **additionalFieldsResetPwdStore**: Optional.
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
#### Update Customer
|
|
323
|
-
|
|
324
|
-
- **customerId**: Customer ID.
|
|
325
|
-
- **version**: Customer version.
|
|
326
|
-
- **actions**: Array of update actions.
|
|
327
|
-
- **additionalFieldsUpdate**: Optional (expand).
|
|
328
|
-
|
|
329
|
-
#### Update Customer by Key
|
|
330
|
-
|
|
331
|
-
- **customerKey**: Customer key.
|
|
332
|
-
- **version**: Version.
|
|
333
|
-
- **actions**: Update actions array.
|
|
334
|
-
- **additionalFieldsUpdateKey**: Optional.
|
|
335
|
-
|
|
336
|
-
#### Update Customer in Store
|
|
337
|
-
|
|
338
|
-
- **storeKey**: Store key.
|
|
339
|
-
- **customerId**: Customer ID.
|
|
340
|
-
- **version**: Version.
|
|
341
|
-
- **actions**: Update actions array.
|
|
342
|
-
- **additionalFieldsUpdateStore**: Optional.
|
|
343
|
-
|
|
344
|
-
#### Update Customer in Store by Key
|
|
345
|
-
|
|
346
|
-
- **storeKey**: Store key.
|
|
347
|
-
- **customerKey**: Customer key.
|
|
348
|
-
- **version**: Version.
|
|
349
|
-
- **actions**: Update actions.
|
|
350
|
-
- **additionalFieldsUpdateStoreKey**: Optional.
|
|
351
|
-
|
|
352
|
-
#### Verify Customer Email
|
|
353
|
-
|
|
354
|
-
- **tokenValue**: Email verification token.
|
|
355
|
-
- **additionalFieldsVerify**: Optional.
|
|
356
|
-
|
|
357
|
-
#### Verify Customer Email in Store
|
|
358
|
-
|
|
359
|
-
- **storeKey**: Store key.
|
|
360
|
-
- **tokenValue**: Verification token.
|
|
361
|
-
- **additionalFieldsVerifyStore**: Optional.
|
|
362
|
-
|
|
363
|
-
### Category Operation-Specific Parameters
|
|
364
|
-
|
|
365
|
-
#### Create Category
|
|
366
|
-
- **categoryDraft**: JSON object with category details (name, slug, parent, orderHint, etc.).
|
|
367
|
-
- **additionalFieldsCreate**: Optional fields for additional category properties.
|
|
368
|
-
|
|
369
|
-
#### Query Categories
|
|
370
|
-
- **returnAll**: Boolean to return all categories (up to 500 per request).
|
|
371
|
-
- **limit**: Number of categories to return per request.
|
|
372
|
-
- **offset**: Pagination offset.
|
|
373
|
-
- **additionalFields**: Optional filters, sorting, and predicate variables.
|
|
374
|
-
|
|
375
|
-
#### Get Category / Get By Key
|
|
376
|
-
- **categoryId** or **categoryKey**: ID or key of the category to retrieve.
|
|
377
|
-
- **additionalFieldsGet**: Optional fields for expanded data.
|
|
378
|
-
|
|
379
|
-
#### Update Category / Update By Key
|
|
380
|
-
- **categoryId** or **categoryKey**: ID or key of the category to update.
|
|
381
|
-
- **version**: Category version (required for updates).
|
|
382
|
-
- **actions**: Array of update actions (JSON). (Categories currently require JSON actions only.)
|
|
383
|
-
- **additionalFieldsUpdate**: Optional fields (dataErasure, dryRun, etc.).
|
|
384
|
-
|
|
385
|
-
#### Delete Category / Delete By Key
|
|
386
|
-
- **categoryId** or **categoryKey**: ID or key of the category to delete.
|
|
387
|
-
- **version**: Category version (required for deletion).
|
|
388
|
-
- **additionalFieldsDelete**: Optional fields (dataErasure, etc.).
|
|
389
|
-
|
|
390
|
-
Refer to the node UI in n8n for detailed descriptions and validation for each parameter.
|
|
391
|
-
|
|
392
|
-
Below is a sample workflow using the Commercetools node in n8n to create and query a product.
|
|
393
|
-
|
|
394
|
-
### Example: Create a Product
|
|
395
|
-
|
|
396
|
-
1. Add the **Commercetools** node to your workflow.
|
|
397
|
-
2. Select the **Create Product** operation.
|
|
398
|
-
3. Fill in the required product draft fields (e.g., name, slug, product type, etc.).
|
|
399
|
-
4. Select your configured Commercetools credentials.
|
|
400
|
-
5. Run the workflow to create a new product in your Commercetools project.
|
|
401
|
-
|
|
402
|
-
**Sample Input (Product Draft):**
|
|
403
|
-
```json
|
|
404
|
-
{
|
|
405
|
-
"name": { "en": "Sample Product" },
|
|
406
|
-
"slug": { "en": "sample-product" },
|
|
407
|
-
"productType": { "id": "your-product-type-id" },
|
|
408
|
-
"masterVariant": {
|
|
409
|
-
"sku": "SKU123",
|
|
410
|
-
"prices": [ { "value": { "currencyCode": "USD", "centAmount": 1000 } } ]
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
### Example: Query Products
|
|
417
|
-
|
|
418
|
-
1. Add the **Commercetools** node to your workflow.
|
|
419
|
-
2. Select the **Query Products** operation.
|
|
420
|
-
3. Optionally set filters, sorting, and pagination parameters.
|
|
421
|
-
4. Select your configured Commercetools credentials.
|
|
422
|
-
5. Run the workflow to retrieve products from your Commercetools project.
|
|
423
|
-
|
|
424
|
-
**Sample Output:**
|
|
425
|
-
```json
|
|
426
|
-
[
|
|
427
|
-
{
|
|
428
|
-
"id": "product-id-1",
|
|
429
|
-
"name": { "en": "Sample Product" },
|
|
430
|
-
"slug": { "en": "sample-product" }
|
|
431
|
-
// ...other product fields
|
|
432
|
-
}
|
|
433
|
-
// ...more products
|
|
434
|
-
]
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
### Using updateActions (Product Updates)
|
|
438
|
-
|
|
439
|
-
The `updateActions` fixed collection lets you compose Commercetools product update commands directly in the node UI, with helper inputs for localized data, prices, assets, and variant targeting. Highlights:
|
|
440
|
-
- Choose whether each variant is addressed by `variantId` or `sku`, and mix multiple variant-specific actions in a single request.
|
|
441
|
-
- Localized name/slug/meta helpers automatically map locale/value pairs to the format the Commercetools API expects.
|
|
442
|
-
- Attribute editors support string/number/boolean parsing so you don’t need to pre-format JSON.
|
|
443
|
-
- Asset, price, image, and search keyword builders flatten nested fixed collections (sources, dimensions, tokenizers, etc.) into valid drafts.
|
|
444
|
-
|
|
445
|
-
Supported product update actions:
|
|
446
|
-
- Add Asset
|
|
447
|
-
- Add External Image
|
|
448
|
-
- Add Price
|
|
449
|
-
- Add Product Variant
|
|
450
|
-
- Add To Category
|
|
451
|
-
- Change Asset Name
|
|
452
|
-
- Change Asset Order
|
|
453
|
-
- Change Master Variant
|
|
454
|
-
- Change Name
|
|
455
|
-
- Change Price
|
|
456
|
-
- Change Slug
|
|
457
|
-
- Move Image To Position
|
|
458
|
-
- Publish
|
|
459
|
-
- Remove Asset
|
|
460
|
-
- Remove From Category
|
|
461
|
-
- Remove Image
|
|
462
|
-
- Remove Price
|
|
463
|
-
- Remove Variant
|
|
464
|
-
- Revert Staged Changes
|
|
465
|
-
- Revert Staged Variant Changes
|
|
466
|
-
- Set Asset Custom Field
|
|
467
|
-
- Set Asset Custom Type
|
|
468
|
-
- Set Asset Description
|
|
469
|
-
- Set Asset Key
|
|
470
|
-
- Set Asset Sources
|
|
471
|
-
- Set Asset Tags
|
|
472
|
-
- Set Attribute
|
|
473
|
-
- Set Attribute In All Variants
|
|
474
|
-
- Set Category Order Hint
|
|
475
|
-
- Set Description
|
|
476
|
-
- Set Image Label
|
|
477
|
-
- Set Key
|
|
478
|
-
- Set Meta Description
|
|
479
|
-
- Set Meta Keywords
|
|
480
|
-
- Set Meta Title
|
|
481
|
-
- Set Price Custom Field
|
|
482
|
-
- Set Price Key
|
|
483
|
-
- Set Price Mode
|
|
484
|
-
- Set Prices
|
|
485
|
-
- Set Product Attribute
|
|
486
|
-
- Set Product Price Custom Type
|
|
487
|
-
- Set Product Variant Key
|
|
488
|
-
- Set Search Keywords
|
|
489
|
-
- Set SKU
|
|
490
|
-
- Set Tax Category
|
|
491
|
-
- Transition State
|
|
492
|
-
- Unpublish
|
|
493
|
-
|
|
494
|
-
Need a field that isn’t exposed yet? Add it via the `actions` JSON array—the node merges both sources in request order.
|
|
495
|
-
|
|
496
|
-
> **Transition State note:** the builder enforces that either a state ID or a state key is set per the [Commercetools Transition State action](https://docs.commercetools.com/api/projects/products#transition-state).
|
|
497
|
-
|
|
498
|
-
### Example: Create a Category
|
|
499
|
-
|
|
500
|
-
1. Add the **Commercetools** node to your workflow.
|
|
501
|
-
2. Select the **Create Category** operation.
|
|
502
|
-
3. Fill in the required category draft fields (e.g., name, slug, parent, orderHint, etc.).
|
|
503
|
-
4. Select your configured Commercetools credentials.
|
|
504
|
-
5. Run the workflow to create a new category in your Commercetools project.
|
|
505
|
-
|
|
506
|
-
**Sample Input (Category Draft):**
|
|
507
|
-
```json
|
|
508
|
-
{
|
|
509
|
-
"name": { "en": "Sample Category" },
|
|
510
|
-
"slug": { "en": "sample-category" },
|
|
511
|
-
"orderHint": "0.1"
|
|
512
|
-
}
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
### Example: Query Categories
|
|
516
|
-
|
|
517
|
-
1. Add the **Commercetools** node to your workflow.
|
|
518
|
-
2. Select the **Query Categories** operation.
|
|
519
|
-
3. Optionally set filters, sorting, and pagination parameters.
|
|
520
|
-
4. Select your configured Commercetools credentials.
|
|
521
|
-
5. Run the workflow to retrieve categories from your Commercetools project.
|
|
522
|
-
|
|
523
|
-
**Sample Output:**
|
|
524
|
-
```json
|
|
525
|
-
[
|
|
526
|
-
{
|
|
527
|
-
"id": "category-id-1",
|
|
528
|
-
"name": { "en": "Sample Category" },
|
|
529
|
-
"slug": { "en": "sample-category" }
|
|
530
|
-
// ...other category fields
|
|
531
|
-
}
|
|
532
|
-
// ...more categories
|
|
533
|
-
]
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
You can chain Commercetools node operations with other n8n nodes to build advanced workflows for product and category management, automation, and integration.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
## Credential Setup
|
|
540
|
-
|
|
541
|
-
To use the Commercetools node for both product and category operations, you must configure OAuth2 credentials for your Commercetools project in n8n. Follow these steps:
|
|
542
|
-
|
|
543
|
-
1. **Obtain Commercetools API credentials:**
|
|
544
|
-
- Log in to your Commercetools Merchant Center.
|
|
545
|
-
- Go to the API Clients section and create a new API client.
|
|
546
|
-
- Note the following values:
|
|
547
|
-
- `Client ID`
|
|
548
|
-
- `Client Secret`
|
|
549
|
-
- `Project Key`
|
|
550
|
-
- `Scopes` (ensure you have the required scopes for product and category operations)
|
|
551
|
-
- `Region` (e.g., `australia-southeast1.gcp`)
|
|
552
|
-
|
|
553
|
-
2. **Add credentials in n8n:**
|
|
554
|
-
- In n8n, go to **Credentials** > **Create New**.
|
|
555
|
-
- Search for and select **Commercetools OAuth2 API**.
|
|
556
|
-
- Fill in the required fields:
|
|
557
|
-
- **Client ID**
|
|
558
|
-
- **Client Secret**
|
|
559
|
-
- **Project Key**
|
|
560
|
-
- **Region**
|
|
561
|
-
- **Scopes**
|
|
562
|
-
- **AWS Client ID**
|
|
563
|
-
- **AWS Client Secret**
|
|
564
|
-
- The AWS fields map to your access key pair and are required for webhook/SQS delivery paths.
|
|
565
|
-
- Save the credentials.
|
|
566
|
-
|
|
567
|
-
3. **Use credentials in your workflow:**
|
|
568
|
-
- When adding the Commercetools node to your workflow, select the credentials you just created from the credentials dropdown.
|
|
569
|
-
|
|
570
|
-
Your Commercetools node is now authenticated and ready to use for both product and category operations in n8n workflows.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
## Features & Supported Operations
|
|
574
|
-
|
|
575
|
-
The Commercetools node for n8n enables you to interact with the Commercetools API for product and category management. The following operations are supported:
|
|
576
|
-
|
|
577
|
-
### Product Operations
|
|
578
|
-
- **Create Product**
|
|
579
|
-
Create a new product in your Commercetools project.
|
|
580
|
-
|
|
581
|
-
- **Query Products**
|
|
582
|
-
Retrieve a list of products with support for pagination, sorting, filtering, and predicate variables.
|
|
583
|
-
|
|
584
|
-
- **Search Products**
|
|
585
|
-
Perform advanced product searches using the Commercetools search endpoint.
|
|
586
|
-
|
|
587
|
-
- **Get Product (by ID or Key)**
|
|
588
|
-
Retrieve detailed information for a specific product by its ID or key.
|
|
589
|
-
|
|
590
|
-
- **Update Product (by ID or Key)**
|
|
591
|
-
Update an existing product using one or more update actions. The `updateActions` UI builder now mirrors Commercetools’ product update catalog, including localized content helpers, price/asset editors, search keyword builders, and state transitions.
|
|
592
|
-
|
|
593
|
-
- **Delete Product (by ID or Key)**
|
|
594
|
-
Delete a product from your project.
|
|
595
|
-
|
|
596
|
-
- **Query Product Selections (by ID or Key)**
|
|
597
|
-
Retrieve product selection assignments for a product.
|
|
598
|
-
|
|
599
|
-
- **Upload Product Image**
|
|
600
|
-
Upload an image to a product, either from binary data or an external URL.
|
|
601
|
-
|
|
602
|
-
### Category Operations
|
|
603
|
-
- **Create Category**
|
|
604
|
-
Create a new category in your Commercetools project.
|
|
605
|
-
|
|
606
|
-
- **Query Categories**
|
|
607
|
-
Retrieve a list of categories with support for pagination, sorting, and filtering.
|
|
608
|
-
|
|
609
|
-
- **Get Category (by ID or Key)**
|
|
610
|
-
Retrieve detailed information for a specific category by its ID or key.
|
|
611
|
-
|
|
612
|
-
- **Update Category (by ID or Key)**
|
|
613
|
-
Update an existing category using one or more update actions. (Categories currently require JSON-based `actions`.)
|
|
614
|
-
|
|
615
|
-
- **Delete Category (by ID or Key)**
|
|
616
|
-
Delete a category from your project.
|
|
617
|
-
|
|
618
|
-
### Check Product & Category Existence
|
|
619
|
-
- **By ID:** Use the "HEAD" operation with a product or category ID to check if it exists.
|
|
620
|
-
- **By Key:** Use the "HEAD by Key" operation with a product or category key.
|
|
621
|
-
- **By Query:** Use the "HEAD by Query" operation to check if any product or category matches a specific query.
|
|
622
|
-
|
|
623
|
-
Each operation supports additional parameters for fine-tuned control, such as staged changes, data erasure, dry run, and more.
|
|
624
|
-
|
|
625
|
-
## What's Included
|
|
626
|
-
|
|
627
|
-
- **Commercetools Node**: Located in `nodes/Commercetools/`, this node provides operations for interacting with the Commercetools API, including product management and authentication via OAuth2.
|
|
628
|
-
- **Credentials**: OAuth2 credentials for Commercetools in `credentials/CommerceToolsOAuth2Api.credentials.ts`.
|
|
629
|
-
- **Utilities and Descriptions**: Helper functions and operation definitions for Commercetools API requests.
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
## Prerequisites
|
|
634
|
-
|
|
635
|
-
- **[Node.js](https://nodejs.org/)** (v22 or higher) and npm
|
|
636
|
-
- **[git](https://git-scm.com/downloads)**
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
## Usage
|
|
640
|
-
|
|
641
|
-
1. **Install dependencies**
|
|
642
|
-
```bash
|
|
643
|
-
npm install
|
|
644
|
-
```
|
|
645
|
-
2. **Start development server**
|
|
646
|
-
```bash
|
|
647
|
-
npm run dev
|
|
648
|
-
```
|
|
649
|
-
This will build the node and launch n8n locally with hot reload enabled. Access n8n at [http://localhost:5678](http://localhost:5678).
|
|
650
|
-
3. **Configure Commercetools credentials**
|
|
651
|
-
- Go to n8n's credentials section and add your Commercetools OAuth2 credentials.
|
|
652
|
-
4. **Use the Commercetools node in your workflow**
|
|
653
|
-
- Add the Commercetools node to your workflow and select the desired operation (e.g., product management).
|
|
654
|
-
- For product updates, use the `updateActions` builder to stack multiple actions (or combine with `actions` JSON for edge cases).
|
|
655
|
-
5. **Lint and build**
|
|
656
|
-
- Lint: `npm run lint`
|
|
657
|
-
- Auto-fix: `npm run lint:fix`
|
|
658
|
-
- Build: `npm run build`
|
|
659
|
-
6. **Publish**
|
|
660
|
-
- When ready, publish your package to npm:
|
|
661
|
-
```bash
|
|
662
|
-
npm publish
|
|
663
|
-
```
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
## Available Scripts
|
|
667
|
-
|
|
668
|
-
| Script | Description |
|
|
669
|
-
| --------------------- | ---------------------------------------------------------------- |
|
|
670
|
-
| `npm run dev` | Start n8n with the Commercetools node and watch for changes |
|
|
671
|
-
| `npm run build` | Compile TypeScript to JavaScript for production |
|
|
672
|
-
| `npm run build:watch` | Build in watch mode (auto-rebuild on changes) |
|
|
673
|
-
| `npm run lint` | Check your code for errors and style issues |
|
|
674
|
-
| `npm run lint:fix` | Automatically fix linting issues when possible |
|
|
675
|
-
| `npm run release` | Create a new release |
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
## Error Handling & Troubleshooting
|
|
681
|
-
|
|
682
|
-
Here are common errors and troubleshooting tips for the Commercetools node (products and categories):
|
|
683
|
-
|
|
684
|
-
- **Authentication Errors:**
|
|
685
|
-
- Ensure your OAuth2 credentials (Client ID, Client Secret, Project Key, Region, Scopes) are correct and have the required permissions.
|
|
686
|
-
- If you see an authentication error, re-authorize or recreate your credentials in n8n.
|
|
687
|
-
|
|
688
|
-
- **Missing or Invalid Parameters:**
|
|
689
|
-
- Double-check required fields for each operation:
|
|
690
|
-
- For products: productDraft, productId/productKey, version, etc.
|
|
691
|
-
- For categories: categoryDraft, categoryId/categoryKey, version, etc.
|
|
692
|
-
- The node will display a clear error if a required parameter is missing or invalid.
|
|
693
|
-
|
|
694
|
-
- **API Errors:**
|
|
695
|
-
- Errors from the Commercetools API (e.g., 404 Not Found, 400 Bad Request) will be shown in the node output or n8n error panel.
|
|
696
|
-
- Review the error message for details and check your input data.
|
|
697
|
-
|
|
698
|
-
- **Not Found (Product/Category):**
|
|
699
|
-
- For get, update, delete, or existence checks, ensure the productId/productKey or categoryId/categoryKey is correct and the item exists in your project.
|
|
700
|
-
|
|
701
|
-
- **Version Mismatch:**
|
|
702
|
-
- For update and delete operations, the version must match the current version in Commercetools. Retrieve the latest version before updating or deleting (applies to both products and categories).
|
|
703
|
-
|
|
704
|
-
- **Binary Data Issues (Image Upload):**
|
|
705
|
-
- Ensure the binary property name matches the uploaded file and the file is present in the workflow (product image upload only).
|
|
706
|
-
|
|
707
|
-
- **General Node Issues:**
|
|
708
|
-
- If the node does not appear in n8n, ensure dependencies are installed, the node is registered in `package.json`, and the dev server is running.
|
|
709
|
-
- Check the n8n console and logs for error details.
|
|
710
|
-
|
|
711
|
-
For linting or TypeScript errors, use the provided scripts or consult the [n8n node development guidelines](https://docs.n8n.io/integrations/creating-nodes/).
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
## Resources
|
|
715
|
-
|
|
716
|
-
- **[n8n Node Documentation](https://docs.n8n.io/integrations/creating-nodes/)**
|
|
717
|
-
- **[n8n Community Forum](https://community.n8n.io/)**
|
|
718
|
-
- **[@n8n/node-cli Documentation](https://www.npmjs.com/package/@n8n/node-cli)**
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
## Contributing
|
|
722
|
-
|
|
723
|
-
Contributions and suggestions for improving the Commercetools node are welcome. Please open an issue or submit a pull request.
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
## Changelog
|
|
728
|
-
|
|
729
|
-
All notable changes to this project will be documented in the `CHANGELOG.md` file. Below is a summary of recent updates:
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
### [Unreleased]
|
|
733
|
-
- Added Commercetools webhook-based product trigger plus AWS automation/test guides
|
|
734
|
-
- Added AWS credential fields (client ID/secret) and environment-driven webhook URL support for trigger delivery
|
|
735
|
-
- Documented AWS deployment automation and attribute references for the CloudFormation scripts
|
|
736
|
-
- Refactored Commercetools product, category, and customer property definitions for easier maintenance
|
|
737
|
-
|
|
738
|
-
### v1.0.0
|
|
739
|
-
- Initial release of the Commercetools node for n8n
|
|
740
|
-
- Supports product management operations: create, query, search, get, update, delete, product selections, image upload, and existence checks
|
|
741
|
-
- OAuth2 credential integration
|
|
742
|
-
|
|
743
|
-
Refer to `CHANGELOG.md` for a complete version history and details.
|
|
744
|
-
|
|
745
|
-
## License
|
|
746
|
-
|
|
747
|
-
[MIT](LICENSE.md)
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# n8n-nodes-commercetools
|
|
5
|
+
|
|
6
|
+
This repository provides a custom [n8n](https://n8n.io) node for integrating with [Commercetools](https://commercetools.com). It includes all required credentials, node definitions, utilities to interact with the Commercetools API, and **AWS SQS integration with Lambda processing**.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Complete Commercetools Integration**: Full support for products, categories, and customers
|
|
11
|
+
- **Webhook Product Trigger**: Native trigger for product events; send directly to n8n webhooks or route through AWS SQS/Lambda using the provided automation scripts
|
|
12
|
+
- **AWS SQS + Lambda**: Scalable, reliable event processing with AWS infrastructure (CloudFormation + helper scripts included)
|
|
13
|
+
- **Event Types**: Product Created, Published, and Deleted events
|
|
14
|
+
- **Monitoring**: CloudWatch alarms and logging for production use
|
|
15
|
+
- **Multi-Environment**: Support for dev, staging, and production deployments
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
**To start developing and testing the Commercetools node:**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install
|
|
24
|
+
npm run dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This will start n8n with the Commercetools node loaded and hot reload enabled.
|
|
28
|
+
|
|
29
|
+
## Webhook Trigger
|
|
30
|
+
|
|
31
|
+
Use the Commercetools Trigger node to receive events directly in n8n.
|
|
32
|
+
|
|
33
|
+
1. Add the **Commercetools Trigger** node and choose **Webhook** as the destination (use the SQS steps below if you prefer queue delivery).
|
|
34
|
+
2. Activate your workflow to generate the webhook URL and set the `WEBHOOK_URL` environment variable in your CommerceTools subscription or Lambda deployment so events post to this URL. The URL typically looks like `https://<n8n-host>/webhook/<path>/commercetools-product-events`.
|
|
35
|
+
3. In CommerceTools, create or update a subscription pointing to that webhook URL and enable the product event types you need (Created, Published, Deleted). If you deploy via Lambda + SQS, ensure the Lambda forwards the payloads to `WEBHOOK_URL` using the provided AWS infrastructure utilities.
|
|
36
|
+
|
|
37
|
+
## AWS SQS + Lambda Integration
|
|
38
|
+
|
|
39
|
+
For production-grade event processing, this node supports AWS SQS queues with Lambda function processing:
|
|
40
|
+
|
|
41
|
+
### Quick Deploy
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Deploy AWS infrastructure
|
|
45
|
+
cd aws
|
|
46
|
+
./deploy.sh deploy
|
|
47
|
+
|
|
48
|
+
# Get configuration values
|
|
49
|
+
./deploy.sh outputs
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Configure SQS in n8n
|
|
53
|
+
|
|
54
|
+
1. Add CommerceTools Trigger node to your workflow
|
|
55
|
+
2. Select **"Amazon SQS"** as destination type
|
|
56
|
+
3. Configure with deployment outputs:
|
|
57
|
+
- **AWS Region**: Your deployment region
|
|
58
|
+
- **SQS Queue URL**: From deployment outputs
|
|
59
|
+
- **AWS Access Key ID** and **Secret**: Your AWS credentials
|
|
60
|
+
- **Lambda Function Name**: `commercetools-integration-dev-product-processor`
|
|
61
|
+
- **CTP Project Key**: `n8n-ct-integration`
|
|
62
|
+
- **Product Events**: Select `Product Published`
|
|
63
|
+
|
|
64
|
+
### Benefits of SQS Integration
|
|
65
|
+
|
|
66
|
+
- **Reliability**: Messages are persisted and retried automatically
|
|
67
|
+
- **Scalability**: Lambda scales automatically based on queue depth
|
|
68
|
+
- **Monitoring**: CloudWatch alarms for errors and failed messages
|
|
69
|
+
- **Dead Letter Queue**: Failed messages are preserved for investigation
|
|
70
|
+
- **Cost-Effective**: Pay only for what you use
|
|
71
|
+
|
|
72
|
+
See [aws/README.md](aws/README.md) for detailed configuration and customization options. Additional AWS resources: [AWS_AUTOMATION_PLAN.md](AWS_AUTOMATION_PLAN.md), [AWS_ATTRIBUTE_REFERENCE.md](AWS_ATTRIBUTE_REFERENCE.md), and [AUTOMATIC_SETUP.md](AUTOMATIC_SETUP.md).
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Configuration Options
|
|
81
|
+
|
|
82
|
+
Below are the main configuration options and parameters available for the Commercetools node (resource: product or category):
|
|
83
|
+
|
|
84
|
+
### Common Parameters
|
|
85
|
+
- **resource**: Select 'product' or 'category' to access respective operations.
|
|
86
|
+
- **operation**: Choose the desired operation (e.g., create, query, get, update, delete, etc.).
|
|
87
|
+
- **Credentials**: Select your configured Commercetools OAuth2 credentials.
|
|
88
|
+
|
|
89
|
+
### Product Operation-Specific Parameters
|
|
90
|
+
|
|
91
|
+
#### Create Product
|
|
92
|
+
- **productDraft**: JSON object with product details (name, slug, productType, masterVariant, etc.).
|
|
93
|
+
- **additionalFieldsCreate**: Optional fields for additional product properties.
|
|
94
|
+
|
|
95
|
+
#### Query Products
|
|
96
|
+
- **returnAll**: Boolean to return all products (up to 500 per request).
|
|
97
|
+
- **limit**: Number of products to return per request.
|
|
98
|
+
- **offset**: Pagination offset.
|
|
99
|
+
- **additionalFields**: Optional filters, sorting, and predicate variables.
|
|
100
|
+
|
|
101
|
+
#### Search Products
|
|
102
|
+
- **searchRequest**: JSON object for advanced search queries.
|
|
103
|
+
- **additionalFieldsSearch**: Optional search parameters (limit, offset, staged, etc.).
|
|
104
|
+
|
|
105
|
+
#### Get Product / Get By Key
|
|
106
|
+
- **productId** or **productKey**: ID or key of the product to retrieve.
|
|
107
|
+
- **additionalFieldsGet**: Optional fields for expanded data.
|
|
108
|
+
|
|
109
|
+
#### Update Product / Update By Key
|
|
110
|
+
- **productId** or **productKey**: ID or key of the product to update.
|
|
111
|
+
- **version**: Product version (required for updates).
|
|
112
|
+
- **actions**: Array of update actions (JSON).
|
|
113
|
+
- **updateActions**: UI builder that lets you stack multiple product update actions without hand-writing JSON. These can be combined with the `actions` array if you need to mix UI-built and raw payloads.
|
|
114
|
+
- **additionalFieldsUpdate**: Optional fields (dataErasure, dryRun, etc.).
|
|
115
|
+
|
|
116
|
+
#### Delete Product / Delete By Key
|
|
117
|
+
- **productId** or **productKey**: ID or key of the product to delete.
|
|
118
|
+
- **version**: Product version (required for deletion).
|
|
119
|
+
- **additionalFieldsDelete**: Optional fields (dataErasure, etc.).
|
|
120
|
+
|
|
121
|
+
#### Query Product Selections
|
|
122
|
+
- **productId** or **productKey**: ID or key of the product.
|
|
123
|
+
- **additionalFieldsSelections**: Optional fields (expand, limit, offset, withTotal, customParameters).
|
|
124
|
+
|
|
125
|
+
#### Upload Product Image
|
|
126
|
+
- **productId**: ID of the product to upload the image to.
|
|
127
|
+
- **binaryPropertyName**: Name of the binary property containing the image.
|
|
128
|
+
- **additionalFieldsUpload**: Optional fields (variantId, sku, staged, filename, externalUrl, label, customParameters).
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Customer Operation-Specific Parameters
|
|
132
|
+
|
|
133
|
+
#### Authenticate Customer
|
|
134
|
+
|
|
135
|
+
- **email**: Customer's email.
|
|
136
|
+
- **password**: Customer password.
|
|
137
|
+
|
|
138
|
+
#### Authenticate Customer in Store
|
|
139
|
+
|
|
140
|
+
- **storeKey**: Key of the store.
|
|
141
|
+
- **email**: Customer email.
|
|
142
|
+
- **password**: Customer password.
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
#### Change Customer Password
|
|
146
|
+
|
|
147
|
+
- **customerId**: ID of the customer.
|
|
148
|
+
- **version**: Customer version.
|
|
149
|
+
- **passwordToken**: PasswordToken to authenticate.
|
|
150
|
+
- **newPassword**: New password.
|
|
151
|
+
|
|
152
|
+
#### Change Customer Password in Store
|
|
153
|
+
|
|
154
|
+
- **storeKey**: Store key.
|
|
155
|
+
- **customerId**: ID of the customer.
|
|
156
|
+
- **version**: Customer version.
|
|
157
|
+
- **passwordToken**: PasswordToken to authenticate.
|
|
158
|
+
- **newPassword**: New password.
|
|
159
|
+
|
|
160
|
+
#### Check if Customer Exists
|
|
161
|
+
|
|
162
|
+
- **customerId**: Customer ID.
|
|
163
|
+
|
|
164
|
+
#### Check if Customer Exists by Key
|
|
165
|
+
|
|
166
|
+
- **customerKey**: Customer key.
|
|
167
|
+
|
|
168
|
+
#### Check if Any Customer Matches the Query
|
|
169
|
+
|
|
170
|
+
- **where**: Predicate expression.
|
|
171
|
+
- **additionalFieldsCheckQuery**: Optional parameters (store projection, expand).
|
|
172
|
+
|
|
173
|
+
#### Check if Customer Exists in Store
|
|
174
|
+
|
|
175
|
+
- **storeKey**: Store key.
|
|
176
|
+
- **customerId**: Customer ID.
|
|
177
|
+
|
|
178
|
+
#### Check if Customer Exists in Store by Key
|
|
179
|
+
|
|
180
|
+
- **storeKey**: Store key.
|
|
181
|
+
- **customerKey**: Customer key.
|
|
182
|
+
|
|
183
|
+
#### Check if Any Customer Matches the Query in Store
|
|
184
|
+
|
|
185
|
+
- **storeKey**: Store key.
|
|
186
|
+
- **where**: Predicate filter.
|
|
187
|
+
- **additionalFieldsCheckQueryStore**: Optional parameters.
|
|
188
|
+
|
|
189
|
+
#### Create Customer
|
|
190
|
+
|
|
191
|
+
- **customerDraft**: Customer JSON object (email, firstName, lastName, password, custom, etc.).
|
|
192
|
+
- **additionalFieldsCreate**: Optional fields (expand, localeProjection, etc.).
|
|
193
|
+
|
|
194
|
+
#### Create Email Verification Token
|
|
195
|
+
|
|
196
|
+
- **id**: Customer ID.
|
|
197
|
+
- **version**: Customer version.
|
|
198
|
+
|
|
199
|
+
#### Create Email Verification Token in Store
|
|
200
|
+
|
|
201
|
+
- **storeKey**: Store key.
|
|
202
|
+
- **id**: Customer ID.
|
|
203
|
+
- **version**: Customer version.
|
|
204
|
+
- **ttlMinutes**: Optional.
|
|
205
|
+
|
|
206
|
+
#### Create Customer in Store
|
|
207
|
+
|
|
208
|
+
- **storeKey**: Store key.
|
|
209
|
+
- **customerDraft**: Customer draft JSON.
|
|
210
|
+
- **additionalFieldsCreateStore**: Optional fields.
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
#### Create Password Reset Token
|
|
214
|
+
|
|
215
|
+
- **email**: Customer email.
|
|
216
|
+
|
|
217
|
+
#### Create Password Reset Token in Store
|
|
218
|
+
|
|
219
|
+
- **storeKey**: Store key.
|
|
220
|
+
- **email**: Customer email.
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
#### Delete Customer
|
|
224
|
+
|
|
225
|
+
- **customerId**: ID of the customer.
|
|
226
|
+
- **version**: Version of the customer.
|
|
227
|
+
|
|
228
|
+
#### Delete Customer by Key
|
|
229
|
+
|
|
230
|
+
- **customerKey**: Key of the customer.
|
|
231
|
+
- **version**: Version.
|
|
232
|
+
- **additionalFieldsDeleteKey**: Optional.
|
|
233
|
+
|
|
234
|
+
#### Delete Customer in Store
|
|
235
|
+
|
|
236
|
+
- **storeKey**: Store key.
|
|
237
|
+
- **customerId**: Customer ID.
|
|
238
|
+
- **version**: Version.
|
|
239
|
+
|
|
240
|
+
#### Delete Customer in Store by Key
|
|
241
|
+
|
|
242
|
+
- **storeKey**: Store key.
|
|
243
|
+
- **customerKey**: Customer key.
|
|
244
|
+
- **version**: Version.
|
|
245
|
+
|
|
246
|
+
#### Get Customer
|
|
247
|
+
|
|
248
|
+
- **customerId**: Customer ID.
|
|
249
|
+
- **additionalFieldsGet**: Optional fields (expand, localeProjection).
|
|
250
|
+
|
|
251
|
+
#### Get Customer By Email Token
|
|
252
|
+
|
|
253
|
+
- **emailToken**: Token value.
|
|
254
|
+
- **additionalFieldsGetToken**: Optional.
|
|
255
|
+
|
|
256
|
+
#### Get Customer By Key
|
|
257
|
+
|
|
258
|
+
- **customerKey**: Customer key.
|
|
259
|
+
- **additionalFieldsGetKey**: Optional.
|
|
260
|
+
|
|
261
|
+
#### Get Customer By Password Token
|
|
262
|
+
|
|
263
|
+
- **passwordToken**: Token value.
|
|
264
|
+
- **additionalFieldsGetPassToken**: Optional.
|
|
265
|
+
|
|
266
|
+
#### Get Customer in Store
|
|
267
|
+
|
|
268
|
+
- **storeKey**: Store key.
|
|
269
|
+
- **customerId**: Customer ID.
|
|
270
|
+
- **additionalFieldsGetStore**: Optional.
|
|
271
|
+
|
|
272
|
+
#### Get Customer in Store by Email Token
|
|
273
|
+
|
|
274
|
+
- **storeKey**: Store key.
|
|
275
|
+
- **emailToken**: Token value.
|
|
276
|
+
- **additionalFieldsGetStoreEmailToken**: Optional.
|
|
277
|
+
|
|
278
|
+
#### Get Customer in Store by Key
|
|
279
|
+
|
|
280
|
+
- **storeKey**: Store key.
|
|
281
|
+
- **customerKey**: Customer key.
|
|
282
|
+
- **additionalFieldsGetStoreKey**: Optional.
|
|
283
|
+
|
|
284
|
+
#### Get Customer in Store by Password Token
|
|
285
|
+
|
|
286
|
+
- **storeKey**: Store key.
|
|
287
|
+
- **passwordToken**: Token value.
|
|
288
|
+
- **additionalFieldsGetStorePassToken**: Optional.
|
|
289
|
+
|
|
290
|
+
#### Query Customers
|
|
291
|
+
|
|
292
|
+
- **where**: Predicate expression.
|
|
293
|
+
- **limit**: Number of results.
|
|
294
|
+
- **offset**: Offset for pagination.
|
|
295
|
+
- **sort**: Sorting expressions.
|
|
296
|
+
- **additionalFieldsQuery**: Optional fields.
|
|
297
|
+
|
|
298
|
+
#### Query Customers in Store
|
|
299
|
+
|
|
300
|
+
- **storeKey**: Store key.
|
|
301
|
+
- **where**: Predicate expression.
|
|
302
|
+
- **limit**: Number of results.
|
|
303
|
+
- **offset**: Pagination offset.
|
|
304
|
+
- **sort**: Sorting expression.
|
|
305
|
+
- **additionalFieldsQueryStore**: Optional.
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
#### Reset Customer Password
|
|
309
|
+
|
|
310
|
+
- **tokenValue**: Password reset token.
|
|
311
|
+
- **newPassword**: New password.
|
|
312
|
+
- **additionalFieldsResetPwd**: Optional.
|
|
313
|
+
|
|
314
|
+
#### Reset Customer Password in Store
|
|
315
|
+
|
|
316
|
+
- **storeKey**: Store key.
|
|
317
|
+
- **tokenValue**: Token.
|
|
318
|
+
- **newPassword**: New password.
|
|
319
|
+
- **additionalFieldsResetPwdStore**: Optional.
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
#### Update Customer
|
|
323
|
+
|
|
324
|
+
- **customerId**: Customer ID.
|
|
325
|
+
- **version**: Customer version.
|
|
326
|
+
- **actions**: Array of update actions.
|
|
327
|
+
- **additionalFieldsUpdate**: Optional (expand).
|
|
328
|
+
|
|
329
|
+
#### Update Customer by Key
|
|
330
|
+
|
|
331
|
+
- **customerKey**: Customer key.
|
|
332
|
+
- **version**: Version.
|
|
333
|
+
- **actions**: Update actions array.
|
|
334
|
+
- **additionalFieldsUpdateKey**: Optional.
|
|
335
|
+
|
|
336
|
+
#### Update Customer in Store
|
|
337
|
+
|
|
338
|
+
- **storeKey**: Store key.
|
|
339
|
+
- **customerId**: Customer ID.
|
|
340
|
+
- **version**: Version.
|
|
341
|
+
- **actions**: Update actions array.
|
|
342
|
+
- **additionalFieldsUpdateStore**: Optional.
|
|
343
|
+
|
|
344
|
+
#### Update Customer in Store by Key
|
|
345
|
+
|
|
346
|
+
- **storeKey**: Store key.
|
|
347
|
+
- **customerKey**: Customer key.
|
|
348
|
+
- **version**: Version.
|
|
349
|
+
- **actions**: Update actions.
|
|
350
|
+
- **additionalFieldsUpdateStoreKey**: Optional.
|
|
351
|
+
|
|
352
|
+
#### Verify Customer Email
|
|
353
|
+
|
|
354
|
+
- **tokenValue**: Email verification token.
|
|
355
|
+
- **additionalFieldsVerify**: Optional.
|
|
356
|
+
|
|
357
|
+
#### Verify Customer Email in Store
|
|
358
|
+
|
|
359
|
+
- **storeKey**: Store key.
|
|
360
|
+
- **tokenValue**: Verification token.
|
|
361
|
+
- **additionalFieldsVerifyStore**: Optional.
|
|
362
|
+
|
|
363
|
+
### Category Operation-Specific Parameters
|
|
364
|
+
|
|
365
|
+
#### Create Category
|
|
366
|
+
- **categoryDraft**: JSON object with category details (name, slug, parent, orderHint, etc.).
|
|
367
|
+
- **additionalFieldsCreate**: Optional fields for additional category properties.
|
|
368
|
+
|
|
369
|
+
#### Query Categories
|
|
370
|
+
- **returnAll**: Boolean to return all categories (up to 500 per request).
|
|
371
|
+
- **limit**: Number of categories to return per request.
|
|
372
|
+
- **offset**: Pagination offset.
|
|
373
|
+
- **additionalFields**: Optional filters, sorting, and predicate variables.
|
|
374
|
+
|
|
375
|
+
#### Get Category / Get By Key
|
|
376
|
+
- **categoryId** or **categoryKey**: ID or key of the category to retrieve.
|
|
377
|
+
- **additionalFieldsGet**: Optional fields for expanded data.
|
|
378
|
+
|
|
379
|
+
#### Update Category / Update By Key
|
|
380
|
+
- **categoryId** or **categoryKey**: ID or key of the category to update.
|
|
381
|
+
- **version**: Category version (required for updates).
|
|
382
|
+
- **actions**: Array of update actions (JSON). (Categories currently require JSON actions only.)
|
|
383
|
+
- **additionalFieldsUpdate**: Optional fields (dataErasure, dryRun, etc.).
|
|
384
|
+
|
|
385
|
+
#### Delete Category / Delete By Key
|
|
386
|
+
- **categoryId** or **categoryKey**: ID or key of the category to delete.
|
|
387
|
+
- **version**: Category version (required for deletion).
|
|
388
|
+
- **additionalFieldsDelete**: Optional fields (dataErasure, etc.).
|
|
389
|
+
|
|
390
|
+
Refer to the node UI in n8n for detailed descriptions and validation for each parameter.
|
|
391
|
+
|
|
392
|
+
Below is a sample workflow using the Commercetools node in n8n to create and query a product.
|
|
393
|
+
|
|
394
|
+
### Example: Create a Product
|
|
395
|
+
|
|
396
|
+
1. Add the **Commercetools** node to your workflow.
|
|
397
|
+
2. Select the **Create Product** operation.
|
|
398
|
+
3. Fill in the required product draft fields (e.g., name, slug, product type, etc.).
|
|
399
|
+
4. Select your configured Commercetools credentials.
|
|
400
|
+
5. Run the workflow to create a new product in your Commercetools project.
|
|
401
|
+
|
|
402
|
+
**Sample Input (Product Draft):**
|
|
403
|
+
```json
|
|
404
|
+
{
|
|
405
|
+
"name": { "en": "Sample Product" },
|
|
406
|
+
"slug": { "en": "sample-product" },
|
|
407
|
+
"productType": { "id": "your-product-type-id" },
|
|
408
|
+
"masterVariant": {
|
|
409
|
+
"sku": "SKU123",
|
|
410
|
+
"prices": [ { "value": { "currencyCode": "USD", "centAmount": 1000 } } ]
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
### Example: Query Products
|
|
417
|
+
|
|
418
|
+
1. Add the **Commercetools** node to your workflow.
|
|
419
|
+
2. Select the **Query Products** operation.
|
|
420
|
+
3. Optionally set filters, sorting, and pagination parameters.
|
|
421
|
+
4. Select your configured Commercetools credentials.
|
|
422
|
+
5. Run the workflow to retrieve products from your Commercetools project.
|
|
423
|
+
|
|
424
|
+
**Sample Output:**
|
|
425
|
+
```json
|
|
426
|
+
[
|
|
427
|
+
{
|
|
428
|
+
"id": "product-id-1",
|
|
429
|
+
"name": { "en": "Sample Product" },
|
|
430
|
+
"slug": { "en": "sample-product" }
|
|
431
|
+
// ...other product fields
|
|
432
|
+
}
|
|
433
|
+
// ...more products
|
|
434
|
+
]
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Using updateActions (Product Updates)
|
|
438
|
+
|
|
439
|
+
The `updateActions` fixed collection lets you compose Commercetools product update commands directly in the node UI, with helper inputs for localized data, prices, assets, and variant targeting. Highlights:
|
|
440
|
+
- Choose whether each variant is addressed by `variantId` or `sku`, and mix multiple variant-specific actions in a single request.
|
|
441
|
+
- Localized name/slug/meta helpers automatically map locale/value pairs to the format the Commercetools API expects.
|
|
442
|
+
- Attribute editors support string/number/boolean parsing so you don’t need to pre-format JSON.
|
|
443
|
+
- Asset, price, image, and search keyword builders flatten nested fixed collections (sources, dimensions, tokenizers, etc.) into valid drafts.
|
|
444
|
+
|
|
445
|
+
Supported product update actions:
|
|
446
|
+
- Add Asset
|
|
447
|
+
- Add External Image
|
|
448
|
+
- Add Price
|
|
449
|
+
- Add Product Variant
|
|
450
|
+
- Add To Category
|
|
451
|
+
- Change Asset Name
|
|
452
|
+
- Change Asset Order
|
|
453
|
+
- Change Master Variant
|
|
454
|
+
- Change Name
|
|
455
|
+
- Change Price
|
|
456
|
+
- Change Slug
|
|
457
|
+
- Move Image To Position
|
|
458
|
+
- Publish
|
|
459
|
+
- Remove Asset
|
|
460
|
+
- Remove From Category
|
|
461
|
+
- Remove Image
|
|
462
|
+
- Remove Price
|
|
463
|
+
- Remove Variant
|
|
464
|
+
- Revert Staged Changes
|
|
465
|
+
- Revert Staged Variant Changes
|
|
466
|
+
- Set Asset Custom Field
|
|
467
|
+
- Set Asset Custom Type
|
|
468
|
+
- Set Asset Description
|
|
469
|
+
- Set Asset Key
|
|
470
|
+
- Set Asset Sources
|
|
471
|
+
- Set Asset Tags
|
|
472
|
+
- Set Attribute
|
|
473
|
+
- Set Attribute In All Variants
|
|
474
|
+
- Set Category Order Hint
|
|
475
|
+
- Set Description
|
|
476
|
+
- Set Image Label
|
|
477
|
+
- Set Key
|
|
478
|
+
- Set Meta Description
|
|
479
|
+
- Set Meta Keywords
|
|
480
|
+
- Set Meta Title
|
|
481
|
+
- Set Price Custom Field
|
|
482
|
+
- Set Price Key
|
|
483
|
+
- Set Price Mode
|
|
484
|
+
- Set Prices
|
|
485
|
+
- Set Product Attribute
|
|
486
|
+
- Set Product Price Custom Type
|
|
487
|
+
- Set Product Variant Key
|
|
488
|
+
- Set Search Keywords
|
|
489
|
+
- Set SKU
|
|
490
|
+
- Set Tax Category
|
|
491
|
+
- Transition State
|
|
492
|
+
- Unpublish
|
|
493
|
+
|
|
494
|
+
Need a field that isn’t exposed yet? Add it via the `actions` JSON array—the node merges both sources in request order.
|
|
495
|
+
|
|
496
|
+
> **Transition State note:** the builder enforces that either a state ID or a state key is set per the [Commercetools Transition State action](https://docs.commercetools.com/api/projects/products#transition-state).
|
|
497
|
+
|
|
498
|
+
### Example: Create a Category
|
|
499
|
+
|
|
500
|
+
1. Add the **Commercetools** node to your workflow.
|
|
501
|
+
2. Select the **Create Category** operation.
|
|
502
|
+
3. Fill in the required category draft fields (e.g., name, slug, parent, orderHint, etc.).
|
|
503
|
+
4. Select your configured Commercetools credentials.
|
|
504
|
+
5. Run the workflow to create a new category in your Commercetools project.
|
|
505
|
+
|
|
506
|
+
**Sample Input (Category Draft):**
|
|
507
|
+
```json
|
|
508
|
+
{
|
|
509
|
+
"name": { "en": "Sample Category" },
|
|
510
|
+
"slug": { "en": "sample-category" },
|
|
511
|
+
"orderHint": "0.1"
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### Example: Query Categories
|
|
516
|
+
|
|
517
|
+
1. Add the **Commercetools** node to your workflow.
|
|
518
|
+
2. Select the **Query Categories** operation.
|
|
519
|
+
3. Optionally set filters, sorting, and pagination parameters.
|
|
520
|
+
4. Select your configured Commercetools credentials.
|
|
521
|
+
5. Run the workflow to retrieve categories from your Commercetools project.
|
|
522
|
+
|
|
523
|
+
**Sample Output:**
|
|
524
|
+
```json
|
|
525
|
+
[
|
|
526
|
+
{
|
|
527
|
+
"id": "category-id-1",
|
|
528
|
+
"name": { "en": "Sample Category" },
|
|
529
|
+
"slug": { "en": "sample-category" }
|
|
530
|
+
// ...other category fields
|
|
531
|
+
}
|
|
532
|
+
// ...more categories
|
|
533
|
+
]
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
You can chain Commercetools node operations with other n8n nodes to build advanced workflows for product and category management, automation, and integration.
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
## Credential Setup
|
|
540
|
+
|
|
541
|
+
To use the Commercetools node for both product and category operations, you must configure OAuth2 credentials for your Commercetools project in n8n. Follow these steps:
|
|
542
|
+
|
|
543
|
+
1. **Obtain Commercetools API credentials:**
|
|
544
|
+
- Log in to your Commercetools Merchant Center.
|
|
545
|
+
- Go to the API Clients section and create a new API client.
|
|
546
|
+
- Note the following values:
|
|
547
|
+
- `Client ID`
|
|
548
|
+
- `Client Secret`
|
|
549
|
+
- `Project Key`
|
|
550
|
+
- `Scopes` (ensure you have the required scopes for product and category operations)
|
|
551
|
+
- `Region` (e.g., `australia-southeast1.gcp`)
|
|
552
|
+
|
|
553
|
+
2. **Add credentials in n8n:**
|
|
554
|
+
- In n8n, go to **Credentials** > **Create New**.
|
|
555
|
+
- Search for and select **Commercetools OAuth2 API**.
|
|
556
|
+
- Fill in the required fields:
|
|
557
|
+
- **Client ID**
|
|
558
|
+
- **Client Secret**
|
|
559
|
+
- **Project Key**
|
|
560
|
+
- **Region**
|
|
561
|
+
- **Scopes**
|
|
562
|
+
- **AWS Client ID**
|
|
563
|
+
- **AWS Client Secret**
|
|
564
|
+
- The AWS fields map to your access key pair and are required for webhook/SQS delivery paths.
|
|
565
|
+
- Save the credentials.
|
|
566
|
+
|
|
567
|
+
3. **Use credentials in your workflow:**
|
|
568
|
+
- When adding the Commercetools node to your workflow, select the credentials you just created from the credentials dropdown.
|
|
569
|
+
|
|
570
|
+
Your Commercetools node is now authenticated and ready to use for both product and category operations in n8n workflows.
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
## Features & Supported Operations
|
|
574
|
+
|
|
575
|
+
The Commercetools node for n8n enables you to interact with the Commercetools API for product and category management. The following operations are supported:
|
|
576
|
+
|
|
577
|
+
### Product Operations
|
|
578
|
+
- **Create Product**
|
|
579
|
+
Create a new product in your Commercetools project.
|
|
580
|
+
|
|
581
|
+
- **Query Products**
|
|
582
|
+
Retrieve a list of products with support for pagination, sorting, filtering, and predicate variables.
|
|
583
|
+
|
|
584
|
+
- **Search Products**
|
|
585
|
+
Perform advanced product searches using the Commercetools search endpoint.
|
|
586
|
+
|
|
587
|
+
- **Get Product (by ID or Key)**
|
|
588
|
+
Retrieve detailed information for a specific product by its ID or key.
|
|
589
|
+
|
|
590
|
+
- **Update Product (by ID or Key)**
|
|
591
|
+
Update an existing product using one or more update actions. The `updateActions` UI builder now mirrors Commercetools’ product update catalog, including localized content helpers, price/asset editors, search keyword builders, and state transitions.
|
|
592
|
+
|
|
593
|
+
- **Delete Product (by ID or Key)**
|
|
594
|
+
Delete a product from your project.
|
|
595
|
+
|
|
596
|
+
- **Query Product Selections (by ID or Key)**
|
|
597
|
+
Retrieve product selection assignments for a product.
|
|
598
|
+
|
|
599
|
+
- **Upload Product Image**
|
|
600
|
+
Upload an image to a product, either from binary data or an external URL.
|
|
601
|
+
|
|
602
|
+
### Category Operations
|
|
603
|
+
- **Create Category**
|
|
604
|
+
Create a new category in your Commercetools project.
|
|
605
|
+
|
|
606
|
+
- **Query Categories**
|
|
607
|
+
Retrieve a list of categories with support for pagination, sorting, and filtering.
|
|
608
|
+
|
|
609
|
+
- **Get Category (by ID or Key)**
|
|
610
|
+
Retrieve detailed information for a specific category by its ID or key.
|
|
611
|
+
|
|
612
|
+
- **Update Category (by ID or Key)**
|
|
613
|
+
Update an existing category using one or more update actions. (Categories currently require JSON-based `actions`.)
|
|
614
|
+
|
|
615
|
+
- **Delete Category (by ID or Key)**
|
|
616
|
+
Delete a category from your project.
|
|
617
|
+
|
|
618
|
+
### Check Product & Category Existence
|
|
619
|
+
- **By ID:** Use the "HEAD" operation with a product or category ID to check if it exists.
|
|
620
|
+
- **By Key:** Use the "HEAD by Key" operation with a product or category key.
|
|
621
|
+
- **By Query:** Use the "HEAD by Query" operation to check if any product or category matches a specific query.
|
|
622
|
+
|
|
623
|
+
Each operation supports additional parameters for fine-tuned control, such as staged changes, data erasure, dry run, and more.
|
|
624
|
+
|
|
625
|
+
## What's Included
|
|
626
|
+
|
|
627
|
+
- **Commercetools Node**: Located in `nodes/Commercetools/`, this node provides operations for interacting with the Commercetools API, including product management and authentication via OAuth2.
|
|
628
|
+
- **Credentials**: OAuth2 credentials for Commercetools in `credentials/CommerceToolsOAuth2Api.credentials.ts`.
|
|
629
|
+
- **Utilities and Descriptions**: Helper functions and operation definitions for Commercetools API requests.
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
## Prerequisites
|
|
634
|
+
|
|
635
|
+
- **[Node.js](https://nodejs.org/)** (v22 or higher) and npm
|
|
636
|
+
- **[git](https://git-scm.com/downloads)**
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
## Usage
|
|
640
|
+
|
|
641
|
+
1. **Install dependencies**
|
|
642
|
+
```bash
|
|
643
|
+
npm install
|
|
644
|
+
```
|
|
645
|
+
2. **Start development server**
|
|
646
|
+
```bash
|
|
647
|
+
npm run dev
|
|
648
|
+
```
|
|
649
|
+
This will build the node and launch n8n locally with hot reload enabled. Access n8n at [http://localhost:5678](http://localhost:5678).
|
|
650
|
+
3. **Configure Commercetools credentials**
|
|
651
|
+
- Go to n8n's credentials section and add your Commercetools OAuth2 credentials.
|
|
652
|
+
4. **Use the Commercetools node in your workflow**
|
|
653
|
+
- Add the Commercetools node to your workflow and select the desired operation (e.g., product management).
|
|
654
|
+
- For product updates, use the `updateActions` builder to stack multiple actions (or combine with `actions` JSON for edge cases).
|
|
655
|
+
5. **Lint and build**
|
|
656
|
+
- Lint: `npm run lint`
|
|
657
|
+
- Auto-fix: `npm run lint:fix`
|
|
658
|
+
- Build: `npm run build`
|
|
659
|
+
6. **Publish**
|
|
660
|
+
- When ready, publish your package to npm:
|
|
661
|
+
```bash
|
|
662
|
+
npm publish
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
## Available Scripts
|
|
667
|
+
|
|
668
|
+
| Script | Description |
|
|
669
|
+
| --------------------- | ---------------------------------------------------------------- |
|
|
670
|
+
| `npm run dev` | Start n8n with the Commercetools node and watch for changes |
|
|
671
|
+
| `npm run build` | Compile TypeScript to JavaScript for production |
|
|
672
|
+
| `npm run build:watch` | Build in watch mode (auto-rebuild on changes) |
|
|
673
|
+
| `npm run lint` | Check your code for errors and style issues |
|
|
674
|
+
| `npm run lint:fix` | Automatically fix linting issues when possible |
|
|
675
|
+
| `npm run release` | Create a new release |
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
## Error Handling & Troubleshooting
|
|
681
|
+
|
|
682
|
+
Here are common errors and troubleshooting tips for the Commercetools node (products and categories):
|
|
683
|
+
|
|
684
|
+
- **Authentication Errors:**
|
|
685
|
+
- Ensure your OAuth2 credentials (Client ID, Client Secret, Project Key, Region, Scopes) are correct and have the required permissions.
|
|
686
|
+
- If you see an authentication error, re-authorize or recreate your credentials in n8n.
|
|
687
|
+
|
|
688
|
+
- **Missing or Invalid Parameters:**
|
|
689
|
+
- Double-check required fields for each operation:
|
|
690
|
+
- For products: productDraft, productId/productKey, version, etc.
|
|
691
|
+
- For categories: categoryDraft, categoryId/categoryKey, version, etc.
|
|
692
|
+
- The node will display a clear error if a required parameter is missing or invalid.
|
|
693
|
+
|
|
694
|
+
- **API Errors:**
|
|
695
|
+
- Errors from the Commercetools API (e.g., 404 Not Found, 400 Bad Request) will be shown in the node output or n8n error panel.
|
|
696
|
+
- Review the error message for details and check your input data.
|
|
697
|
+
|
|
698
|
+
- **Not Found (Product/Category):**
|
|
699
|
+
- For get, update, delete, or existence checks, ensure the productId/productKey or categoryId/categoryKey is correct and the item exists in your project.
|
|
700
|
+
|
|
701
|
+
- **Version Mismatch:**
|
|
702
|
+
- For update and delete operations, the version must match the current version in Commercetools. Retrieve the latest version before updating or deleting (applies to both products and categories).
|
|
703
|
+
|
|
704
|
+
- **Binary Data Issues (Image Upload):**
|
|
705
|
+
- Ensure the binary property name matches the uploaded file and the file is present in the workflow (product image upload only).
|
|
706
|
+
|
|
707
|
+
- **General Node Issues:**
|
|
708
|
+
- If the node does not appear in n8n, ensure dependencies are installed, the node is registered in `package.json`, and the dev server is running.
|
|
709
|
+
- Check the n8n console and logs for error details.
|
|
710
|
+
|
|
711
|
+
For linting or TypeScript errors, use the provided scripts or consult the [n8n node development guidelines](https://docs.n8n.io/integrations/creating-nodes/).
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
## Resources
|
|
715
|
+
|
|
716
|
+
- **[n8n Node Documentation](https://docs.n8n.io/integrations/creating-nodes/)**
|
|
717
|
+
- **[n8n Community Forum](https://community.n8n.io/)**
|
|
718
|
+
- **[@n8n/node-cli Documentation](https://www.npmjs.com/package/@n8n/node-cli)**
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
## Contributing
|
|
722
|
+
|
|
723
|
+
Contributions and suggestions for improving the Commercetools node are welcome. Please open an issue or submit a pull request.
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
## Changelog
|
|
728
|
+
|
|
729
|
+
All notable changes to this project will be documented in the `CHANGELOG.md` file. Below is a summary of recent updates:
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
### [Unreleased]
|
|
733
|
+
- Added Commercetools webhook-based product trigger plus AWS automation/test guides
|
|
734
|
+
- Added AWS credential fields (client ID/secret) and environment-driven webhook URL support for trigger delivery
|
|
735
|
+
- Documented AWS deployment automation and attribute references for the CloudFormation scripts
|
|
736
|
+
- Refactored Commercetools product, category, and customer property definitions for easier maintenance
|
|
737
|
+
|
|
738
|
+
### v1.0.0
|
|
739
|
+
- Initial release of the Commercetools node for n8n
|
|
740
|
+
- Supports product management operations: create, query, search, get, update, delete, product selections, image upload, and existence checks
|
|
741
|
+
- OAuth2 credential integration
|
|
742
|
+
|
|
743
|
+
Refer to `CHANGELOG.md` for a complete version history and details.
|
|
744
|
+
|
|
745
|
+
## License
|
|
746
|
+
|
|
747
|
+
[MIT](LICENSE.md)
|