n8n-nodes-sevdesk-v2
Version:
n8n community node for SevDesk API v2 integration with 24 production-ready workflow templates. Direct API access without external dependencies - simplified, secure, and optimized for German accounting automation (n8n 1.101.1 compatible).
112 lines (111 loc) • 4.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SevDeskApi = void 0;
class SevDeskApi {
constructor() {
this.name = "sevDeskApi";
this.displayName = "sevDesk API";
this.documentationUrl = "https://api.sevdesk.de/#section/Authentication-and-Authorization";
this.properties = [
{
displayName: "API Key",
name: "apiKey",
type: "string",
typeOptions: {
password: true,
minLength: 10,
maxLength: 200,
},
default: "",
required: true,
description: "Your SevDesk API key. You can find it in your SevDesk account under Settings → User Management → API. The key should start with your user ID followed by an underscore.",
placeholder: "123456_abcdef1234567890abcdef1234567890",
},
{
displayName: "API Version",
name: "apiVersion",
type: "options",
options: [
{
name: "v1 (Legacy)",
value: "v1",
description: "Legacy API version - use only for existing integrations",
},
{
name: "v2 (Recommended)",
value: "v2",
description: "Current API version with enhanced features and better performance",
},
],
default: "v2",
required: true,
description: "The SevDesk API version to use. v2 is recommended for new implementations as it provides better performance, enhanced features, and improved error handling.",
},
];
this.authenticate = {
type: "generic",
properties: {
headers: {
Authorization: "={{$credentials.apiKey}}",
},
},
};
this.test = {
request: {
baseURL: "https://my.sevdesk.de/api/{{$credentials.apiVersion}}",
url: "/Contact",
method: "GET",
qs: {
limit: 1,
},
timeout: 10000,
},
rules: [
{
type: "responseSuccessBody",
properties: {
key: "objects",
message: "API key is valid and SevDesk API is accessible",
value: "",
},
},
{
type: "responseFailedStatusCode",
properties: {
statusCode: 401,
message: "Invalid API key. Please check your SevDesk API key and ensure it has the correct format (userID_token).",
},
},
{
type: "responseFailedStatusCode",
properties: {
statusCode: 403,
message: "Access forbidden. Your API key may not have sufficient permissions or your SevDesk account may not have API access enabled.",
},
},
{
type: "responseFailedStatusCode",
properties: {
statusCode: 429,
message: "Rate limit exceeded. Please wait a moment before testing the credentials again.",
},
},
{
type: "responseFailedStatusCode",
properties: {
statusCode: 500,
message: "SevDesk server error. Please try again later or contact SevDesk support if the issue persists.",
},
},
{
type: "responseFailedStatusCode",
properties: {
statusCode: 503,
message: "SevDesk service temporarily unavailable. Please try again in a few minutes.",
},
},
],
};
}
}
exports.SevDeskApi = SevDeskApi;