n8n-nodes-tareno 1.3.1 → 1.3.2
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/dist/nodes/Tareno/Tareno.node.js +79 -57
- package/package.json +1 -1
|
@@ -33,7 +33,6 @@ class Tareno {
|
|
|
33
33
|
{ name: 'Post', value: 'post', description: 'Create and manage social media posts' },
|
|
34
34
|
{ name: 'Media Library', value: 'media', description: 'Send content to Tareno Media Library' },
|
|
35
35
|
{ name: 'Account', value: 'account', description: 'Get connected social media accounts' },
|
|
36
|
-
{ name: 'Usage', value: 'usage', description: 'Get API usage statistics' },
|
|
37
36
|
],
|
|
38
37
|
default: 'post',
|
|
39
38
|
},
|
|
@@ -52,27 +51,58 @@ class Tareno {
|
|
|
52
51
|
],
|
|
53
52
|
default: 'publish',
|
|
54
53
|
},
|
|
54
|
+
// Platform Filter (Helper for UI)
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Platform (UI Filter)',
|
|
57
|
+
name: 'platformFilter',
|
|
58
|
+
type: 'options',
|
|
59
|
+
displayOptions: { show: { resource: ['post'] } },
|
|
60
|
+
options: [
|
|
61
|
+
{ name: 'All / Auto-detect', value: 'all' },
|
|
62
|
+
{ name: 'Instagram', value: 'instagram' },
|
|
63
|
+
{ name: 'Facebook', value: 'facebook' },
|
|
64
|
+
{ name: 'YouTube', value: 'youtube' },
|
|
65
|
+
{ name: 'TikTok', value: 'tiktok' },
|
|
66
|
+
{ name: 'Pinterest', value: 'pinterest' },
|
|
67
|
+
{ name: 'Twitter / X', value: 'twitter' },
|
|
68
|
+
{ name: 'Threads', value: 'threads' },
|
|
69
|
+
],
|
|
70
|
+
default: 'all',
|
|
71
|
+
description: 'Filter accounts and show specific fields for this platform',
|
|
72
|
+
},
|
|
73
|
+
// Account Selection (Dynamic)
|
|
55
74
|
{
|
|
56
75
|
displayName: 'Account',
|
|
57
76
|
name: 'accountId',
|
|
58
77
|
type: 'options',
|
|
59
78
|
required: true,
|
|
60
|
-
typeOptions: {
|
|
79
|
+
typeOptions: {
|
|
80
|
+
loadOptionsMethod: 'getAccounts',
|
|
81
|
+
loadOptionsDependsOn: ['platformFilter'],
|
|
82
|
+
},
|
|
61
83
|
displayOptions: { show: { resource: ['post'] } },
|
|
62
84
|
default: '',
|
|
63
85
|
},
|
|
86
|
+
// Format Selection (Only for Meta)
|
|
64
87
|
{
|
|
65
88
|
displayName: 'Format',
|
|
66
89
|
name: 'format',
|
|
67
90
|
type: 'options',
|
|
68
|
-
displayOptions: {
|
|
91
|
+
displayOptions: {
|
|
92
|
+
show: {
|
|
93
|
+
resource: ['post'],
|
|
94
|
+
platformFilter: ['instagram', 'facebook', 'all']
|
|
95
|
+
}
|
|
96
|
+
},
|
|
69
97
|
options: [
|
|
70
98
|
{ name: 'Feed Post', value: 'post' },
|
|
71
99
|
{ name: 'Story', value: 'story' },
|
|
72
100
|
{ name: 'Reel', value: 'reel' },
|
|
73
101
|
],
|
|
74
102
|
default: 'post',
|
|
103
|
+
description: 'Format for Instagram/Facebook (ignored for others)',
|
|
75
104
|
},
|
|
105
|
+
// Pinterest Board (Only for Pinterest)
|
|
76
106
|
{
|
|
77
107
|
displayName: 'Pinterest Board',
|
|
78
108
|
name: 'pinterestBoard',
|
|
@@ -81,8 +111,14 @@ class Tareno {
|
|
|
81
111
|
loadOptionsMethod: 'getPinterestBoards',
|
|
82
112
|
loadOptionsDependsOn: ['accountId'],
|
|
83
113
|
},
|
|
84
|
-
displayOptions: {
|
|
114
|
+
displayOptions: {
|
|
115
|
+
show: {
|
|
116
|
+
resource: ['post'],
|
|
117
|
+
platformFilter: ['pinterest', 'all']
|
|
118
|
+
}
|
|
119
|
+
},
|
|
85
120
|
default: '',
|
|
121
|
+
description: 'Select a Pinterest board',
|
|
86
122
|
},
|
|
87
123
|
{
|
|
88
124
|
displayName: 'Text/Caption',
|
|
@@ -92,6 +128,20 @@ class Tareno {
|
|
|
92
128
|
displayOptions: { show: { resource: ['post'] } },
|
|
93
129
|
default: '',
|
|
94
130
|
},
|
|
131
|
+
// Video Title (Only for YouTube)
|
|
132
|
+
{
|
|
133
|
+
displayName: 'Video Title',
|
|
134
|
+
name: 'videoTitle',
|
|
135
|
+
type: 'string',
|
|
136
|
+
displayOptions: {
|
|
137
|
+
show: {
|
|
138
|
+
resource: ['post'],
|
|
139
|
+
platformFilter: ['youtube']
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
default: '',
|
|
143
|
+
placeholder: 'My Great Video',
|
|
144
|
+
},
|
|
95
145
|
{
|
|
96
146
|
displayName: 'Media URLs',
|
|
97
147
|
name: 'mediaUrls',
|
|
@@ -117,9 +167,9 @@ class Tareno {
|
|
|
117
167
|
displayOptions: { show: { resource: ['post'] } },
|
|
118
168
|
default: {},
|
|
119
169
|
options: [
|
|
120
|
-
{ displayName: 'YouTube Title', name: 'youtubeTitle', type: 'string', default: '' },
|
|
121
170
|
{ displayName: 'YouTube Description', name: 'youtubeDescription', type: 'string', typeOptions: { rows: 3 }, default: '' },
|
|
122
171
|
{ displayName: 'Pinterest Link', name: 'pinterestLink', type: 'string', default: '' },
|
|
172
|
+
{ displayName: 'Disable Comments', name: 'disableComments', type: 'boolean', default: false },
|
|
123
173
|
],
|
|
124
174
|
},
|
|
125
175
|
// ========================
|
|
@@ -170,31 +220,6 @@ class Tareno {
|
|
|
170
220
|
displayOptions: { show: { resource: ['media'] } },
|
|
171
221
|
default: '',
|
|
172
222
|
},
|
|
173
|
-
// ========================
|
|
174
|
-
// OTHER RESOURCES
|
|
175
|
-
// ========================
|
|
176
|
-
{
|
|
177
|
-
displayName: 'Operation',
|
|
178
|
-
name: 'operation',
|
|
179
|
-
type: 'options',
|
|
180
|
-
noDataExpression: true,
|
|
181
|
-
displayOptions: { show: { resource: ['account'] } },
|
|
182
|
-
options: [
|
|
183
|
-
{ name: 'Get All', value: 'getAll', action: 'Get all accounts' },
|
|
184
|
-
],
|
|
185
|
-
default: 'getAll',
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
displayName: 'Operation',
|
|
189
|
-
name: 'operation',
|
|
190
|
-
type: 'options',
|
|
191
|
-
noDataExpression: true,
|
|
192
|
-
displayOptions: { show: { resource: ['usage'] } },
|
|
193
|
-
options: [
|
|
194
|
-
{ name: 'Get Statistics', value: 'getStats', action: 'Get usage statistics' },
|
|
195
|
-
],
|
|
196
|
-
default: 'getStats',
|
|
197
|
-
},
|
|
198
223
|
],
|
|
199
224
|
};
|
|
200
225
|
this.methods = {
|
|
@@ -202,6 +227,7 @@ class Tareno {
|
|
|
202
227
|
async getAccounts() {
|
|
203
228
|
const credentials = await this.getCredentials('tarenoApi');
|
|
204
229
|
const baseUrl = credentials.baseUrl || 'https://tareno.co';
|
|
230
|
+
const platformFilter = this.getNodeParameter('platformFilter', 'all');
|
|
205
231
|
try {
|
|
206
232
|
const response = await this.helpers.httpRequest({
|
|
207
233
|
method: 'GET',
|
|
@@ -210,8 +236,12 @@ class Tareno {
|
|
|
210
236
|
json: true,
|
|
211
237
|
});
|
|
212
238
|
if (response.accounts && Array.isArray(response.accounts)) {
|
|
213
|
-
|
|
214
|
-
|
|
239
|
+
let filtered = response.accounts;
|
|
240
|
+
if (platformFilter !== 'all') {
|
|
241
|
+
filtered = response.accounts.filter((a) => a.platform === platformFilter);
|
|
242
|
+
}
|
|
243
|
+
return filtered.map((account) => ({
|
|
244
|
+
name: `${account.platform.toUpperCase()} - ${account.username || account.displayName || 'Unknown'}`,
|
|
215
245
|
value: account.id,
|
|
216
246
|
}));
|
|
217
247
|
}
|
|
@@ -226,7 +256,7 @@ class Tareno {
|
|
|
226
256
|
const baseUrl = credentials.baseUrl || 'https://tareno.co';
|
|
227
257
|
const accountId = this.getNodeParameter('accountId', '');
|
|
228
258
|
if (!accountId)
|
|
229
|
-
return [
|
|
259
|
+
return [];
|
|
230
260
|
try {
|
|
231
261
|
const response = await this.helpers.httpRequest({
|
|
232
262
|
method: 'GET',
|
|
@@ -237,10 +267,10 @@ class Tareno {
|
|
|
237
267
|
if (response.boards && Array.isArray(response.boards)) {
|
|
238
268
|
return response.boards.map((board) => ({ name: board.name, value: board.id }));
|
|
239
269
|
}
|
|
240
|
-
return [
|
|
270
|
+
return [];
|
|
241
271
|
}
|
|
242
272
|
catch (error) {
|
|
243
|
-
return [
|
|
273
|
+
return [];
|
|
244
274
|
}
|
|
245
275
|
},
|
|
246
276
|
},
|
|
@@ -259,12 +289,22 @@ class Tareno {
|
|
|
259
289
|
if (resource === 'post') {
|
|
260
290
|
const accountId = this.getNodeParameter('accountId', i);
|
|
261
291
|
const format = this.getNodeParameter('format', i);
|
|
262
|
-
const pinterestBoard = this.getNodeParameter('pinterestBoard', i);
|
|
292
|
+
const pinterestBoard = this.getNodeParameter('pinterestBoard', i, '');
|
|
263
293
|
const text = this.getNodeParameter('text', i);
|
|
264
|
-
const
|
|
294
|
+
const videoTitle = this.getNodeParameter('videoTitle', i, '');
|
|
295
|
+
const mediaUrlsRaw = this.getNodeParameter('mediaUrls', i, '');
|
|
265
296
|
const additionalOptions = this.getNodeParameter('additionalOptions', i);
|
|
266
297
|
const mediaUrls = mediaUrlsRaw ? mediaUrlsRaw.split(',').map(url => url.trim()).filter(Boolean) : [];
|
|
267
|
-
const body = {
|
|
298
|
+
const body = {
|
|
299
|
+
accountId,
|
|
300
|
+
text,
|
|
301
|
+
mediaUrls,
|
|
302
|
+
metadata: {
|
|
303
|
+
format,
|
|
304
|
+
videoTitle,
|
|
305
|
+
...additionalOptions
|
|
306
|
+
}
|
|
307
|
+
};
|
|
268
308
|
if (pinterestBoard)
|
|
269
309
|
body.metadata.pinterestBoard = pinterestBoard;
|
|
270
310
|
if (operation === 'schedule')
|
|
@@ -305,7 +345,6 @@ class Tareno {
|
|
|
305
345
|
},
|
|
306
346
|
body: binaryBuffer,
|
|
307
347
|
});
|
|
308
|
-
// Parse JSON manually if n8n doesn't do it for non-JSON content types
|
|
309
348
|
if (typeof responseData === 'string') {
|
|
310
349
|
try {
|
|
311
350
|
responseData = JSON.parse(responseData);
|
|
@@ -314,25 +353,8 @@ class Tareno {
|
|
|
314
353
|
}
|
|
315
354
|
}
|
|
316
355
|
}
|
|
317
|
-
|
|
318
|
-
responseData = await this.helpers.httpRequest({
|
|
319
|
-
method: 'GET',
|
|
320
|
-
url: `${baseUrl}/api/external/accounts`,
|
|
321
|
-
headers: { 'X-Tareno-API-Key': credentials.apiKey },
|
|
322
|
-
json: true,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
else if (resource === 'usage' && operation === 'getStats') {
|
|
326
|
-
responseData = await this.helpers.httpRequest({
|
|
327
|
-
method: 'GET',
|
|
328
|
-
url: `${baseUrl}/api/external/usage`,
|
|
329
|
-
headers: { 'X-Tareno-API-Key': credentials.apiKey },
|
|
330
|
-
json: true,
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
if (responseData) {
|
|
356
|
+
if (responseData)
|
|
334
357
|
returnData.push({ json: responseData });
|
|
335
|
-
}
|
|
336
358
|
}
|
|
337
359
|
catch (error) {
|
|
338
360
|
if (this.continueOnFail()) {
|