n8n-nodes-steyi-ss 1.0.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.
- package/README.md +192 -0
- package/dist/credentials/SteyiSmartsheetCreds.credentials.d.ts +9 -0
- package/dist/credentials/SteyiSmartsheetCreds.credentials.js +38 -0
- package/dist/nodes/SteyiSmartsheet/SteyiGenericFunction.d.ts +3 -0
- package/dist/nodes/SteyiSmartsheet/SteyiGenericFunction.js +58 -0
- package/dist/nodes/SteyiSmartsheet/SteyiSmartsheet.node.d.ts +19 -0
- package/dist/nodes/SteyiSmartsheet/SteyiSmartsheet.node.js +1988 -0
- package/dist/nodes/SteyiSmartsheet/SteyiSmartsheetApi.d.ts +24 -0
- package/dist/nodes/SteyiSmartsheet/SteyiSmartsheetApi.js +174 -0
- package/dist/nodes/SteyiSmartsheet/SteyiSmartsheetTrigger.node.d.ts +17 -0
- package/dist/nodes/SteyiSmartsheet/SteyiSmartsheetTrigger.node.js +173 -0
- package/dist/nodes/SteyiSmartsheet/executors/Admin.d.ts +2 -0
- package/dist/nodes/SteyiSmartsheet/executors/Admin.js +180 -0
- package/dist/nodes/SteyiSmartsheet/executors/Columns.d.ts +2 -0
- package/dist/nodes/SteyiSmartsheet/executors/Columns.js +53 -0
- package/dist/nodes/SteyiSmartsheet/executors/Reports.d.ts +2 -0
- package/dist/nodes/SteyiSmartsheet/executors/Reports.js +27 -0
- package/dist/nodes/SteyiSmartsheet/executors/Rows.d.ts +2 -0
- package/dist/nodes/SteyiSmartsheet/executors/Rows.js +845 -0
- package/dist/nodes/SteyiSmartsheet/executors/Sheets.d.ts +2 -0
- package/dist/nodes/SteyiSmartsheet/executors/Sheets.js +85 -0
- package/dist/nodes/SteyiSmartsheet/executors/Webhooks.d.ts +2 -0
- package/dist/nodes/SteyiSmartsheet/executors/Webhooks.js +67 -0
- package/dist/nodes/SteyiSmartsheet/steyi-smartsheet.svg +6 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# n8n-nodes-steyi-ss
|
|
2
|
+
|
|
3
|
+
An n8n community node for integrating with the Smartsheet API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
This node provides the following operations:
|
|
8
|
+
|
|
9
|
+
### Sheet Operations
|
|
10
|
+
- **List Sheets** - Get a list of all sheets in your Smartsheet account
|
|
11
|
+
- **Get Sheet** - Retrieve detailed information about a specific sheet
|
|
12
|
+
- **Create Sheet** - Create a new sheet
|
|
13
|
+
- **Update Sheet** - Update a sheet name
|
|
14
|
+
- **Delete Sheet** - Delete a sheet
|
|
15
|
+
|
|
16
|
+
### Row Operations
|
|
17
|
+
- **Add Row** - Add a new row to a sheet (with optional discussions, comments, and attachments)
|
|
18
|
+
- **Update Row** - Update an existing row in a sheet (with optional discussions, comments, and attachments)
|
|
19
|
+
- **Delete Row** - Delete a row from a sheet
|
|
20
|
+
|
|
21
|
+
### Column Operations
|
|
22
|
+
- **Get Columns** - Get all columns from a sheet
|
|
23
|
+
|
|
24
|
+
### Webhook Operations
|
|
25
|
+
- **List Webhooks** - List all webhooks in your account
|
|
26
|
+
- **Create Webhook** - Create a new webhook for a sheet
|
|
27
|
+
- **Update Webhook** - Update webhook settings (name, enabled status, events)
|
|
28
|
+
- **Delete Webhook** - Delete a webhook
|
|
29
|
+
|
|
30
|
+
### Webhook Trigger
|
|
31
|
+
- **Smartsheet Trigger** - A trigger node that starts workflows when Smartsheet events occur
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
### Using npm
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install n8n-nodes-steyi-ss
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Manual Installation
|
|
42
|
+
|
|
43
|
+
1. Clone this repository
|
|
44
|
+
2. Install dependencies:
|
|
45
|
+
```bash
|
|
46
|
+
npm install
|
|
47
|
+
```
|
|
48
|
+
3. Build the node:
|
|
49
|
+
```bash
|
|
50
|
+
npm run build
|
|
51
|
+
```
|
|
52
|
+
4. Copy the `dist/` directory to your n8n custom nodes directory:
|
|
53
|
+
```bash
|
|
54
|
+
# For n8n installed via npm
|
|
55
|
+
cp -r dist ~/.n8n/custom/n8n-nodes-steyi-ss/
|
|
56
|
+
cp package.json ~/.n8n/custom/n8n-nodes-steyi-ss/
|
|
57
|
+
|
|
58
|
+
# Then restart n8n
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For detailed deployment instructions, see [DEPLOYMENT.md](./DEPLOYMENT.md).
|
|
62
|
+
4. Link the node to your n8n installation:
|
|
63
|
+
```bash
|
|
64
|
+
npm link
|
|
65
|
+
```
|
|
66
|
+
5. In your n8n installation directory, link the node:
|
|
67
|
+
```bash
|
|
68
|
+
npm link n8n-nodes-steyi-ss
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
### Credentials
|
|
74
|
+
|
|
75
|
+
1. Go to your n8n credentials settings
|
|
76
|
+
2. Add a new "Smartsheet API" credential
|
|
77
|
+
3. Enter your Smartsheet API access token
|
|
78
|
+
|
|
79
|
+
To get your API token:
|
|
80
|
+
1. Log in to Smartsheet
|
|
81
|
+
2. Go to Account → Apps & Integrations → API Access
|
|
82
|
+
3. Generate a new access token
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
### List Sheets
|
|
87
|
+
|
|
88
|
+
Use this operation to retrieve all sheets in your account. No additional parameters are required.
|
|
89
|
+
|
|
90
|
+
### Get Sheet
|
|
91
|
+
|
|
92
|
+
Retrieve detailed information about a specific sheet:
|
|
93
|
+
- **Sheet ID**: The ID of the sheet you want to retrieve
|
|
94
|
+
- **Include** (optional): Additional fields to include (attachments, discussions, format, etc.)
|
|
95
|
+
|
|
96
|
+
### Get Columns
|
|
97
|
+
|
|
98
|
+
Get all columns from a specific sheet:
|
|
99
|
+
- **Sheet ID**: The ID of the sheet
|
|
100
|
+
|
|
101
|
+
### Add Row
|
|
102
|
+
|
|
103
|
+
Add a new row to a sheet:
|
|
104
|
+
- **Sheet ID**: The ID of the sheet
|
|
105
|
+
- **Cells**: Array of cells with Column ID and Value
|
|
106
|
+
- **To Top** (optional): Whether to add the row to the top of the sheet
|
|
107
|
+
|
|
108
|
+
### Update Row
|
|
109
|
+
|
|
110
|
+
Update an existing row:
|
|
111
|
+
- **Sheet ID**: The ID of the sheet
|
|
112
|
+
- **Row ID**: The ID of the row to update
|
|
113
|
+
- **Cells**: Array of cells with Column ID and Value to update
|
|
114
|
+
|
|
115
|
+
### Delete Row
|
|
116
|
+
|
|
117
|
+
Delete a row from a sheet:
|
|
118
|
+
- **Sheet ID**: The ID of the sheet
|
|
119
|
+
- **Row ID**: The ID of the row to delete
|
|
120
|
+
|
|
121
|
+
### Webhook Operations
|
|
122
|
+
|
|
123
|
+
#### List Webhooks
|
|
124
|
+
List all webhooks in your account. No additional parameters required.
|
|
125
|
+
|
|
126
|
+
#### Create Webhook
|
|
127
|
+
Create a new webhook for a sheet:
|
|
128
|
+
- **Sheet ID**: The ID of the sheet to monitor
|
|
129
|
+
- **Callback URL**: The publicly accessible URL that Smartsheet will call (see note below)
|
|
130
|
+
- **Webhook Name** (optional): Name for the webhook
|
|
131
|
+
- **Events**: Events to subscribe to (default: all events)
|
|
132
|
+
|
|
133
|
+
#### Update Webhook
|
|
134
|
+
Update an existing webhook:
|
|
135
|
+
- **Webhook ID**: The ID of the webhook to update
|
|
136
|
+
- **Update Fields**: Fields to update (name, enabled status, events)
|
|
137
|
+
|
|
138
|
+
#### Delete Webhook
|
|
139
|
+
Delete a webhook:
|
|
140
|
+
- **Webhook ID**: The ID of the webhook to delete
|
|
141
|
+
|
|
142
|
+
### Webhook Trigger
|
|
143
|
+
|
|
144
|
+
The Smartsheet Trigger node allows workflows to start automatically when Smartsheet events occur:
|
|
145
|
+
- **Type**: Type of webhook (currently supports Sheet)
|
|
146
|
+
- **Sheet ID**: The ID of the sheet to monitor
|
|
147
|
+
|
|
148
|
+
**Important Note about Webhooks and Localhost:**
|
|
149
|
+
|
|
150
|
+
Smartsheet webhooks require a publicly accessible URL. If you're running n8n on localhost, webhooks will return 400 errors because Smartsheet cannot reach your local machine. To use webhooks with a local n8n instance, you need to:
|
|
151
|
+
|
|
152
|
+
1. **Use a tunneling service** like ngrok:
|
|
153
|
+
```bash
|
|
154
|
+
ngrok http 5678
|
|
155
|
+
```
|
|
156
|
+
Then use the ngrok URL (e.g., `https://abc123.ngrok.io`) as your webhook URL.
|
|
157
|
+
|
|
158
|
+
2. **Deploy n8n to a public server** or use n8n Cloud.
|
|
159
|
+
|
|
160
|
+
3. **Configure n8n's WEBHOOK_URL environment variable** to point to your public URL.
|
|
161
|
+
|
|
162
|
+
For the trigger node, n8n automatically generates the webhook URL, but it must be publicly accessible for Smartsheet to reach it.
|
|
163
|
+
|
|
164
|
+
## API Documentation
|
|
165
|
+
|
|
166
|
+
For more information about the Smartsheet API, visit:
|
|
167
|
+
https://smartsheet-platform.github.io/api-docs/
|
|
168
|
+
|
|
169
|
+
## Development
|
|
170
|
+
|
|
171
|
+
### Building
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npm run build
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Linting
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm run lint
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Formatting
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm run format
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT
|
|
192
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class SteyiSmartsheetCreds implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SteyiSmartsheetCreds = void 0;
|
|
4
|
+
class SteyiSmartsheetCreds {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'steyiSmartsheetCreds';
|
|
7
|
+
this.displayName = 'Steyi Smartsheet API';
|
|
8
|
+
this.documentationUrl = 'https://smartsheet-platform.github.io/api-docs/';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Token',
|
|
12
|
+
name: 'apiToken',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: {
|
|
15
|
+
password: true,
|
|
16
|
+
},
|
|
17
|
+
default: '',
|
|
18
|
+
description: 'Your Smartsheet API access token',
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
this.authenticate = {
|
|
23
|
+
type: 'generic',
|
|
24
|
+
properties: {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: '=Bearer {{$credentials.apiToken}}',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
this.test = {
|
|
31
|
+
request: {
|
|
32
|
+
baseURL: 'https://api.smartsheet.com/2.0',
|
|
33
|
+
url: '/users/me',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.SteyiSmartsheetCreds = SteyiSmartsheetCreds;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare function smartsheetApiRequest(this: IExecuteFunctions, method: string, endpoint: string, body?: any, itemIndex?: number): Promise<any>;
|
|
3
|
+
export declare function smartsheetFileUpload(this: IExecuteFunctions, endpoint: string, fileName: string, fileData: any, mimeType: string, itemIndex?: number): Promise<any>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.smartsheetFileUpload = exports.smartsheetApiRequest = void 0;
|
|
4
|
+
async function smartsheetApiRequest(method, endpoint, body = {}, itemIndex = 0) {
|
|
5
|
+
const credentials = await this.getCredentials('steyiSmartsheetCreds');
|
|
6
|
+
const baseURL = 'https://api.smartsheet.com/2.0';
|
|
7
|
+
const url = endpoint.startsWith('http') ? endpoint : `${baseURL}${endpoint}`;
|
|
8
|
+
const options = {
|
|
9
|
+
method,
|
|
10
|
+
url,
|
|
11
|
+
headers: {
|
|
12
|
+
'Accept': 'application/json',
|
|
13
|
+
'Authorization': `Bearer ${credentials.apiToken}`,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
if (Object.keys(body).length > 0) {
|
|
17
|
+
options.headers['Content-Type'] = 'application/json';
|
|
18
|
+
options.body = body;
|
|
19
|
+
}
|
|
20
|
+
return await this.helpers.httpRequest(options);
|
|
21
|
+
}
|
|
22
|
+
exports.smartsheetApiRequest = smartsheetApiRequest;
|
|
23
|
+
async function smartsheetFileUpload(endpoint, fileName, fileData, mimeType, itemIndex = 0) {
|
|
24
|
+
const credentials = await this.getCredentials('steyiSmartsheetCreds');
|
|
25
|
+
const baseURL = 'https://api.smartsheet.com/2.0';
|
|
26
|
+
const url = endpoint.startsWith('http') ? endpoint : `${baseURL}${endpoint}`;
|
|
27
|
+
// Verify fileData is a Buffer
|
|
28
|
+
if (!fileData || typeof fileData === 'string') {
|
|
29
|
+
throw new Error(`Invalid file data. Expected Buffer, got ${typeof fileData}`);
|
|
30
|
+
}
|
|
31
|
+
// Get file size from buffer - Buffer.length is already in bytes
|
|
32
|
+
// This is the raw byte count, not a formatted string like "7.98 MB"
|
|
33
|
+
const fileSizeInBytes = fileData.length;
|
|
34
|
+
// Validate file size is a number
|
|
35
|
+
if (typeof fileSizeInBytes !== 'number' || isNaN(fileSizeInBytes)) {
|
|
36
|
+
throw new Error(`Invalid file size. Expected number of bytes, got ${typeof fileSizeInBytes}`);
|
|
37
|
+
}
|
|
38
|
+
// Smartsheet API expects raw binary data with specific headers (not multipart/form-data)
|
|
39
|
+
// Format: --data-binary with Content-Type, Content-Disposition, and Content-Length headers
|
|
40
|
+
// Content-Length must be in bytes (as a string representation of the number)
|
|
41
|
+
// The endpoint determines if it's a proof (/proofs) or regular attachment (/attachments)
|
|
42
|
+
const options = {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
url,
|
|
45
|
+
headers: {
|
|
46
|
+
'Accept': 'application/json',
|
|
47
|
+
'Authorization': `Bearer ${credentials.apiToken}`,
|
|
48
|
+
'Content-Type': mimeType,
|
|
49
|
+
'Content-Disposition': `attachment; filename="${fileName}"`,
|
|
50
|
+
'Content-Length': fileSizeInBytes.toString(), // Convert number to string (e.g., "8364032" for ~8MB)
|
|
51
|
+
},
|
|
52
|
+
body: fileData, // Send raw binary data
|
|
53
|
+
returnFullResponse: false,
|
|
54
|
+
};
|
|
55
|
+
// Use httpRequest for raw binary upload
|
|
56
|
+
return await this.helpers.httpRequest(options);
|
|
57
|
+
}
|
|
58
|
+
exports.smartsheetFileUpload = smartsheetFileUpload;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class SteyiSmartsheet implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getSheets(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
+
getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
8
|
+
getDiscussions(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
9
|
+
getWebhooks(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
10
|
+
getReports(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
11
|
+
getWorkspaces(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
12
|
+
getFolders(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
13
|
+
getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
14
|
+
getGroups(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
15
|
+
getGroupMembers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
19
|
+
}
|