n8n-nodes-substack 0.0.2 → 0.2.0

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.
Files changed (35) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +89 -33
  3. package/dist/credentials/SubstackApi.credentials.js.map +1 -1
  4. package/dist/nodes/Substack/NoteOperations.d.ts +26 -0
  5. package/dist/nodes/Substack/NoteOperations.js +54 -0
  6. package/dist/nodes/Substack/NoteOperations.js.map +1 -0
  7. package/dist/nodes/Substack/Substack.node.d.ts +2 -1
  8. package/dist/nodes/Substack/Substack.node.js +75 -8
  9. package/dist/nodes/Substack/Substack.node.js.map +1 -1
  10. package/dist/nodes/Substack/SubstackDescription.d.ts +2 -0
  11. package/dist/nodes/Substack/SubstackDescription.js +100 -28
  12. package/dist/nodes/Substack/SubstackDescription.js.map +1 -1
  13. package/dist/nodes/Substack/SubstackUtils.d.ts +8 -0
  14. package/dist/nodes/Substack/SubstackUtils.js +21 -0
  15. package/dist/nodes/Substack/SubstackUtils.js.map +1 -0
  16. package/dist/package.json +5 -6
  17. package/dist/tsconfig.tsbuildinfo +1 -1
  18. package/package.json +5 -6
  19. package/dist/credentials/ExampleCredentialsApi.credentials.d.ts +0 -9
  20. package/dist/credentials/ExampleCredentialsApi.credentials.js +0 -47
  21. package/dist/credentials/ExampleCredentialsApi.credentials.js.map +0 -1
  22. package/dist/credentials/HttpBinApi.credentials.d.ts +0 -9
  23. package/dist/credentials/HttpBinApi.credentials.js +0 -43
  24. package/dist/credentials/HttpBinApi.credentials.js.map +0 -1
  25. package/dist/nodes/ExampleNode/ExampleNode.node.d.ts +0 -5
  26. package/dist/nodes/ExampleNode/ExampleNode.node.js +0 -60
  27. package/dist/nodes/ExampleNode/ExampleNode.node.js.map +0 -1
  28. package/dist/nodes/HttpBin/HttpBin.node.d.ts +0 -4
  29. package/dist/nodes/HttpBin/HttpBin.node.js +0 -56
  30. package/dist/nodes/HttpBin/HttpBin.node.js.map +0 -1
  31. package/dist/nodes/HttpBin/HttpBin.node.json +0 -18
  32. package/dist/nodes/HttpBin/HttpVerbDescription.d.ts +0 -3
  33. package/dist/nodes/HttpBin/HttpVerbDescription.js +0 -236
  34. package/dist/nodes/HttpBin/HttpVerbDescription.js.map +0 -1
  35. package/dist/nodes/HttpBin/httpbin.svg +0 -18
package/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 n8n
1
+ Copyright 2025 Jakub Slys
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -1,48 +1,104 @@
1
- ![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)
1
+ # n8n-nodes-substack
2
2
 
3
- # n8n-nodes-starter
3
+ [![npm version](https://badge.fury.io/js/n8n-nodes-substack.svg)](https://badge.fury.io/js/n8n-nodes-substack)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
5
 
5
- This repo contains example nodes to help you get started building your own custom integrations for [n8n](https://n8n.io). It includes the node linter and other dependencies.
6
+ This n8n community node allows interaction with the Substack API, enabling you to automate content creation and management workflows directly from n8n.
6
7
 
7
- To make your custom node available to the community, you must create it as an npm package, and [submit it to the npm registry](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry).
8
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
8
9
 
9
- If you would like your node to be available on n8n cloud you can also [submit your node for verification](https://docs.n8n.io/integrations/creating-nodes/deploy/submit-community-nodes/).
10
+ ## Features
10
11
 
11
- ## Prerequisites
12
+ - **Authenticate with Substack**: Secure API key authentication using publication address and API key
13
+ - **Create Notes**: Publish Substack notes programmatically with title and body content
14
+ - **Retrieve Posts**: Get posts from your publication with pagination support (limit and offset parameters)
15
+ - **Powered by substack-api**: Uses the robust [substack-api](https://www.npmjs.com/package/substack-api) library for reliable API interactions
12
16
 
13
- You need the following installed on your development machine:
17
+ ## Quick Start
14
18
 
15
- * [git](https://git-scm.com/downloads)
16
- * Node.js and npm. Minimum version Node 20. You can find instructions on how to install both using nvm (Node Version Manager) for Linux, Mac, and WSL [here](https://github.com/nvm-sh/nvm). For Windows users, refer to Microsoft's guide to [Install NodeJS on Windows](https://docs.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows).
17
- * Install n8n with:
18
- ```
19
- npm install n8n -g
20
- ```
21
- * Recommended: follow n8n's guide to [set up your development environment](https://docs.n8n.io/integrations/creating-nodes/build/node-development-environment/).
19
+ Here are simple workflows for the available operations:
22
20
 
23
- ## Using this starter
21
+ ### Create a Substack Note
24
22
 
25
- These are the basic steps for working with the starter. For detailed guidance on creating and publishing nodes, refer to the [documentation](https://docs.n8n.io/integrations/creating-nodes/).
23
+ ```json
24
+ {
25
+ "nodes": [
26
+ {
27
+ "name": "Create Substack Note",
28
+ "type": "n8n-nodes-substack.substack",
29
+ "parameters": {
30
+ "resource": "note",
31
+ "operation": "create",
32
+ "title": "Hello from n8n!",
33
+ "body": "This note was created automatically using n8n."
34
+ },
35
+ "credentials": {
36
+ "substackApi": "your-credential-id"
37
+ }
38
+ }
39
+ ]
40
+ }
41
+ ```
26
42
 
27
- 1. [Generate a new repository](https://github.com/n8n-io/n8n-nodes-starter/generate) from this template repository.
28
- 2. Clone your new repo:
29
- ```
30
- git clone https://github.com/<your organization>/<your-repo-name>.git
31
- ```
32
- 3. Run `npm i` to install dependencies.
33
- 4. Open the project in your editor.
34
- 5. Browse the examples in `/nodes` and `/credentials`. Modify the examples, or replace them with your own nodes.
35
- 6. Update the `package.json` to match your details.
36
- 7. Run `npm run lint` to check for errors or `npm run lintfix` to automatically fix errors when possible.
37
- 8. Test your node locally. Refer to [Run your node locally](https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally/) for guidance.
38
- 9. Replace this README with documentation for your node. Use the [README_TEMPLATE](README_TEMPLATE.md) to get started.
39
- 10. Update the LICENSE file to use your details.
40
- 11. [Publish](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) your package to npm.
43
+ ### Retrieve Posts from Publication
41
44
 
42
- ## More information
45
+ ```json
46
+ {
47
+ "nodes": [
48
+ {
49
+ "name": "Get Substack Posts",
50
+ "type": "n8n-nodes-substack.substack",
51
+ "parameters": {
52
+ "resource": "post",
53
+ "operation": "getAll",
54
+ "limit": 10,
55
+ "offset": 0
56
+ },
57
+ "credentials": {
58
+ "substackApi": "your-credential-id"
59
+ }
60
+ }
61
+ ]
62
+ }
63
+ ```
43
64
 
44
- Refer to our [documentation on creating nodes](https://docs.n8n.io/integrations/creating-nodes/) for detailed information on building your own nodes.
65
+ ## Installation
66
+
67
+ ### n8n Cloud
68
+
69
+ 1. Go to **Settings** > **Community Nodes**
70
+ 2. Click **Install a community node**
71
+ 3. Enter `n8n-nodes-substack`
72
+ 4. Click **Install**
73
+
74
+ ### Self-hosted n8n
75
+
76
+ Install the node in your n8n installation directory:
77
+
78
+ ```bash
79
+ npm install n8n-nodes-substack
80
+ ```
81
+
82
+ Then restart your n8n instance.
83
+
84
+ ### Credentials Setup
85
+
86
+ 1. Add the Substack node to your workflow
87
+ 2. Create new credentials with:
88
+ - **Publication Address**: Your Substack domain (e.g., `myblog.substack.com`)
89
+ - **API Key**: Your Substack API key
90
+
91
+ ## Documentation
92
+
93
+ For comprehensive usage instructions, configuration options, and examples:
94
+
95
+ 📖 **[Full Documentation](docs/n8n-usage.md)**
96
+
97
+ Additional resources:
98
+ - [API Reference](docs/api-reference.md)
99
+ - [Examples](docs/examples.md)
100
+ - [Development Guide](docs/development.md)
45
101
 
46
102
  ## License
47
103
 
48
- [MIT](https://github.com/n8n-io/n8n-nodes-starter/blob/master/LICENSE.md)
104
+ [MIT](LICENSE.md)
@@ -1 +1 @@
1
- {"version":3,"file":"SubstackApi.credentials.js","sourceRoot":"","sources":["../../credentials/SubstackApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,0BAA0B,CAAC;QAC9C,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,oBAAoB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,qBAAqB;gBAClC,WAAW,EAAE,8CAA8C;gBAC3D,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,WAAW,EAAE,0CAA0C;gBACvD,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAIF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,sCAAsC;iBACrD;aACD;SACD,CAAC;QAGF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,+GAA+G;gBACxH,GAAG,EAAE,cAAc;aACnB;SACD,CAAC;IACH,CAAC;CAAA;AA7CD,kCA6CC"}
1
+ {"version":3,"file":"SubstackApi.credentials.js","sourceRoot":"","sources":["../../credentials/SubstackApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,0BAA0B,CAAC;QAC9C,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,oBAAoB;gBAC1B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,qBAAqB;gBAClC,WAAW,EAAE,8CAA8C;gBAC3D,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,WAAW,EAAE,0CAA0C;gBACvD,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAIF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,sCAAsC;iBACrD;aACD;SACD,CAAC;QAGF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EACN,+GAA+G;gBAChH,GAAG,EAAE,cAAc;aACnB;SACD,CAAC;IACH,CAAC;CAAA;AA9CD,kCA8CC"}
@@ -0,0 +1,26 @@
1
+ import { IExecuteFunctions } from 'n8n-workflow';
2
+ import { Substack as SubstackClient } from 'substack-api';
3
+ export declare class NoteOperations {
4
+ static create(executeFunctions: IExecuteFunctions, client: SubstackClient, publicationAddress: string, itemIndex: number): Promise<{
5
+ success: boolean;
6
+ title: string;
7
+ noteId: number;
8
+ url: string;
9
+ date: string;
10
+ status: "published";
11
+ userId: number;
12
+ }>;
13
+ static get(executeFunctions: IExecuteFunctions, client: SubstackClient, publicationAddress: string, itemIndex: number): Promise<{
14
+ noteId: number;
15
+ title: string;
16
+ body: string;
17
+ url: string;
18
+ date: string;
19
+ status: string;
20
+ userId: number;
21
+ likes: number;
22
+ restacks: number;
23
+ type: string;
24
+ entityKey: string;
25
+ }[]>;
26
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoteOperations = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ class NoteOperations {
6
+ static async create(executeFunctions, client, publicationAddress, itemIndex) {
7
+ const title = executeFunctions.getNodeParameter('title', itemIndex);
8
+ const body = executeFunctions.getNodeParameter('body', itemIndex);
9
+ if (!title || !body) {
10
+ throw new n8n_workflow_1.NodeOperationError(executeFunctions.getNode(), 'Title and body are required', {
11
+ itemIndex,
12
+ });
13
+ }
14
+ const noteContent = title + '\n\n' + body;
15
+ const response = await client.publishNote(noteContent);
16
+ return {
17
+ success: true,
18
+ title: title,
19
+ noteId: response.id,
20
+ url: `https://${publicationAddress}/p/${response.id}`,
21
+ date: response.date,
22
+ status: response.status,
23
+ userId: response.user_id,
24
+ };
25
+ }
26
+ static async get(executeFunctions, client, publicationAddress, itemIndex) {
27
+ const limit = executeFunctions.getNodeParameter('limit', itemIndex, 10);
28
+ const offset = executeFunctions.getNodeParameter('offset', itemIndex, 0);
29
+ const response = await client.getNotes({ limit, offset });
30
+ const notes = response.items || [];
31
+ const formattedNotes = [];
32
+ for (const note of notes) {
33
+ const comment = note.comment;
34
+ if (comment) {
35
+ formattedNotes.push({
36
+ noteId: comment.id,
37
+ title: '',
38
+ body: comment.body || '',
39
+ url: `https://${publicationAddress}/p/${comment.id}`,
40
+ date: comment.date,
41
+ status: 'published',
42
+ userId: comment.user_id,
43
+ likes: comment.reaction_count || 0,
44
+ restacks: comment.restacks || 0,
45
+ type: comment.type,
46
+ entityKey: note.entity_key,
47
+ });
48
+ }
49
+ }
50
+ return formattedNotes;
51
+ }
52
+ }
53
+ exports.NoteOperations = NoteOperations;
54
+ //# sourceMappingURL=NoteOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoteOperations.js","sourceRoot":"","sources":["../../../nodes/Substack/NoteOperations.ts"],"names":[],"mappings":";;;AAAA,+CAAqE;AAGrE,MAAa,cAAc;IAC1B,MAAM,CAAC,KAAK,CAAC,MAAM,CAClB,gBAAmC,EACnC,MAAsB,EACtB,kBAA0B,EAC1B,SAAiB;QAGjB,MAAM,KAAK,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAW,CAAC;QAC9E,MAAM,IAA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I,CAAC,OAAO,CAAC;YAC7B,IAAI,OAAO,EAAE,CAAC;gBACb,cAAc,CAAC,IAAI,CAAC;oBACnB,MAAM,EAAE,OAAO,CAAC,EAAE;oBAClB,KAAK,EAAE,EAAE;oBACT,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;oBACxB,GAAG,EAAE,WAAW,kBAAkB,MAAM,OAAO,CAAC,EAAE,EAAE;oBACpD,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,MAAM,EAAE,WAAW;oBACnB,MAAM,EAAE,OAAO,CAAC,OAAO;oBACvB,KAAK,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC;oBAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,CAAC;oBAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,SAAS,EAAE,IAAI,CAAC,UAAU;iBAC1B,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AA5ED,wCA4EC"}
@@ -1,4 +1,5 @@
1
- import { INodeType, INodeTypeDescription } from 'n8n-workflow';
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
2
  export declare class Substack implements INodeType {
3
3
  description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
4
5
  }
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Substack = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
4
5
  const SubstackDescription_1 = require("./SubstackDescription");
6
+ const NoteOperations_1 = require("./NoteOperations");
7
+ const SubstackUtils_1 = require("./SubstackUtils");
5
8
  class Substack {
6
9
  constructor() {
7
10
  this.description = {
@@ -24,14 +27,6 @@ class Substack {
24
27
  required: true,
25
28
  },
26
29
  ],
27
- requestDefaults: {
28
- baseURL: '={{$credentials?.publicationAddress ? "https://" + $credentials.publicationAddress : "https://substack.com"}}',
29
- url: '',
30
- headers: {
31
- Accept: 'application/json',
32
- 'Content-Type': 'application/json',
33
- },
34
- },
35
30
  properties: [
36
31
  {
37
32
  displayName: 'Resource',
@@ -43,14 +38,86 @@ class Substack {
43
38
  name: 'Note',
44
39
  value: 'note',
45
40
  },
41
+ {
42
+ name: 'Post',
43
+ value: 'post',
44
+ },
46
45
  ],
47
46
  default: 'note',
48
47
  },
49
48
  ...SubstackDescription_1.noteOperations,
50
49
  ...SubstackDescription_1.noteFields,
50
+ ...SubstackDescription_1.postOperations,
51
+ ...SubstackDescription_1.postFields,
51
52
  ],
52
53
  };
53
54
  }
55
+ async execute() {
56
+ const items = this.getInputData();
57
+ const returnData = [];
58
+ const { client, publicationAddress } = await SubstackUtils_1.SubstackUtils.initializeClient(this);
59
+ for (let i = 0; i < items.length; i++) {
60
+ try {
61
+ const resource = this.getNodeParameter('resource', i);
62
+ const operation = this.getNodeParameter('operation', i);
63
+ if (resource === 'post') {
64
+ if (operation === 'getAll') {
65
+ const limit = this.getNodeParameter('limit', i, 50);
66
+ const offset = this.getNodeParameter('offset', i, 0);
67
+ const posts = await client.getPosts({ limit, offset });
68
+ posts.forEach((post) => {
69
+ returnData.push({
70
+ json: { ...post },
71
+ pairedItem: { item: i },
72
+ });
73
+ });
74
+ }
75
+ }
76
+ else if (resource === 'note') {
77
+ if (operation === 'create') {
78
+ const title = this.getNodeParameter('title', i);
79
+ const body = this.getNodeParameter('body', i);
80
+ const result = await client.publishNote(`${title}\n\n${body}`);
81
+ returnData.push({
82
+ json: {
83
+ title,
84
+ success: true,
85
+ noteId: result.id,
86
+ body: result.body,
87
+ date: result.date,
88
+ },
89
+ pairedItem: { item: i },
90
+ });
91
+ }
92
+ else if (operation === 'get') {
93
+ const notes = await NoteOperations_1.NoteOperations.get(this, client, publicationAddress, i);
94
+ for (const note of notes) {
95
+ returnData.push({
96
+ json: note,
97
+ pairedItem: { item: i },
98
+ });
99
+ }
100
+ }
101
+ else {
102
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`, {
103
+ itemIndex: i,
104
+ });
105
+ }
106
+ }
107
+ }
108
+ catch (error) {
109
+ if (this.continueOnFail()) {
110
+ returnData.push({
111
+ json: { error: error.message },
112
+ pairedItem: { item: i },
113
+ });
114
+ continue;
115
+ }
116
+ throw error;
117
+ }
118
+ }
119
+ return [returnData];
120
+ }
54
121
  }
55
122
  exports.Substack = Substack;
56
123
  //# sourceMappingURL=Substack.node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Substack.node.js","sourceRoot":"","sources":["../../../nodes/Substack/Substack.node.ts"],"names":[],"mappings":";;;AACA,+DAAmE;AAEnE,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,mBAAmB,EAAE;YAC/D,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE;gBACT,IAAI,EAAE,UAAU;aAChB;YACD,MAAM,EAAE,QAAyB;YACjC,OAAO,EAAE,QAAyB;YAClC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,eAAe,EAAE;gBAChB,OAAO,EAAE,+GAA+G;gBACxH,GAAG,EAAE,EAAE;gBACP,OAAO,EAAE;oBACR,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,kBAAkB;iBAClC;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,MAAM;yBACb;qBACD;oBACD,OAAO,EAAE,MAAM;iBACf;gBAED,GAAG,oCAAc;gBACjB,GAAG,gCAAU;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAhDD,4BAgDC"}
1
+ {"version":3,"file":"Substack.node.js","sourceRoot":"","sources":["../../../nodes/Substack/Substack.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,+DAA+F;AAC/F,qDAAkD;AAClD,mDAAgD;AAEhD,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,mBAAmB,EAAE;YAC/D,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE;gBACT,IAAI,EAAE,UAAU;aAChB;YACD,MAAM,EAAE,QAAyB;YACjC,OAAO,EAAE,QAAyB;YAClC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,MAAM;yBACb;wBACD;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,MAAM;yBACb;qBACD;oBACD,OAAO,EAAE,MAAM;iBACf;gBAED,GAAG,oCAAc;gBACjB,GAAG,gCAAU;gBACb,GAAG,oCAAc;gBACjB,GAAG,gCAAU;aACb;SACD,CAAC;IA2EH,CAAC;IAzEA,KAA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AAO,EAAE;wBAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAxHD,4BAwHC"}
@@ -1,3 +1,5 @@
1
1
  import { INodeProperties } from 'n8n-workflow';
2
+ export declare const postOperations: INodeProperties[];
2
3
  export declare const noteOperations: INodeProperties[];
4
+ export declare const postFields: INodeProperties[];
3
5
  export declare const noteFields: INodeProperties[];
@@ -1,6 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.noteFields = exports.noteOperations = void 0;
3
+ exports.noteFields = exports.postFields = exports.noteOperations = exports.postOperations = void 0;
4
+ exports.postOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['post'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Get Many',
18
+ value: 'getAll',
19
+ description: 'Get many posts from the publication',
20
+ action: 'Get many posts',
21
+ },
22
+ ],
23
+ default: 'getAll',
24
+ },
25
+ ];
4
26
  exports.noteOperations = [
5
27
  {
6
28
  displayName: 'Operation',
@@ -18,27 +40,54 @@ exports.noteOperations = [
18
40
  value: 'create',
19
41
  description: 'Create a new Substack note',
20
42
  action: 'Create a note',
21
- routing: {
22
- request: {
23
- method: 'POST',
24
- url: '/api/v1/notes',
25
- },
26
- output: {
27
- postReceive: [
28
- {
29
- type: 'set',
30
- properties: {
31
- value: '={{ { "title": $response.body.title || $parameter.title, "success": true, "noteId": $response.body.id, "url": $response.body.url } }}',
32
- },
33
- },
34
- ],
35
- },
36
- },
43
+ },
44
+ {
45
+ name: 'Get',
46
+ value: 'get',
47
+ description: 'Retrieve notes from the publication',
48
+ action: 'Get notes',
37
49
  },
38
50
  ],
39
51
  default: 'create',
40
52
  },
41
53
  ];
54
+ const getAllOperation = [
55
+ {
56
+ displayName: 'Limit',
57
+ name: 'limit',
58
+ type: 'number',
59
+ default: 50,
60
+ description: 'Max number of results to return',
61
+ displayOptions: {
62
+ show: {
63
+ resource: ['post'],
64
+ operation: ['getAll'],
65
+ },
66
+ },
67
+ typeOptions: {
68
+ minValue: 1,
69
+ },
70
+ },
71
+ {
72
+ displayName: 'Offset',
73
+ name: 'offset',
74
+ type: 'number',
75
+ default: 0,
76
+ description: 'Number of posts to skip (for pagination)',
77
+ displayOptions: {
78
+ show: {
79
+ resource: ['post'],
80
+ operation: ['getAll'],
81
+ },
82
+ },
83
+ typeOptions: {
84
+ minValue: 0,
85
+ },
86
+ },
87
+ ];
88
+ exports.postFields = [
89
+ ...getAllOperation,
90
+ ];
42
91
  const createOperation = [
43
92
  {
44
93
  displayName: 'Title',
@@ -53,12 +102,6 @@ const createOperation = [
53
102
  operation: ['create'],
54
103
  },
55
104
  },
56
- routing: {
57
- send: {
58
- property: 'title',
59
- type: 'body',
60
- },
61
- },
62
105
  required: true,
63
106
  },
64
107
  {
@@ -77,16 +120,45 @@ const createOperation = [
77
120
  operation: ['create'],
78
121
  },
79
122
  },
80
- routing: {
81
- send: {
82
- property: 'body',
83
- type: 'body',
123
+ required: true,
124
+ },
125
+ ];
126
+ const getOperation = [
127
+ {
128
+ displayName: 'Limit',
129
+ name: 'limit',
130
+ type: 'number',
131
+ default: 50,
132
+ description: 'Max number of results to return',
133
+ displayOptions: {
134
+ show: {
135
+ resource: ['note'],
136
+ operation: ['get'],
137
+ },
138
+ },
139
+ typeOptions: {
140
+ minValue: 1,
141
+ },
142
+ },
143
+ {
144
+ displayName: 'Offset',
145
+ name: 'offset',
146
+ type: 'number',
147
+ default: 0,
148
+ description: 'Number of notes to skip',
149
+ displayOptions: {
150
+ show: {
151
+ resource: ['note'],
152
+ operation: ['get'],
84
153
  },
85
154
  },
86
- required: true,
155
+ typeOptions: {
156
+ minValue: 0,
157
+ },
87
158
  },
88
159
  ];
89
160
  exports.noteFields = [
90
161
  ...createOperation,
162
+ ...getOperation,
91
163
  ];
92
164
  //# sourceMappingURL=SubstackDescription.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubstackDescription.js","sourceRoot":"","sources":["../../../nodes/Substack/SubstackDescription.ts"],"names":[],"mappings":";;;AAGa,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;aAClB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,4BAA4B;gBACzC,MAAM,EAAE,eAAe;gBACvB,OAAO,EAAE;oBACR,OAAO,EAAE;wBACR,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,eAAe;qBACpB;oBACD,MAAM,EAAE;wBACP,WAAW,EAAE;4BACZ;gCACC,IAAI,EAAE,KAAK;gCACX,UAAU,EAAE;oCACX,KAAK,EAAE,uIAAuI;iCAC9I;6BACD;yBACD;qBACD;iBACD;aACD;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAGF,MAAM,eAAe,GAAsB;IAC1C;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,YAAY;QACzB,WAAW,EAAE,0BAA0B;QACvC,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;gBAClB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,OAAO,EAAE;YACR,IAAI,EAAE;gBACL,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,MAAM;aACZ;SACD;QACD,QAAQ,EAAE,IAAI;KACd;IACD;QACC,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE;YACZ,IAAI,EAAE,CAAC;SACP;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,8CAA8C;QAC3D,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;gBAClB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,OAAO,EAAE;YACR,IAAI,EAAE;gBACL,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,MAAM;aACZ;SACD;QACD,QAAQ,EAAE,IAAI;KACd;CACD,CAAC;AAEW,QAAA,UAAU,GAAsB;IAI5C,GAAG,eAAe;CAClB,CAAC"}
1
+ {"version":3,"file":"SubstackDescription.js","sourceRoot":"","sources":["../../../nodes/Substack/SubstackDescription.ts"],"names":[],"mappings":";;;AAGa,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;aAClB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,qCAAqC;gBAClD,MAAM,EAAE,gBAAgB;aACxB;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAGW,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAA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stackClient } from 'substack-api';
3
+ export declare class SubstackUtils {
4
+ static initializeClient(executeFunctions: IExecuteFunctions): Promise<{
5
+ client: SubstackClient;
6
+ publicationAddress: string;
7
+ }>;
8
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubstackUtils = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const substack_api_1 = require("substack-api");
6
+ class SubstackUtils {
7
+ static async initializeClient(executeFunctions) {
8
+ const credentials = await executeFunctions.getCredentials('substackApi');
9
+ const { publicationAddress, apiKey } = credentials;
10
+ if (!apiKey) {
11
+ throw new n8n_workflow_1.NodeOperationError(executeFunctions.getNode(), 'API key is required');
12
+ }
13
+ const client = new substack_api_1.Substack({
14
+ hostname: publicationAddress,
15
+ apiKey: apiKey,
16
+ });
17
+ return { client, publicationAddress: publicationAddress };
18
+ }
19
+ }
20
+ exports.SubstackUtils = SubstackUtils;
21
+ //# sourceMappingURL=SubstackUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubstackUtils.js","sourceRoot":"","sources":["../../../nodes/Substack/SubstackUtils.ts"],"names":[],"mappings":";;;AAAA,+CAAqE;AACrE,+CAA0D;AAE1D,MAAa,aAAa;IACzB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,gBAAmC;QAEhE,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QACzE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;QAEnD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,iCAAkB,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE,qBAAqB,CAAC,CAAC;QACjF,CAAC;QAGD,MAAM,MAAM,GAAG,IAAI,uBAAc,CAAC;YACjC,QAAQ,EAAE,kBAA4B;YACtC,MAAM,EAAE,MAAgB;SACxB,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,kBAA4B,EAAE,CAAC;IACrE,CAAC;CACD;AAlBD,sCAkBC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-substack",
3
- "version": "0.0.2",
3
+ "version": "0.2.0",
4
4
  "description": "n8n community node for Substack API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"
@@ -33,13 +33,9 @@
33
33
  "n8n": {
34
34
  "n8nNodesApiVersion": 1,
35
35
  "credentials": [
36
- "dist/credentials/ExampleCredentialsApi.credentials.js",
37
- "dist/credentials/HttpBinApi.credentials.js",
38
36
  "dist/credentials/SubstackApi.credentials.js"
39
37
  ],
40
38
  "nodes": [
41
- "dist/nodes/ExampleNode/ExampleNode.node.js",
42
- "dist/nodes/HttpBin/HttpBin.node.js",
43
39
  "dist/nodes/Substack/Substack.node.js"
44
40
  ]
45
41
  },
@@ -52,6 +48,9 @@
52
48
  "typescript": "^5.8.2"
53
49
  },
54
50
  "peerDependencies": {
55
- "n8n-workflow": "*"
51
+ "n8n-workflow": "^1.82.0"
52
+ },
53
+ "dependencies": {
54
+ "substack-api": "^0.5.0"
56
55
  }
57
56
  }