n8n-nodes-didar-crm 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,35 +1,60 @@
1
1
  # n8n-nodes-didar-crm
2
2
 
3
- Custom **n8n nodes** for integrating with **Didar CRM**.
3
+ Custom **n8n nodes** for integrating with **Didar CRM**.
4
4
  This package provides actions and triggers to automate workflows with your Didar CRM account.
5
5
 
6
6
  ---
7
7
 
8
8
  ## ✨ Features
9
9
 
10
- * **Trigger**
10
+ ### Trigger
11
+ - **Didar CRM Trigger** → receive webhook events for entity changes, updates, deletions.
11
12
 
12
- * Receive webhook events from Didar CRM (entity changes, updates, deletions, etc.)
13
+ ### Deal
14
+ - Create a deal
15
+ - Update a deal (by Id)
16
+ - Get deal details (by Id)
13
17
 
14
- * **Deal**
18
+ ### Person (Contact)
19
+ - Create a person
20
+ - Update a person (by Id)
21
+ - Get person details (by Id)
15
22
 
16
- * Create a deal
17
- * Update a deal (by Id)
18
- * Get deal details (by Id)
23
+ ### Company
24
+ - Create a company
25
+ - Update a company (by Id)
26
+ - Get company details (by Id)
19
27
 
20
- * **Person (Contact)**
28
+ ### Activity
29
+ - Create an activity
30
+ - Update an activity (by Id)
21
31
 
22
- * Create a person
23
- * Update a person (by Id)
24
- * Get person details (by Id)
32
+ ### Note
33
+ - Create a note
34
+ - Update a note (by Id)
25
35
 
26
- * **Common**
36
+ ### Case (Card)
37
+ - Create a case
38
+ - Update a case (by Id)
27
39
 
28
- * Dropdown selectors for Pipelines, Pipeline Stages, Owners (Users)
29
- * Manual ID input option for each dropdown field
30
- * Support for additional fields like Source, Lost Reason, Visibility Type, Custom Fields, etc.
31
- * Proper handling of default values (zero-guid where needed)
32
- * Webhook trigger enforces POST requests
40
+ ### Product
41
+ - Create a product
42
+ - Update a product (by Id)
43
+ - Get products by list of codes
44
+
45
+ ---
46
+
47
+ ## 🧩 Common Features
48
+
49
+ - Dropdown selectors for Pipelines, Owners (Users), Activity Types, Product Categories, etc.
50
+ - Manual ID input option for each dropdown field
51
+ - Additional fields for advanced properties:
52
+ - Visibility Type
53
+ - Custom Fields (JSON)
54
+ - Multi-value lists (phones, emails, websites, addresses, bank accounts, labels, users)
55
+ - Correct handling of defaults (zero GUIDs, booleans, etc.)
56
+ - Webhook trigger enforces **POST** requests only
57
+ - Consistent **Owner selection mechanism** (select from list or manual ID) across all resources
33
58
 
34
59
  ---
35
60
 
@@ -39,41 +64,61 @@ This package provides actions and triggers to automate workflows with your Didar
39
64
  npm install n8n-nodes-didar-crm
40
65
  ```
41
66
 
42
- Then, place the module inside your n8n custom directory (usually `~/.n8n/custom/`) and restart n8n.
67
+ Place the module inside your n8n custom directory (usually `~/.n8n/custom/`) and restart n8n.
43
68
 
44
69
  ---
45
70
 
46
71
  ## ⚡ Usage
47
72
 
48
73
  ### 1. Trigger node
49
-
50
74
  Add the **Didar CRM Trigger** node to your workflow.
75
+ - Exposes a webhook URL in n8n
76
+ - Accepts **POST** requests only
77
+ - Returns structured payload:
78
+
79
+ ```json
80
+ {
81
+ "data": { ... },
82
+ "changes": [ ... ],
83
+ "meta": { ... },
84
+ "raw": { ... },
85
+ "receivedAt": "timestamp"
86
+ }
87
+ ```
88
+
89
+ ### 2. Resource operations
90
+
91
+ #### Deal
92
+ - **Create** → required fields: `Title`, `OwnerId`, `PipelineId`, `PipelineStageId`
93
+ - **Update** → same as create + `Id`
94
+ - **Get** → requires `Id`
51
95
 
52
- * It exposes a webhook URL in n8n.
53
- * Only **POST** requests are accepted.
54
- * Returns payload structured into:
96
+ #### Person (Contact)
97
+ - **Create** required fields: `LastName`, `OwnerId`
98
+ - **Update** same as create + `Id`
99
+ - **Get** → requires `Id`
55
100
 
56
- ```json
57
- {
58
- "data": { ... },
59
- "changes": [ ... ],
60
- "meta": { ... },
61
- "raw": { ... },
62
- "receivedAt": "timestamp"
63
- }
64
- ```
101
+ #### Company
102
+ - **Create** → required fields: `Name`, `OwnerId`
103
+ - **Update** same as create + `Id`
104
+ - **Get** requires `Id`
65
105
 
66
- ### 2. Deal operations
106
+ #### Activity
107
+ - **Create Activity** → required fields: `Title`, `OwnerId`, `ActivityTypeId`
108
+ - **Update Activity** → same as create + `Id`
67
109
 
68
- * **Create Deal** → required fields: `Title`, `OwnerId`, `PipelineId`, `PipelineStageId`, `PersonId`, `CompanyId`, `Status`
69
- * **Update Deal** → same as Create, plus required `Id`
70
- * **Get Deal** → requires `Id`
110
+ #### Note
111
+ - **Create Note** → required fields: `ResultNote`, `OwnerId`
112
+ - **Update Note** → same as create + `Id`
71
113
 
72
- ### 3. Person (Contact) operations
114
+ #### Case (Card)
115
+ - **Create Case** → required fields: `Title`, `OwnerId`, `PipelineStageId`, `Status`
116
+ - **Update Case** → same as create + `Id`
73
117
 
74
- * **Create Person** → required fields: `LastName`, `OwnerId`
75
- * **Update Person** → same as Create, plus required `Id`
76
- * **Get Person** → requires `Id`
118
+ #### Product
119
+ - **Create Product** → required fields: `Title`
120
+ - **Update Product** → same as create + `Id`
121
+ - **Get Products by Codes** → required field: `Code[]` (one or more codes)
77
122
 
78
123
  ---
79
124
 
@@ -81,8 +126,8 @@ Add the **Didar CRM Trigger** node to your workflow.
81
126
 
82
127
  A new credential type **Didar API** is provided.
83
128
 
84
- * You must set your **API Key** and (if required) authentication cookies.
85
- * Used across all operations.
129
+ - Set your **API Key** and (if required) authentication cookies.
130
+ - Shared across all nodes.
86
131
 
87
132
  ---
88
133
 
@@ -94,19 +139,18 @@ n8n-nodes-didar-crm/
94
139
  │── README.md
95
140
  │── LICENSE
96
141
  │── nodes/
97
- │ ├── DidarCrm.node.ts # Main entry for resource & operation switch
142
+ │ ├── DidarCrm.node.ts # Main entry for resources & operations
98
143
  │ ├── DidarCrmTrigger.node.ts # Trigger node
99
- └── deal/ # Deal operations
100
- ├── create.operation.ts
101
- ├── update.operation.ts
102
- └── get.operation.ts
103
- └── person/ # Person operations
104
- ├── create.operation.ts
105
- ├── update.operation.ts
106
- │ └── get.operation.ts
144
+ ├── deal/ # Deal operations
145
+ ├── person/ # Person operations
146
+ ├── company/ # Company operations
147
+ ├── activity/ # Activity operations
148
+ ├── note/ # Note operations
149
+ ├── case/ # Case operations
150
+ └── product/ # Product operations
107
151
  │── lib/
108
- ├── http.ts # Request helper
109
- └── loadOptions.ts # Dropdown population (pipelines, stages, users)
152
+ ├── http.ts # Request helper
153
+ └── loadOptions.ts # Dropdown population
110
154
  ```
111
155
 
112
156
  ---
@@ -124,7 +168,7 @@ n8n-nodes-didar-crm/
124
168
  ```bash
125
169
  npm run build
126
170
  ```
127
- 4. Link into your n8n custom directory and restart n8n:
171
+ 4. Link into your n8n custom directory and restart:
128
172
 
129
173
  ```bash
130
174
  npm link
@@ -122,8 +122,8 @@ class DidarCrm {
122
122
  displayOptions: { show: { resource: ['company'] } },
123
123
  options: [
124
124
  { name: 'Create', value: 'create', action: 'Create a company' },
125
- { name: 'Update', value: 'update', action: 'Update a company by Id' }, // NEW
126
- { name: 'Get', value: 'get', action: 'Get a company by Id' }, // NEW
125
+ { name: 'Update', value: 'update', action: 'Update a company by Id' },
126
+ { name: 'Get', value: 'get', action: 'Get a company by Id' },
127
127
  ],
128
128
  default: 'create',
129
129
  description: 'Select the action to perform on the selected resource.',
@@ -135,7 +135,7 @@ class DidarCrm {
135
135
  displayOptions: { show: { resource: ['activity'] } },
136
136
  options: [
137
137
  { name: 'Create', value: 'create', action: 'Create an activity' },
138
- { name: 'Update', value: 'update', action: 'Update an activity by Id' }, // NEW
138
+ { name: 'Update', value: 'update', action: 'Update an activity by Id' },
139
139
  ],
140
140
  default: 'create',
141
141
  description: 'Select the action to perform on the selected resource.',
@@ -172,6 +172,7 @@ class DidarCrm {
172
172
  options: [
173
173
  { name: 'Create', value: 'create', action: 'Create a product' },
174
174
  { name: 'Update', value: 'update', action: 'Update a product by ID' },
175
+ { name: 'Get by Codes', value: 'getByCodes', action: 'Get products by list of codes' },
175
176
  ],
176
177
  default: 'create',
177
178
  description: 'Select the action to perform on the selected resource.',
@@ -200,6 +201,7 @@ class DidarCrm {
200
201
  // Product properties (imported)
201
202
  ...product_1.productCreateProperties,
202
203
  ...product_1.productUpdateProperties,
204
+ ...product_1.productGetByCodesProperties,
203
205
  ],
204
206
  };
205
207
  }
@@ -245,11 +247,11 @@ class DidarCrm {
245
247
  if (operation === 'update') {
246
248
  await CompanyOps.companyUpdate.call(this, i, returnData);
247
249
  continue;
248
- } // NEW
250
+ }
249
251
  if (operation === 'get') {
250
252
  await CompanyOps.companyGet.call(this, i, returnData);
251
253
  continue;
252
- } // NEW
254
+ }
253
255
  }
254
256
  if (resource === 'activity') {
255
257
  if (operation === 'create') {
@@ -259,7 +261,7 @@ class DidarCrm {
259
261
  if (operation === 'update') {
260
262
  await ActivityOps.activityUpdate.call(this, i, returnData);
261
263
  continue;
262
- } // NEW
264
+ }
263
265
  }
264
266
  if (resource === 'note') {
265
267
  if (operation === 'create') {
@@ -289,7 +291,11 @@ class DidarCrm {
289
291
  if (operation === 'update') {
290
292
  await ProductOps.productUpdate.call(this, i, returnData);
291
293
  continue;
292
- } // NEW
294
+ }
295
+ if (operation === 'getByCodes') {
296
+ await ProductOps.productGetByCodes.call(this, i, returnData);
297
+ continue;
298
+ }
293
299
  }
294
300
  }
295
301
  return [returnData];
@@ -5,7 +5,7 @@ var create_operation_1 = require("./create.operation");
5
5
  Object.defineProperty(exports, "activityCreate", { enumerable: true, get: function () { return create_operation_1.activityCreate; } });
6
6
  var create_properties_1 = require("./create.properties");
7
7
  Object.defineProperty(exports, "activityCreateProperties", { enumerable: true, get: function () { return create_properties_1.activityCreateProperties; } });
8
- var update_operation_1 = require("./update.operation"); // NEW
8
+ var update_operation_1 = require("./update.operation");
9
9
  Object.defineProperty(exports, "activityUpdate", { enumerable: true, get: function () { return update_operation_1.activityUpdate; } });
10
- var update_properties_1 = require("./update.properties"); // NEW
10
+ var update_properties_1 = require("./update.properties");
11
11
  Object.defineProperty(exports, "activityUpdateProperties", { enumerable: true, get: function () { return update_properties_1.activityUpdateProperties; } });
@@ -9,7 +9,7 @@ var update_operation_1 = require("./update.operation");
9
9
  Object.defineProperty(exports, "companyUpdate", { enumerable: true, get: function () { return update_operation_1.companyUpdate; } });
10
10
  var update_properties_1 = require("./update.properties");
11
11
  Object.defineProperty(exports, "companyUpdateProperties", { enumerable: true, get: function () { return update_properties_1.companyUpdateProperties; } });
12
- var get_operation_1 = require("./get.operation"); // NEW
12
+ var get_operation_1 = require("./get.operation");
13
13
  Object.defineProperty(exports, "companyGet", { enumerable: true, get: function () { return get_operation_1.companyGet; } });
14
- var get_properties_1 = require("./get.properties"); // NEW
14
+ var get_properties_1 = require("./get.properties");
15
15
  Object.defineProperty(exports, "companyGetProperties", { enumerable: true, get: function () { return get_properties_1.companyGetProperties; } });
@@ -0,0 +1,2 @@
1
+ import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ export declare function productGetByCodes(this: IExecuteFunctions, i: number, returnData: INodeExecutionData[]): Promise<INodeExecutionData[]>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productGetByCodes = productGetByCodes;
4
+ const http_1 = require("../../lib/http");
5
+ async function productGetByCodes(i, returnData) {
6
+ var _a;
7
+ // Read & normalize codes
8
+ const raw = this.getNodeParameter('Code', i, []);
9
+ const toArray = (v) => Array.isArray(v) ? v : (typeof v === 'string' && v ? [v] : []);
10
+ const codes = toArray(raw).map(s => (s !== null && s !== void 0 ? s : '').toString().trim()).filter(Boolean);
11
+ if (!codes.length)
12
+ throw new Error('At least one product code is required.');
13
+ const body = { Code: codes };
14
+ const resp = await (0, http_1.didarRequest)(this, i, {
15
+ method: 'POST',
16
+ path: '/api/product/getproductbycodes',
17
+ body,
18
+ });
19
+ // API returns { Response: { Total, Products: [...] } }
20
+ const out = ((_a = resp === null || resp === void 0 ? void 0 : resp.Response) !== null && _a !== void 0 ? _a : resp);
21
+ returnData.push({ json: out });
22
+ return returnData;
23
+ }
@@ -0,0 +1,2 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const productGetByCodesProperties: INodeProperties[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productGetByCodesProperties = void 0;
4
+ const showForProductGetByCodes = { show: { resource: ['product'], operation: ['getByCodes'] } };
5
+ exports.productGetByCodesProperties = [
6
+ {
7
+ displayName: 'Codes',
8
+ name: 'Code',
9
+ type: 'string',
10
+ typeOptions: { multipleValues: true }, // n8n → string[]
11
+ default: [],
12
+ required: true,
13
+ displayOptions: showForProductGetByCodes,
14
+ description: 'List of product codes (at least one).',
15
+ },
16
+ ];
@@ -2,3 +2,5 @@ export { productCreate } from './create.operation';
2
2
  export { productCreateProperties } from './create.properties';
3
3
  export { productUpdate } from './update.operation';
4
4
  export { productUpdateProperties } from './update.properties';
5
+ export { productGetByCodes } from './getByCodes.operation';
6
+ export { productGetByCodesProperties } from './getByCodes.properties';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.productUpdateProperties = exports.productUpdate = exports.productCreateProperties = exports.productCreate = void 0;
3
+ exports.productGetByCodesProperties = exports.productGetByCodes = exports.productUpdateProperties = exports.productUpdate = exports.productCreateProperties = exports.productCreate = void 0;
4
4
  // nodes/product/index.ts
5
5
  var create_operation_1 = require("./create.operation");
6
6
  Object.defineProperty(exports, "productCreate", { enumerable: true, get: function () { return create_operation_1.productCreate; } });
@@ -10,3 +10,7 @@ var update_operation_1 = require("./update.operation");
10
10
  Object.defineProperty(exports, "productUpdate", { enumerable: true, get: function () { return update_operation_1.productUpdate; } });
11
11
  var update_properties_1 = require("./update.properties");
12
12
  Object.defineProperty(exports, "productUpdateProperties", { enumerable: true, get: function () { return update_properties_1.productUpdateProperties; } });
13
+ var getByCodes_operation_1 = require("./getByCodes.operation");
14
+ Object.defineProperty(exports, "productGetByCodes", { enumerable: true, get: function () { return getByCodes_operation_1.productGetByCodes; } });
15
+ var getByCodes_properties_1 = require("./getByCodes.properties");
16
+ Object.defineProperty(exports, "productGetByCodesProperties", { enumerable: true, get: function () { return getByCodes_properties_1.productGetByCodesProperties; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-didar-crm",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Didar CRM nodes for n8n (Trigger + Deal.create)",
5
5
  "author": "You",
6
6
  "license": "MIT",