n8n-nodes-chatflow 1.1.1 → 1.1.4

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.
@@ -2,16 +2,8 @@ class ChatflowApi {
2
2
  constructor() {
3
3
  this.name = 'chatflowApi';
4
4
  this.displayName = 'Chatflow API';
5
- this.documentationUrl = 'https://app.chatflow.kz';
5
+ this.documentationUrl = 'https://lk.chatflow.kz';
6
6
  this.properties = [
7
- {
8
- displayName: 'Server URL',
9
- name: 'serverUrl',
10
- type: 'string',
11
- default: 'https://app.chatflow.kz',
12
- required: true,
13
- description: 'Your Chatflow server URL (e.g. https://app.chatflow.kz)',
14
- },
15
7
  {
16
8
  displayName: 'Token',
17
9
  name: 'token',
@@ -32,7 +24,7 @@ class ChatflowApi {
32
24
  ];
33
25
  this.test = {
34
26
  request: {
35
- baseURL: '={{$credentials.serverUrl}}',
27
+ baseURL: 'https://lk.chatflow.kz',
36
28
  url: '/api/v1/n8n/ping',
37
29
  method: 'GET',
38
30
  qs: {
@@ -3,64 +3,45 @@ class ChatflowMessage {
3
3
  this.description = ChatflowMessage.description;
4
4
  }
5
5
 
6
- methods = {
7
- loadOptions: {
8
- async getPlatform() {
9
- try {
10
- const credentials = await this.getCredentials('chatflowApi');
11
- const serverUrl = (credentials.serverUrl || 'https://app.chatflow.kz').replace(/\/+$/, '');
12
- if (!credentials.flowId) return [];
13
-
14
- const response = await this.helpers.httpRequest({
15
- method: 'GET',
16
- url: `${serverUrl}/api/v1/n8n/flow-info/${credentials.flowId}`,
17
- qs: { token: credentials.token },
18
- json: true,
19
- });
20
-
21
- if (response && response.platform) {
22
- const platName = response.platform === 'telegram' ? 'Telegram' : 'WhatsApp';
23
- return [{ name: platName, value: response.platform }];
24
- }
25
- } catch(e) {
26
- console.error('Failed to load platform:', e);
27
- }
28
-
29
- return [
30
- { name: 'WhatsApp', value: 'whatsapp' },
31
- { name: 'Telegram', value: 'telegram' }
32
- ];
33
- }
34
- }
35
- };
36
-
37
6
  async execute() {
38
7
  const items = this.getInputData();
39
8
  const out = [];
40
9
  const credentials = await this.getCredentials('chatflowApi');
41
10
  const token = credentials.token;
42
11
  const flowId = credentials.flowId;
43
- const serverUrl = (credentials.serverUrl || 'https://app.chatflow.kz').replace(/\/+$/, '');
44
- const platform = this.getNodeParameter('platform', 0, 'whatsapp');
12
+ const serverUrl = 'https://lk.chatflow.kz';
45
13
 
46
14
  const operation = this.getNodeParameter('operation', 0);
47
15
  const continueOnFail = this.getNodeParameter('continueOnFail', 0);
48
16
 
17
+ // Fetch platform automatically from server
18
+ let platform = 'whatsapp';
19
+ try {
20
+ const infoResp = await this.helpers.httpRequest({
21
+ method: 'GET',
22
+ url: `${serverUrl}/api/v1/n8n/flow-info/${flowId}`,
23
+ qs: { token },
24
+ json: true,
25
+ });
26
+ if (infoResp && infoResp.platform) {
27
+ platform = infoResp.platform;
28
+ }
29
+ } catch(e) {
30
+ // fallback to whatsapp
31
+ }
32
+
49
33
  for (let i = 0; i < items.length; i++) {
50
34
  try {
51
35
  const recipient = this.getNodeParameter('recipient', i);
52
36
 
53
- // Build query string params
54
37
  const qs = { token, flow_id: flowId };
55
38
 
56
- // Set recipient field based on platform
57
39
  if (platform === 'telegram') {
58
40
  qs.chat_id = recipient;
59
41
  } else {
60
42
  qs.jid = recipient;
61
43
  }
62
44
 
63
- // Operation-specific params
64
45
  if (operation === 'text') {
65
46
  qs.msg = this.getNodeParameter('msg', i);
66
47
  }
@@ -111,7 +92,7 @@ class ChatflowMessage {
111
92
  }
112
93
 
113
94
  ChatflowMessage.description = {
114
- displayName: 'Chatflow Message',
95
+ displayName: 'Chatflow',
115
96
  name: 'chatflowMessage',
116
97
  icon: {
117
98
  light: 'file:black.svg',
@@ -119,56 +100,37 @@ ChatflowMessage.description = {
119
100
  },
120
101
  group: ['output'],
121
102
  version: 2,
122
- subtitle: '={{$parameter["operation"]}} ({{$parameter["platform"]}})',
103
+ subtitle: '={{$parameter["operation"]}}',
123
104
  description: 'Send WhatsApp & Telegram messages via Chatflow API',
124
- defaults: { name: 'Chatflow Message' },
105
+ defaults: { name: 'Chatflow' },
125
106
  inputs: [{ type: 'main' }],
126
107
  outputs: [{ type: 'main' }],
127
108
  credentials: [
128
109
  { name: 'chatflowApi', required: true },
129
110
  ],
130
111
  properties: [
131
- {
132
- displayName: 'Messaging Platform',
133
- name: 'platform',
134
- type: 'options',
135
- typeOptions: { loadOptionsMethod: 'getPlatform' },
136
- default: '',
137
- required: true,
138
- description: 'Automatically determined from your Chatflow credentials (Flow ID)',
139
- },
140
112
  {
141
113
  displayName: 'Operation',
142
114
  name: 'operation',
143
115
  type: 'options',
144
116
  noDataExpression: true,
145
117
  options: [
146
- { name: 'Send Text', value: 'text', description: 'Send a text message' },
147
- { name: 'Send Image', value: 'image', description: 'Send an image with optional caption' },
148
- { name: 'Send Video', value: 'video', description: 'Send a video with optional caption' },
149
- { name: 'Send Audio', value: 'audio', description: 'Send an audio file' },
150
- { name: 'Send Document', value: 'document', description: 'Send a document with optional caption' },
118
+ { name: 'Send Text', value: 'text', description: 'Send a text message', action: 'Send a text message' },
119
+ { name: 'Send Image', value: 'image', description: 'Send an image with optional caption', action: 'Send an image' },
120
+ { name: 'Send Video', value: 'video', description: 'Send a video with optional caption', action: 'Send a video' },
121
+ { name: 'Send Audio', value: 'audio', description: 'Send an audio file', action: 'Send an audio' },
122
+ { name: 'Send Document', value: 'document', description: 'Send a document with optional caption', action: 'Send a document' },
151
123
  ],
152
124
  default: 'text',
153
125
  },
154
126
  {
155
- displayName: 'Recipient Number (WhatsApp)',
156
- name: 'recipient',
157
- type: 'string',
158
- default: '',
159
- required: true,
160
- displayOptions: { show: { platform: ['whatsapp'] } },
161
- description: 'WhatsApp phone number (e.g. 77001234567)',
162
- placeholder: '77001234567',
163
- },
164
- {
165
- displayName: 'Chat ID (Telegram)',
127
+ displayName: 'Recipient',
166
128
  name: 'recipient',
167
129
  type: 'string',
168
130
  default: '',
169
131
  required: true,
170
- displayOptions: { show: { platform: ['telegram'] } },
171
- description: 'Telegram numeric Chat ID',
132
+ description: 'WhatsApp number (e.g. 77001234567) or Telegram Chat ID — determined automatically from Flow',
133
+ placeholder: '77001234567 or -100123456789',
172
134
  },
173
135
  // --- Text ---
174
136
  {
@@ -179,25 +141,15 @@ ChatflowMessage.description = {
179
141
  default: '',
180
142
  required: true,
181
143
  displayOptions: { show: { operation: ['text'] } },
182
- description: 'Text of the message to send',
183
144
  },
184
- // --- Image ---
145
+ // --- Audio ---
185
146
  {
186
- displayName: 'Image URL',
187
- name: 'imageurl',
147
+ displayName: 'Audio URL',
148
+ name: 'audiourl',
188
149
  type: 'string',
189
150
  default: '',
190
151
  required: true,
191
- displayOptions: { show: { operation: ['image'] } },
192
- description: 'Public URL of the image file',
193
- },
194
- {
195
- displayName: 'Caption',
196
- name: 'captionImg',
197
- type: 'string',
198
- default: '',
199
- displayOptions: { show: { operation: ['image'] } },
200
- description: 'Optional caption for the image',
152
+ displayOptions: { show: { operation: ['audio'] } },
201
153
  },
202
154
  // --- Video ---
203
155
  {
@@ -207,7 +159,6 @@ ChatflowMessage.description = {
207
159
  default: '',
208
160
  required: true,
209
161
  displayOptions: { show: { operation: ['video'] } },
210
- description: 'Public URL of the video file',
211
162
  },
212
163
  {
213
164
  displayName: 'Caption',
@@ -215,17 +166,6 @@ ChatflowMessage.description = {
215
166
  type: 'string',
216
167
  default: '',
217
168
  displayOptions: { show: { operation: ['video'] } },
218
- description: 'Optional caption for the video',
219
- },
220
- // --- Audio ---
221
- {
222
- displayName: 'Audio URL',
223
- name: 'audiourl',
224
- type: 'string',
225
- default: '',
226
- required: true,
227
- displayOptions: { show: { operation: ['audio'] } },
228
- description: 'Public URL of the audio file',
229
169
  },
230
170
  // --- Document ---
231
171
  {
@@ -235,7 +175,6 @@ ChatflowMessage.description = {
235
175
  default: '',
236
176
  required: true,
237
177
  displayOptions: { show: { operation: ['document'] } },
238
- description: 'Public URL of the document file',
239
178
  },
240
179
  {
241
180
  displayName: 'Caption',
@@ -243,15 +182,29 @@ ChatflowMessage.description = {
243
182
  type: 'string',
244
183
  default: '',
245
184
  displayOptions: { show: { operation: ['document'] } },
246
- description: 'Optional caption for the document',
247
185
  },
248
- // --- Options ---
186
+ // --- Image ---
187
+ {
188
+ displayName: 'Image URL',
189
+ name: 'imageurl',
190
+ type: 'string',
191
+ default: '',
192
+ required: true,
193
+ displayOptions: { show: { operation: ['image'] } },
194
+ },
195
+ {
196
+ displayName: 'Caption',
197
+ name: 'captionImg',
198
+ type: 'string',
199
+ default: '',
200
+ displayOptions: { show: { operation: ['image'] } },
201
+ },
202
+ // Continue on fail
249
203
  {
250
204
  displayName: 'Continue On Fail',
251
205
  name: 'continueOnFail',
252
206
  type: 'boolean',
253
- default: true,
254
- description: 'Whether to continue workflow execution on send failure',
207
+ default: false,
255
208
  },
256
209
  ],
257
210
  };
@@ -8,7 +8,7 @@ class ChatflowTrigger {
8
8
  async getPlatform() {
9
9
  try {
10
10
  const credentials = await this.getCredentials('chatflowApi');
11
- const serverUrl = (credentials.serverUrl || 'https://app.chatflow.kz').replace(/\/+$/, '');
11
+ const serverUrl = 'https://lk.chatflow.kz';
12
12
  if (!credentials.flowId) return [];
13
13
 
14
14
  const response = await this.helpers.httpRequest({
@@ -44,7 +44,7 @@ class ChatflowTrigger {
44
44
  // Check if webhook is still registered on the server
45
45
  try {
46
46
  const credentials = await this.getCredentials('chatflowApi');
47
- const serverUrl = (credentials.serverUrl || 'https://app.chatflow.kz').replace(/\/+$/, '');
47
+ const serverUrl = 'https://lk.chatflow.kz';
48
48
 
49
49
  const response = await this.helpers.httpRequest({
50
50
  method: 'GET',
@@ -67,7 +67,7 @@ class ChatflowTrigger {
67
67
  async create() {
68
68
  const webhookUrl = this.getNodeWebhookUrl('default');
69
69
  const credentials = await this.getCredentials('chatflowApi');
70
- const serverUrl = (credentials.serverUrl || 'https://app.chatflow.kz').replace(/\/+$/, '');
70
+ const serverUrl = 'https://lk.chatflow.kz';
71
71
  const flowId = credentials.flowId;
72
72
  const token = credentials.token;
73
73
 
@@ -104,7 +104,7 @@ class ChatflowTrigger {
104
104
  async delete() {
105
105
  const webhookData = this.getWorkflowStaticData('node');
106
106
  const credentials = await this.getCredentials('chatflowApi');
107
- const serverUrl = (credentials.serverUrl || 'https://app.chatflow.kz').replace(/\/+$/, '');
107
+ const serverUrl = 'https://lk.chatflow.kz';
108
108
 
109
109
  if (webhookData.webhookId) {
110
110
  try {
@@ -172,7 +172,7 @@ class ChatflowTrigger {
172
172
  }
173
173
 
174
174
  ChatflowTrigger.description = {
175
- displayName: 'Chatflow Trigger',
175
+ displayName: 'Chatflow',
176
176
  name: 'chatflowTrigger',
177
177
  icon: {
178
178
  light: 'file:black.svg',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-chatflow",
3
- "version": "1.1.1",
3
+ "version": "1.1.4",
4
4
  "description": "n8n community nodes for Chatflow — send WhatsApp & Telegram messages and receive triggers",
5
5
  "author": "Chatflow",
6
6
  "license": "MIT",