n8n-nodes-netsapiens 0.1.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/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/credentials/NetSapiensApi.credentials.d.ts +10 -0
- package/dist/credentials/NetSapiensApi.credentials.js +59 -0
- package/dist/credentials/NetSapiensApi.credentials.js.map +1 -0
- package/dist/generated/openapi.d.ts +22 -0
- package/dist/generated/openapi.js +13590 -0
- package/dist/generated/openapi.js.map +1 -0
- package/dist/nodes/NetSapiens/NetSapiens.dark.svg +7 -0
- package/dist/nodes/NetSapiens/NetSapiens.node.d.ts +12 -0
- package/dist/nodes/NetSapiens/NetSapiens.node.js +715 -0
- package/dist/nodes/NetSapiens/NetSapiens.node.js.map +1 -0
- package/dist/nodes/NetSapiens/NetSapiens.node.json +18 -0
- package/dist/nodes/NetSapiens/NetSapiens.svg +7 -0
- package/dist/overrides/operations.overrides.d.ts +14 -0
- package/dist/overrides/operations.overrides.js +6 -0
- package/dist/overrides/operations.overrides.js.map +1 -0
- package/dist/package.json +54 -0
- package/dist/tools/generate-openapi.d.ts +1 -0
- package/dist/tools/generate-openapi.js +3 -0
- package/dist/tools/generate-openapi.js.map +1 -0
- package/dist/transport/request.d.ts +15 -0
- package/dist/transport/request.js +51 -0
- package/dist/transport/request.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Szpunar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# n8n-nodes-netsapiens
|
|
2
|
+
|
|
3
|
+
This is an n8n community node. It lets you interact with the NetSapiens API in your n8n workflows.
|
|
4
|
+
|
|
5
|
+
NetSapiens is a Voice over IP (VoIP) phone switch software provider that provides a REST API (the `ns-api`) that can be used to manage and query resources in a NetSapiens environment.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation)
|
|
10
|
+
[Operations](#operations)
|
|
11
|
+
[Credentials](#credentials)
|
|
12
|
+
[Compatibility](#compatibility)
|
|
13
|
+
[Usage](#usage)
|
|
14
|
+
[Resources](#resources)
|
|
15
|
+
[Version history](#version-history)
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
20
|
+
|
|
21
|
+
## Operations
|
|
22
|
+
|
|
23
|
+
This node is primarily driven by a bundled OpenAPI specification. In most cases you:
|
|
24
|
+
|
|
25
|
+
- **Select a resource** (an API grouping)
|
|
26
|
+
- **Select an operation** (an API endpoint action)
|
|
27
|
+
|
|
28
|
+
The node then renders fields for the endpoint parameters.
|
|
29
|
+
|
|
30
|
+
In addition, the node includes a **Raw -> Request** operation that lets you call arbitrary endpoints directly when you need full control.
|
|
31
|
+
|
|
32
|
+
NetSapiens provides the [API JSON Schema](https://docs.ns-api.com/docs/download-full-api-json-schema-file) as part of their documentation, which this node uses to generate the basic node interface. The node also implements a number of overrides to handle NetSapiens-specific details and add additional functionality and affordances.
|
|
33
|
+
|
|
34
|
+
Read operations are substantially better tested and usable than write calls, which may require build custom JSON objects for crate and update requests initially.
|
|
35
|
+
|
|
36
|
+
## Credentials
|
|
37
|
+
|
|
38
|
+
Create a new **NetSapiens API** credential. This node is designed for [API Keys](https://docs.ns-api.com/docs/api-keys) (bearer tokens) only, not refresh/access tokens or other authentication methods. Oauth Access Tokens and JWT Tokens are not supported, nor does NetSapiens provide documentation for these in version 2 of the API.
|
|
39
|
+
|
|
40
|
+
Only NetSapiens API version 2 supports API keys, and this node only connects to API version 2 endpoints (though the API key would be valid for API version 1 as well, for versions of NetSapiens that support API version 2 credentials).
|
|
41
|
+
|
|
42
|
+
- **Server**: Your NetSapiens API hostname (without protocol)
|
|
43
|
+
- **Bearer Token**: An API key (bearer token) used for API requests
|
|
44
|
+
- **Base URL** (optional): Override the full base URL. If empty, the node defaults to `https://{server}/ns-api/v2`.
|
|
45
|
+
|
|
46
|
+
Obtain an API key from your NetSapiens provider if you are a Reseller user, or obtain the API key directly from your NetSapiens instance if you have administrator access.
|
|
47
|
+
|
|
48
|
+
NetSapiens, as of this writing, runs a [Developer Sandbox](https://docs.ns-api.com/docs/developer-sandbox-ns-apicom) where you can test API usage if you would like.
|
|
49
|
+
|
|
50
|
+
NetSapiens provides an [API v1 Migration to v2 reference](https://docs.ns-api.com/docs/v1-migration-to-v2) to review so you can determine differences between the API versions if you're familiar with version 1.
|
|
51
|
+
|
|
52
|
+
## Compatibility
|
|
53
|
+
|
|
54
|
+
- **Minimum n8n version**: Developed and tested with version `2.0.3+` but will likely work with several prior versions.
|
|
55
|
+
- **Tested with**: Local development via `n8n-node dev`
|
|
56
|
+
- **Tested with**: NetSapiens Version 44.3.2
|
|
57
|
+
|
|
58
|
+
**Note:** The OpenAPI spec used to implement this node is not from a well-defined version, though it's older than 45.0 and likely is for a version of 44.x when API v2 was introduced. The 45.0 spec provided by NetSapiens has a substantial numer of changes and additions and this node may not be fully compatible with it until it's updated in the future (however, you can use the Raw API Request option to make calls to endpoints that are not yet implemented).
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
### Basic usage
|
|
63
|
+
|
|
64
|
+
- **Resource**: Select an API resource grouping.
|
|
65
|
+
- **Operation**: Select the specific endpoint action.
|
|
66
|
+
- **Parameters**:
|
|
67
|
+
- Path and query parameters appear as node fields.
|
|
68
|
+
- If the endpoint has a request body, a **Body** JSON field is shown.
|
|
69
|
+
|
|
70
|
+
### Raw request
|
|
71
|
+
|
|
72
|
+
If you need an endpoint that is not represented (or you want full control), use the Raw API request:
|
|
73
|
+
|
|
74
|
+
- **Resource**: `Raw`
|
|
75
|
+
- **Operation**: `Raw API Request`
|
|
76
|
+
|
|
77
|
+
Then set:
|
|
78
|
+
|
|
79
|
+
- **Method**
|
|
80
|
+
- **Endpoint** (for example: `/domains`)
|
|
81
|
+
- **Query Parameters**
|
|
82
|
+
- **Body** (for non-GET/non-DELETE requests)
|
|
83
|
+
|
|
84
|
+
### Development
|
|
85
|
+
|
|
86
|
+
From `n8n-nodes-netsapiens/`:
|
|
87
|
+
|
|
88
|
+
- `npm install` installs dependencies.
|
|
89
|
+
- `npm run generate` regenerates `generated/openapi.ts` from `openapi/NetSapiens.v2.3.1.0.openapi.json`.
|
|
90
|
+
- `npm run build` runs code generation and builds the node.
|
|
91
|
+
- `npm run dev` runs the node in development mode directly, launching n8n, or:
|
|
92
|
+
- Use `npm link` to link the node to n8n (and then `npm link n8n-nodes-netsapiens` in your n8n instance `config` directory and restart n8n).
|
|
93
|
+
|
|
94
|
+
### Notes / open questions
|
|
95
|
+
|
|
96
|
+
Please confirm your preference for the following behaviors:
|
|
97
|
+
|
|
98
|
+
- Whether Authentication resources/actions should be hidden by default in the node UI.
|
|
99
|
+
- Whether `Raw -> Request` should remain the default resource/operation (or whether a specific resource/operation should be the default).
|
|
100
|
+
|
|
101
|
+
## Resources
|
|
102
|
+
|
|
103
|
+
* [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
104
|
+
* [NetSapiens API documentation](https://docs.ns-api.com/)
|
|
105
|
+
* There's a public [NetSapiens MCP server](https://docs.ns-api.com/v45.0/docs/mcp-1) starting with version 45.0 for testing at `https://docs.ns-api.com/mcp?branch=45.0`. No authentication is required.
|
|
106
|
+
|
|
107
|
+
## Changelog
|
|
108
|
+
|
|
109
|
+
For a version history of changes and updates, see the [CHANGELOG.md](CHANGELOG.md) file.
|
|
110
|
+
|
|
111
|
+
## TODO
|
|
112
|
+
|
|
113
|
+
See [TODO.md](TODO.md).
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
NetSapiens is A Crexendo Company and they own the trademarks and intellectual property rights to the NetSapiens brand. This node is not affiliated with NetSapiens or Crexendo in any way and is provided as a service to the n8n community.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class NetSapiensApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetSapiensApi = void 0;
|
|
4
|
+
class NetSapiensApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'netSapiensApi';
|
|
7
|
+
this.displayName = 'NetSapiens API';
|
|
8
|
+
this.icon = {
|
|
9
|
+
light: 'file:../nodes/NetSapiens/NetSapiens.svg',
|
|
10
|
+
dark: 'file:../nodes/NetSapiens/NetSapiens.dark.svg',
|
|
11
|
+
};
|
|
12
|
+
this.documentationUrl = 'https://github.com/<...>/n8n-nodes-<...>?tab=readme-ov-file#credentials';
|
|
13
|
+
this.properties = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Server',
|
|
16
|
+
name: 'server',
|
|
17
|
+
type: 'string',
|
|
18
|
+
default: '',
|
|
19
|
+
description: 'Hostname for your NetSapiens environment (without protocol)',
|
|
20
|
+
required: true,
|
|
21
|
+
placeholder: 'example.netsapiens.com',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
displayName: 'Bearer Token',
|
|
25
|
+
name: 'bearerToken',
|
|
26
|
+
type: 'string',
|
|
27
|
+
typeOptions: {
|
|
28
|
+
password: true,
|
|
29
|
+
},
|
|
30
|
+
default: '',
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Base URL',
|
|
35
|
+
name: 'baseUrl',
|
|
36
|
+
type: 'string',
|
|
37
|
+
default: '',
|
|
38
|
+
description: 'Optional override. If empty, https://{server}/ns-api/v2 is used.',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
this.authenticate = {
|
|
42
|
+
type: 'generic',
|
|
43
|
+
properties: {
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: '={{"Bearer " + $credentials.bearerToken}}',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
this.test = {
|
|
50
|
+
request: {
|
|
51
|
+
baseURL: '={{$credentials.baseUrl ? $credentials.baseUrl : ("https://" + $credentials.server + "/ns-api/v2")}}',
|
|
52
|
+
url: '/domains',
|
|
53
|
+
method: 'GET',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.NetSapiensApi = NetSapiensApi;
|
|
59
|
+
//# sourceMappingURL=NetSapiensApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetSapiensApi.credentials.js","sourceRoot":"","sources":["../../credentials/NetSapiensApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QAEvB,gBAAW,GAAG,gBAAgB,CAAC;QAE/B,SAAI,GAAS;YACZ,KAAK,EAAE,yCAAyC;YAChD,IAAI,EAAE,8CAA8C;SACpD,CAAC;QAEF,qBAAgB,GAAG,yEAAyE,CAAC;QAE7F,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,6DAA6D;gBAC1E,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,wBAAwB;aACrC;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,kEAAkE;aAC/E;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,2CAA2C;iBAC1D;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EACN,sGAAsG;gBACvG,GAAG,EAAE,UAAU;gBACf,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AA1DD,sCA0DC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE';
|
|
2
|
+
export type ParameterLocation = 'path' | 'query' | 'header';
|
|
3
|
+
export type GeneratedOpenApiParameter = {
|
|
4
|
+
name: string;
|
|
5
|
+
in: ParameterLocation;
|
|
6
|
+
required: boolean;
|
|
7
|
+
description?: string;
|
|
8
|
+
schemaType?: string;
|
|
9
|
+
};
|
|
10
|
+
export type GeneratedOpenApiOperation = {
|
|
11
|
+
id: string;
|
|
12
|
+
method: HttpMethod;
|
|
13
|
+
path: string;
|
|
14
|
+
resource: string;
|
|
15
|
+
summary?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
parameters: GeneratedOpenApiParameter[];
|
|
18
|
+
hasRequestBody: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const resources: readonly string[];
|
|
21
|
+
export declare const operations: readonly GeneratedOpenApiOperation[];
|
|
22
|
+
export declare const operationMap: Record<string, GeneratedOpenApiOperation>;
|