n8n-nodes-clientify 0.1.4 → 0.2.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.
@@ -0,0 +1,5 @@
1
+ import { IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
2
+ export declare class ClientifyMcpTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
5
+ }
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientifyMcpTrigger = void 0;
4
+ class ClientifyMcpTrigger {
5
+ constructor() {
6
+ this.description = {
7
+ displayName: 'Clientify Trigger',
8
+ name: 'clientifyMcpTrigger',
9
+ icon: 'file:clientify.svg',
10
+ group: ['trigger'],
11
+ version: 1,
12
+ subtitle: '={{$parameter["event"]}}',
13
+ description: 'Starts workflow when Clientify CRM events occur',
14
+ defaults: {
15
+ name: 'Clientify Trigger',
16
+ },
17
+ inputs: [],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
+ credentials: [
20
+ {
21
+ name: 'clientifyMcpApi',
22
+ required: true,
23
+ },
24
+ ],
25
+ webhooks: [
26
+ {
27
+ name: 'default',
28
+ httpMethod: 'POST',
29
+ responseMode: 'onReceived',
30
+ path: 'webhook',
31
+ },
32
+ ],
33
+ properties: [
34
+ {
35
+ displayName: 'Event',
36
+ name: 'event',
37
+ type: 'options',
38
+ required: true,
39
+ default: 'contact.created',
40
+ description: 'The Clientify event that will trigger this workflow',
41
+ options: [
42
+ // Company Events
43
+ {
44
+ name: 'Company Created',
45
+ value: 'company.created',
46
+ description: 'Triggers when a new company is created in Clientify',
47
+ },
48
+ {
49
+ name: 'Company Deleted',
50
+ value: 'company.deleted',
51
+ description: 'Triggers when a company is deleted from Clientify',
52
+ },
53
+ {
54
+ name: 'Company Updated',
55
+ value: 'company.updated',
56
+ description: 'Triggers when a company is updated in Clientify',
57
+ },
58
+ // Contact Events
59
+ {
60
+ name: 'Contact Created',
61
+ value: 'contact.created',
62
+ description: 'Triggers when a new contact is created in Clientify',
63
+ },
64
+ {
65
+ name: 'Contact Deleted',
66
+ value: 'contact.deleted',
67
+ description: 'Triggers when a contact is deleted from Clientify',
68
+ },
69
+ {
70
+ name: 'Contact Updated',
71
+ value: 'contact.updated',
72
+ description: 'Triggers when a contact is updated in Clientify',
73
+ },
74
+ // Deal Events
75
+ {
76
+ name: 'Deal Created',
77
+ value: 'deal.created',
78
+ description: 'Triggers when a new deal is created in Clientify',
79
+ },
80
+ {
81
+ name: 'Deal Deleted',
82
+ value: 'deal.deleted',
83
+ description: 'Triggers when a deal is deleted from Clientify',
84
+ },
85
+ {
86
+ name: 'Deal Lost',
87
+ value: 'deal.lost',
88
+ description: 'Triggers when a deal is marked as lost',
89
+ },
90
+ {
91
+ name: 'Deal Stage Changed',
92
+ value: 'deal.stage_changed',
93
+ description: 'Triggers when a deal moves to a different stage',
94
+ },
95
+ {
96
+ name: 'Deal Updated',
97
+ value: 'deal.updated',
98
+ description: 'Triggers when a deal is updated in Clientify',
99
+ },
100
+ {
101
+ name: 'Deal Won',
102
+ value: 'deal.won',
103
+ description: 'Triggers when a deal is marked as won',
104
+ },
105
+ // Task Events
106
+ {
107
+ name: 'Task Completed',
108
+ value: 'task.completed',
109
+ description: 'Triggers when a task is marked as completed',
110
+ },
111
+ {
112
+ name: 'Task Created',
113
+ value: 'task.created',
114
+ description: 'Triggers when a new task is created in Clientify',
115
+ },
116
+ {
117
+ name: 'Task Due Soon',
118
+ value: 'task.due_soon',
119
+ description: 'Triggers when a task is approaching its due date',
120
+ },
121
+ {
122
+ name: 'Task Overdue',
123
+ value: 'task.overdue',
124
+ description: 'Triggers when a task is overdue',
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ };
130
+ }
131
+ async webhook() {
132
+ var _a, _b, _c, _d, _e, _f, _g;
133
+ const req = this.getRequestObject();
134
+ const event = this.getNodeParameter('event');
135
+ // Get webhook payload from request body
136
+ const payload = req.body;
137
+ // Validate that we received a payload
138
+ if (!payload || typeof payload !== 'object') {
139
+ return {
140
+ workflowData: [],
141
+ };
142
+ }
143
+ // Validate that the event matches what user configured
144
+ // If events don't match, don't trigger the workflow
145
+ if (payload.event !== event) {
146
+ return {
147
+ workflowData: [],
148
+ };
149
+ }
150
+ // Extract and flatten data based on event type for easier access in workflows
151
+ let workflowData = {
152
+ event: payload.event,
153
+ timestamp: payload.timestamp,
154
+ };
155
+ // Add account and user info if present
156
+ if (payload.account_id) {
157
+ workflowData.account_id = payload.account_id;
158
+ }
159
+ if (payload.user_id) {
160
+ workflowData.user_id = payload.user_id;
161
+ }
162
+ // Flatten the nested data structure based on event type
163
+ if (payload.event.startsWith('contact.')) {
164
+ // Contact events
165
+ if ((_a = payload.data) === null || _a === void 0 ? void 0 : _a.contact) {
166
+ workflowData = Object.assign(Object.assign(Object.assign({}, workflowData), { contact_id: payload.data.contact.id }), payload.data.contact);
167
+ }
168
+ // Include changes for update events
169
+ if ((_b = payload.data) === null || _b === void 0 ? void 0 : _b.changes) {
170
+ workflowData.changes = payload.data.changes;
171
+ }
172
+ }
173
+ else if (payload.event.startsWith('company.')) {
174
+ // Company events
175
+ if ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.company) {
176
+ workflowData = Object.assign(Object.assign(Object.assign({}, workflowData), { company_id: payload.data.company.id }), payload.data.company);
177
+ }
178
+ // Include changes for update events
179
+ if ((_d = payload.data) === null || _d === void 0 ? void 0 : _d.changes) {
180
+ workflowData.changes = payload.data.changes;
181
+ }
182
+ }
183
+ else if (payload.event.startsWith('deal.')) {
184
+ // Deal events
185
+ if ((_e = payload.data) === null || _e === void 0 ? void 0 : _e.deal) {
186
+ workflowData = Object.assign(Object.assign(Object.assign({}, workflowData), { deal_id: payload.data.deal.id }), payload.data.deal);
187
+ }
188
+ // Include changes for update events
189
+ if ((_f = payload.data) === null || _f === void 0 ? void 0 : _f.changes) {
190
+ workflowData.changes = payload.data.changes;
191
+ }
192
+ }
193
+ else if (payload.event.startsWith('task.')) {
194
+ // Task events
195
+ if ((_g = payload.data) === null || _g === void 0 ? void 0 : _g.task) {
196
+ workflowData = Object.assign(Object.assign(Object.assign({}, workflowData), { task_id: payload.data.task.id }), payload.data.task);
197
+ }
198
+ }
199
+ // Keep the original raw payload for advanced users who need it
200
+ workflowData._raw = payload;
201
+ // Return the data that will be passed to the workflow
202
+ return {
203
+ workflowData: [
204
+ [
205
+ {
206
+ json: workflowData,
207
+ },
208
+ ],
209
+ ],
210
+ };
211
+ }
212
+ }
213
+ exports.ClientifyMcpTrigger = ClientifyMcpTrigger;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-clientify",
3
- "version": "0.1.4",
3
+ "version": "0.2.1",
4
4
  "description": "N8N node for Clientify CRM integration",
5
5
  "keywords": [
6
6
  "n8n-node",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "main": "index.js",
25
25
  "scripts": {
26
- "build": "rm -rf dist && tsc && cp package.json dist/ && cp nodes/ClientifyMcp/*.png dist/nodes/ClientifyMcp/ 2>/dev/null || true && cp nodes/ClientifyMcp/*.svg dist/nodes/ClientifyMcp/ 2>/dev/null || true",
26
+ "build": "rm -rf dist && tsc && cp package.json dist/ && cp README.md dist/ && cp TRIGGERS_REFERENCE.md dist/ && cp nodes/ClientifyMcp/*.png dist/nodes/ClientifyMcp/ 2>/dev/null || true && cp nodes/ClientifyMcp/*.svg dist/nodes/ClientifyMcp/ 2>/dev/null || true",
27
27
  "dev": "tsc --watch",
28
28
  "lint": "eslint nodes credentials --ext .ts",
29
29
  "lintfix": "eslint nodes credentials --ext .ts --fix",
@@ -38,7 +38,8 @@
38
38
  "dist/credentials/ClientifyMcpApi.credentials.js"
39
39
  ],
40
40
  "nodes": [
41
- "dist/nodes/ClientifyMcp/ClientifyMcpDynamic.node.js"
41
+ "dist/nodes/ClientifyMcp/ClientifyMcpDynamic.node.js",
42
+ "dist/nodes/ClientifyMcp/ClientifyMcpTrigger.node.js"
42
43
  ]
43
44
  },
44
45
  "devDependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-clientify",
3
- "version": "0.1.4",
3
+ "version": "0.2.1",
4
4
  "description": "N8N node for Clientify CRM integration",
5
5
  "keywords": [
6
6
  "n8n-node",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "main": "index.js",
25
25
  "scripts": {
26
- "build": "rm -rf dist && tsc && cp package.json dist/ && cp nodes/ClientifyMcp/*.png dist/nodes/ClientifyMcp/ 2>/dev/null || true && cp nodes/ClientifyMcp/*.svg dist/nodes/ClientifyMcp/ 2>/dev/null || true",
26
+ "build": "rm -rf dist && tsc && cp package.json dist/ && cp README.md dist/ && cp TRIGGERS_REFERENCE.md dist/ && cp nodes/ClientifyMcp/*.png dist/nodes/ClientifyMcp/ 2>/dev/null || true && cp nodes/ClientifyMcp/*.svg dist/nodes/ClientifyMcp/ 2>/dev/null || true",
27
27
  "dev": "tsc --watch",
28
28
  "lint": "eslint nodes credentials --ext .ts",
29
29
  "lintfix": "eslint nodes credentials --ext .ts --fix",
@@ -38,7 +38,8 @@
38
38
  "dist/credentials/ClientifyMcpApi.credentials.js"
39
39
  ],
40
40
  "nodes": [
41
- "dist/nodes/ClientifyMcp/ClientifyMcpDynamic.node.js"
41
+ "dist/nodes/ClientifyMcp/ClientifyMcpDynamic.node.js",
42
+ "dist/nodes/ClientifyMcp/ClientifyMcpTrigger.node.js"
42
43
  ]
43
44
  },
44
45
  "devDependencies": {