n8n-nodes-postwire 0.1.0 → 0.1.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.
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostWireApi = void 0;
|
|
4
|
-
|
|
5
|
-
// PostWire authenticates with a single bearer key. The `test` block below is what makes n8n's
|
|
6
|
-
// "Test connection" button meaningful: /api/me returns the plan, the month's usage and the
|
|
7
|
-
// connected accounts, so a wrong key fails immediately instead of at publish time.
|
|
8
|
-
class PostWireApi {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.name = 'postWireApi';
|
|
11
|
-
this.displayName = 'PostWire API';
|
|
12
|
-
this.documentationUrl = 'https://postwire.io/
|
|
13
|
-
this.properties = [
|
|
14
|
-
{
|
|
15
|
-
displayName: 'API Key',
|
|
16
|
-
name: 'apiKey',
|
|
17
|
-
type: 'string',
|
|
18
|
-
typeOptions: { password: true },
|
|
19
|
-
default: '',
|
|
20
|
-
required: true,
|
|
21
|
-
placeholder: 'pw_live_...',
|
|
22
|
-
description:
|
|
23
|
-
'Your PostWire API key. Get one free at https://postwire.io/dashboard.html — the free plan covers one brand, every network it connects, and 30 posts a month, with no card.',
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
this.authenticate = {
|
|
27
|
-
type: 'generic',
|
|
28
|
-
properties: {
|
|
29
|
-
headers: {
|
|
30
|
-
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
31
|
-
'X-PostWire-Source': 'n8n',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
this.test = {
|
|
36
|
-
request: {
|
|
37
|
-
baseURL: 'https://postwire.io',
|
|
38
|
-
url: '/api/me',
|
|
39
|
-
method: 'GET',
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.PostWireApi = PostWireApi;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostWireApi = void 0;
|
|
4
|
+
|
|
5
|
+
// PostWire authenticates with a single bearer key. The `test` block below is what makes n8n's
|
|
6
|
+
// "Test connection" button meaningful: /api/me returns the plan, the month's usage and the
|
|
7
|
+
// connected accounts, so a wrong key fails immediately instead of at publish time.
|
|
8
|
+
class PostWireApi {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.name = 'postWireApi';
|
|
11
|
+
this.displayName = 'PostWire API';
|
|
12
|
+
this.documentationUrl = 'https://postwire.io/n8n-social-media-automation/';
|
|
13
|
+
this.properties = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'API Key',
|
|
16
|
+
name: 'apiKey',
|
|
17
|
+
type: 'string',
|
|
18
|
+
typeOptions: { password: true },
|
|
19
|
+
default: '',
|
|
20
|
+
required: true,
|
|
21
|
+
placeholder: 'pw_live_...',
|
|
22
|
+
description:
|
|
23
|
+
'Your PostWire API key. Get one free at https://postwire.io/dashboard.html — the free plan covers one brand, every network it connects, and 30 posts a month, with no card.',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
this.authenticate = {
|
|
27
|
+
type: 'generic',
|
|
28
|
+
properties: {
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
31
|
+
'X-PostWire-Source': 'n8n',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
this.test = {
|
|
36
|
+
request: {
|
|
37
|
+
baseURL: 'https://postwire.io',
|
|
38
|
+
url: '/api/me',
|
|
39
|
+
method: 'GET',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.PostWireApi = PostWireApi;
|
|
@@ -278,9 +278,24 @@ class PostWire {
|
|
|
278
278
|
|
|
279
279
|
// One n8n item per network, so a Filter or IF node downstream can act on the failures alone
|
|
280
280
|
// instead of unpacking an array by hand.
|
|
281
|
-
|
|
281
|
+
const results = r.results || [r];
|
|
282
|
+
for (const res of results) {
|
|
282
283
|
out.push({ json: res, pairedItem: { item: i } });
|
|
283
284
|
}
|
|
285
|
+
// A 200 whose every network failed used to leave the node green with the error buried in
|
|
286
|
+
// the output, so a scheduled flow could publish nothing for weeks and never say so. If not
|
|
287
|
+
// one network went out, that is a failed execution.
|
|
288
|
+
const failed = results.filter((res) => res && res.ok === false);
|
|
289
|
+
if (results.length && failed.length === results.length) {
|
|
290
|
+
const why = failed.map((f) => `${f.platform || "?"}: ${f.error || f.code || "failed"}`).join("; ");
|
|
291
|
+
const limited = failed.find((f) => f.code === "brand_limit_reached" || f.upgrade_url);
|
|
292
|
+
throw new NodeOperationError(
|
|
293
|
+
this.getNode(),
|
|
294
|
+
`PostWire published to none of the ${results.length} selected network(s). ${why}` +
|
|
295
|
+
(limited && limited.upgrade_url ? ` — upgrade: ${limited.upgrade_url}` : ""),
|
|
296
|
+
{ itemIndex: i },
|
|
297
|
+
);
|
|
298
|
+
}
|
|
284
299
|
} catch (error) {
|
|
285
300
|
if (this.continueOnFail()) {
|
|
286
301
|
out.push({ json: { error: error.message }, pairedItem: { item: i } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-postwire",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Publish one idea natively to TikTok, Instagram, YouTube, LinkedIn, X, Bluesky, Mastodon, Telegram, Discord and Reddit from n8n — a different post written for each network, via PostWire.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -15,18 +15,38 @@
|
|
|
15
15
|
],
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"homepage": "https://postwire.io",
|
|
18
|
-
"author": {
|
|
19
|
-
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "PostWire",
|
|
20
|
+
"email": "privacy@postwire.io"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/Perufitlife/n8n-nodes-postwire.git"
|
|
25
|
+
},
|
|
20
26
|
"main": "index.js",
|
|
21
27
|
"scripts": {
|
|
22
28
|
"prepublishOnly": "node -e \"require('./nodes/PostWire/PostWire.node.js');require('./credentials/PostWireApi.credentials.js');console.log('load check ok')\""
|
|
23
29
|
},
|
|
24
|
-
"files": [
|
|
30
|
+
"files": [
|
|
31
|
+
"index.js",
|
|
32
|
+
"nodes",
|
|
33
|
+
"credentials",
|
|
34
|
+
"LICENSE.md",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
25
37
|
"n8n": {
|
|
26
38
|
"n8nNodesApiVersion": 1,
|
|
27
|
-
"credentials": [
|
|
28
|
-
|
|
39
|
+
"credentials": [
|
|
40
|
+
"credentials/PostWireApi.credentials.js"
|
|
41
|
+
],
|
|
42
|
+
"nodes": [
|
|
43
|
+
"nodes/PostWire/PostWire.node.js"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"n8n-workflow": "*"
|
|
29
48
|
},
|
|
30
|
-
"
|
|
31
|
-
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=18.10"
|
|
51
|
+
}
|
|
32
52
|
}
|