n8n-nodes-innotes 1.0.18 → 1.0.20
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/dist/credentials/InNotesApi.credentials.js +10 -0
- package/dist/credentials/InNotesApi.credentials.js.map +1 -1
- package/dist/credentials/InNotesApi.credentials.ts +10 -0
- package/dist/descriptions/AutomationDescription.js +91 -0
- package/dist/descriptions/AutomationDescription.js.map +1 -0
- package/dist/nodes/InNotes/InNotes.node.js +101 -11
- package/dist/nodes/InNotes/InNotes.node.js.map +1 -1
- package/dist/package.json +7 -8
- package/dist/test/InNotes.node.test.js +1425 -100
- package/dist/test/InNotes.node.test.js.map +1 -1
- package/package.json +7 -8
|
@@ -83,6 +83,16 @@ class InNotesApi {
|
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
|
+
{
|
|
87
|
+
displayName: 'Callback Secret',
|
|
88
|
+
name: 'callbackSecret',
|
|
89
|
+
type: 'string',
|
|
90
|
+
typeOptions: {
|
|
91
|
+
password: true,
|
|
92
|
+
},
|
|
93
|
+
default: '',
|
|
94
|
+
description: 'Secret key for automation callbacks. Required for the "Report Job Created" action. Found in your InNotes dashboard automation settings.',
|
|
95
|
+
},
|
|
86
96
|
{
|
|
87
97
|
displayName: 'Allowed Domains',
|
|
88
98
|
name: 'allowedDomains',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../credentials/InNotesApi.credentials.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAUH,MAAa,UAAU;IAAvB;QACC,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,oBAAoB,CAAC;QACxC,SAAI,GAAS,mBAAmB,CAAC;QACjC,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oBAAoB;g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AAuF;oBACxG,UAAU,EAAE,oFAAoF;oBAChG,UAAU,EAAE,oFAAoF;iBAChG;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,WAAW;gBAChB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAjHD,gCAiHC","file":"InNotesApi.credentials.js","sourcesContent":["/**\n * Author: Marco Visin\n * Date: 2025-06-02\n * Updated to support Bearer token authentication\n */\n\nimport {\n\tIAuthenticateGeneric,\n\tICredentialTestRequest,\n\tICredentialType,\n\tINodeProperties,\n\tIcon,\n} from 'n8n-workflow';\n\nexport class InNotesApi implements ICredentialType {\n\tname = 'inNotesApi';\n\tdisplayName = 'InNotes API';\n\tdocumentationUrl = 'https://innotes.me';\n\ticon: Icon = 'file:Logo_128.png';\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Base URL',\n\t\t\tname: 'baseUrl',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'https://innotes.me',\n\t\t\tdescription: 'The base URL of your InNotes instance',\n\t\t\trequired: true,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Authentication Method',\n\t\t\tname: 'authMethod',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Bearer Token',\n\t\t\t\t\tvalue: 'token',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Username/Password (Legacy)',\n\t\t\t\t\tvalue: 'credentials',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'token',\n\t\t\tdescription: 'Choose your authentication method. Bearer token is recommended.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Bearer Token',\n\t\t\tname: 'token',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tdescription: 'Your InNotes API Bearer token. Generate one in your dashboard settings.',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tauthMethod: ['token'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Username',\n\t\t\tname: 'username',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tdescription: 'Your InNotes username',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tauthMethod: ['credentials'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Password',\n\t\t\tname: 'password',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tdescription: 'Your InNotes password',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tauthMethod: ['credentials'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Callback Secret',\n\t\t\tname: 'callbackSecret',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tdescription: 'Secret key for automation callbacks. Required for the \"Report Job Created\" action. Found in your InNotes dashboard automation settings.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Allowed Domains',\n\t\t\tname: 'allowedDomains',\n\t\t\ttype: 'string',\n\t\t\tdefault: '*',\n\t\t\tdescription: 'Domains allowed to use this credential (use * for all)',\n\t\t},\n\t];\n\n\tauthenticate: IAuthenticateGeneric = {\n\t\ttype: 'generic',\n\t\tproperties: {\n\t\t\theaders: {\n\t\t\t\t'Authorization': '={{$credentials.authMethod === \"token\" ? \"Bearer \" + $credentials.token : undefined}}',\n\t\t\t\t'username': '={{$credentials.authMethod === \"credentials\" ? $credentials.username : undefined}}',\n\t\t\t\t'password': '={{$credentials.authMethod === \"credentials\" ? $credentials.password : undefined}}',\n\t\t\t},\n\t\t},\n\t};\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '={{$credentials.baseUrl}}',\n\t\t\turl: '/api/user',\n\t\t\tmethod: 'GET',\n\t\t},\n\t};\n}\n"]}
|
|
@@ -88,6 +88,16 @@ export class InNotesApi implements ICredentialType {
|
|
|
88
88
|
},
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Callback Secret',
|
|
93
|
+
name: 'callbackSecret',
|
|
94
|
+
type: 'string',
|
|
95
|
+
typeOptions: {
|
|
96
|
+
password: true,
|
|
97
|
+
},
|
|
98
|
+
default: '',
|
|
99
|
+
description: 'Secret key for automation callbacks. Required for the "Report Job Created" action. Found in your InNotes dashboard automation settings.',
|
|
100
|
+
},
|
|
91
101
|
{
|
|
92
102
|
displayName: 'Allowed Domains',
|
|
93
103
|
name: 'allowedDomains',
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @author Marco
|
|
4
|
+
* @date 2025-12-28
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.automationFields = exports.automationOperations = void 0;
|
|
8
|
+
exports.automationOperations = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Operation',
|
|
11
|
+
name: 'operation',
|
|
12
|
+
type: 'options',
|
|
13
|
+
noDataExpression: true,
|
|
14
|
+
displayOptions: {
|
|
15
|
+
show: {
|
|
16
|
+
resource: ['automation'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
options: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Get Config',
|
|
22
|
+
value: 'getConfig',
|
|
23
|
+
description: 'Get automation configuration including AI model settings',
|
|
24
|
+
action: 'Get automation config',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Report Job Created',
|
|
28
|
+
value: 'reportJobCreated',
|
|
29
|
+
description: 'Report to InNotes that a job was created by the automation workflow',
|
|
30
|
+
action: 'Report job created',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
default: 'getConfig',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
exports.automationFields = [
|
|
37
|
+
// reportJobCreated fields
|
|
38
|
+
{
|
|
39
|
+
displayName: 'Jobs Added',
|
|
40
|
+
name: 'jobsAdded',
|
|
41
|
+
type: 'number',
|
|
42
|
+
required: true,
|
|
43
|
+
displayOptions: {
|
|
44
|
+
show: {
|
|
45
|
+
resource: ['automation'],
|
|
46
|
+
operation: ['reportJobCreated'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
default: 1,
|
|
50
|
+
description: 'Number of jobs added by this workflow execution',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Status',
|
|
54
|
+
name: 'status',
|
|
55
|
+
type: 'options',
|
|
56
|
+
displayOptions: {
|
|
57
|
+
show: {
|
|
58
|
+
resource: ['automation'],
|
|
59
|
+
operation: ['reportJobCreated'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
name: 'Success',
|
|
65
|
+
value: 'success',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Error',
|
|
69
|
+
value: 'error',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
default: 'success',
|
|
73
|
+
description: 'Status of the workflow execution',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Error Message',
|
|
77
|
+
name: 'errorMessage',
|
|
78
|
+
type: 'string',
|
|
79
|
+
displayOptions: {
|
|
80
|
+
show: {
|
|
81
|
+
resource: ['automation'],
|
|
82
|
+
operation: ['reportJobCreated'],
|
|
83
|
+
status: ['error'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
default: '',
|
|
87
|
+
description: 'Error message if the workflow failed',
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=AutomationDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../descriptions/AutomationDescription.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,QAAA,oBAAoB,GAAsB;IACtD;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,YAAY,CAAC;aACxB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,0DAA0D;gBACvE,MAAM,EAAE,uBAAuB;aAC/B;YACD;gBACC,IAAI,EAAE,oBAAoB;gBAC1B,KAAK,EAAE,kBAAkB;gBACzB,WAAW,EAAE,qEAAqE;gBAClF,MAAM,EAAE,oBAAoB;aAC5B;SACD;QACD,OAAO,EAAE,WAAW;KACpB;CACD,CAAC;AAEW,QAAA,gBAAgB,GAAsB;IAClD,0BAA0B;IAC1B;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,YAAY,CAAC;gBACxB,SAAS,EAAE,CAAC,kBAAkB,CAAC;aAC/B;SACD;QACD,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,iDAAiD;KAC9D;IACD;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,YAAY,CAAC;gBACxB,SAAS,EAAE,CAAC,kBAAkB,CAAC;aAC/B;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,SAAS;aAChB;YACD;gBACC,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO;aACd;SACD;QACD,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,kCAAkC;KAC/C;IACD;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,YAAY,CAAC;gBACxB,SAAS,EAAE,CAAC,kBAAkB,CAAC;gBAC/B,MAAM,EAAE,CAAC,OAAO,CAAC;aACjB;SACD;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,sCAAsC;KACnD;CACD,CAAC","file":"AutomationDescription.js","sourcesContent":["/**\n * @author Marco\n * @date 2025-12-28\n */\n\nimport {INodeProperties} from 'n8n-workflow';\n\nexport const automationOperations: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['automation'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Get Config',\n\t\t\t\tvalue: 'getConfig',\n\t\t\t\tdescription: 'Get automation configuration including AI model settings',\n\t\t\t\taction: 'Get automation config',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Report Job Created',\n\t\t\t\tvalue: 'reportJobCreated',\n\t\t\t\tdescription: 'Report to InNotes that a job was created by the automation workflow',\n\t\t\t\taction: 'Report job created',\n\t\t\t},\n\t\t],\n\t\tdefault: 'getConfig',\n\t},\n];\n\nexport const automationFields: INodeProperties[] = [\n\t// reportJobCreated fields\n\t{\n\t\tdisplayName: 'Jobs Added',\n\t\tname: 'jobsAdded',\n\t\ttype: 'number',\n\t\trequired: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['automation'],\n\t\t\t\toperation: ['reportJobCreated'],\n\t\t\t},\n\t\t},\n\t\tdefault: 1,\n\t\tdescription: 'Number of jobs added by this workflow execution',\n\t},\n\t{\n\t\tdisplayName: 'Status',\n\t\tname: 'status',\n\t\ttype: 'options',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['automation'],\n\t\t\t\toperation: ['reportJobCreated'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Success',\n\t\t\t\tvalue: 'success',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Error',\n\t\t\t\tvalue: 'error',\n\t\t\t},\n\t\t],\n\t\tdefault: 'success',\n\t\tdescription: 'Status of the workflow execution',\n\t},\n\t{\n\t\tdisplayName: 'Error Message',\n\t\tname: 'errorMessage',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['automation'],\n\t\t\t\toperation: ['reportJobCreated'],\n\t\t\t\tstatus: ['error'],\n\t\t\t},\n\t\t},\n\t\tdefault: '',\n\t\tdescription: 'Error message if the workflow failed',\n\t},\n];\n"]}
|
|
@@ -12,6 +12,7 @@ const JobDescription_1 = require("../../descriptions/JobDescription");
|
|
|
12
12
|
const StatusDescription_1 = require("../../descriptions/StatusDescription");
|
|
13
13
|
const TagDescription_1 = require("../../descriptions/TagDescription");
|
|
14
14
|
const UserDescription_1 = require("../../descriptions/UserDescription");
|
|
15
|
+
const AutomationDescription_1 = require("../../descriptions/AutomationDescription");
|
|
15
16
|
class InNotes {
|
|
16
17
|
constructor() {
|
|
17
18
|
this.description = {
|
|
@@ -40,6 +41,10 @@ class InNotes {
|
|
|
40
41
|
type: 'options',
|
|
41
42
|
noDataExpression: true,
|
|
42
43
|
options: [
|
|
44
|
+
{
|
|
45
|
+
name: 'Automation',
|
|
46
|
+
value: 'automation',
|
|
47
|
+
},
|
|
43
48
|
{
|
|
44
49
|
name: 'Contact',
|
|
45
50
|
value: 'contact',
|
|
@@ -67,12 +72,14 @@ class InNotes {
|
|
|
67
72
|
],
|
|
68
73
|
default: 'contact',
|
|
69
74
|
},
|
|
75
|
+
...AutomationDescription_1.automationOperations,
|
|
70
76
|
...ContactDescription_1.contactOperations,
|
|
71
77
|
...NoteDescription_1.noteOperations,
|
|
72
78
|
...JobDescription_1.jobOperations,
|
|
73
79
|
...StatusDescription_1.statusOperations,
|
|
74
80
|
...TagDescription_1.tagOperations,
|
|
75
81
|
...UserDescription_1.userOperations,
|
|
82
|
+
...AutomationDescription_1.automationFields,
|
|
76
83
|
...ContactDescription_1.contactFields,
|
|
77
84
|
...NoteDescription_1.noteFields,
|
|
78
85
|
...JobDescription_1.jobFields,
|
|
@@ -163,7 +170,10 @@ class InNotes {
|
|
|
163
170
|
const actualIndex = batchStart + i;
|
|
164
171
|
try {
|
|
165
172
|
let responseData = {};
|
|
166
|
-
if (resource === '
|
|
173
|
+
if (resource === 'automation') {
|
|
174
|
+
responseData = await nodeInstance.executeAutomationOperation(this, actualIndex, operation);
|
|
175
|
+
}
|
|
176
|
+
else if (resource === 'contact') {
|
|
167
177
|
responseData = await nodeInstance.executeContactOperation(this, actualIndex, operation);
|
|
168
178
|
}
|
|
169
179
|
else if (resource === 'note') {
|
|
@@ -203,6 +213,88 @@ class InNotes {
|
|
|
203
213
|
}
|
|
204
214
|
return [this.helpers.returnJsonArray(returnData)];
|
|
205
215
|
}
|
|
216
|
+
async executeAutomationOperation(executeFunctions, itemIndex, operation) {
|
|
217
|
+
const credentials = await executeFunctions.getCredentials('inNotesApi');
|
|
218
|
+
const baseUrl = credentials.baseUrl;
|
|
219
|
+
if (operation === 'getConfig') {
|
|
220
|
+
try {
|
|
221
|
+
const response = await executeFunctions.helpers.httpRequestWithAuthentication.call(executeFunctions, 'inNotesApi', {
|
|
222
|
+
method: 'GET',
|
|
223
|
+
url: `${baseUrl}/api/automation/config`,
|
|
224
|
+
headers: {
|
|
225
|
+
Accept: 'application/json',
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
return response;
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
|
|
232
|
+
message: `Failed to get automation config: ${error.message}`,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (operation === 'reportJobCreated') {
|
|
237
|
+
const jobsAdded = executeFunctions.getNodeParameter('jobsAdded', itemIndex, 1);
|
|
238
|
+
const status = executeFunctions.getNodeParameter('status', itemIndex, 'success');
|
|
239
|
+
const errorMessage = executeFunctions.getNodeParameter('errorMessage', itemIndex, '');
|
|
240
|
+
// Get the callback secret from credentials
|
|
241
|
+
const callbackSecret = credentials.callbackSecret;
|
|
242
|
+
if (!callbackSecret) {
|
|
243
|
+
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
|
|
244
|
+
message: 'Callback secret not configured in InNotes API credentials. Please add the callback secret to your credentials.',
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
// Get user ID from the API
|
|
248
|
+
let userId;
|
|
249
|
+
try {
|
|
250
|
+
const userResponse = await executeFunctions.helpers.httpRequestWithAuthentication.call(executeFunctions, 'inNotesApi', {
|
|
251
|
+
method: 'GET',
|
|
252
|
+
url: `${baseUrl}/api/user`,
|
|
253
|
+
headers: {
|
|
254
|
+
Accept: 'application/json',
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
userId = userResponse.id;
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
|
|
261
|
+
message: `Failed to get user ID: ${error.message}`,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
const body = {
|
|
265
|
+
userId,
|
|
266
|
+
status,
|
|
267
|
+
jobsAdded,
|
|
268
|
+
secret: callbackSecret,
|
|
269
|
+
...(status === 'error' && errorMessage && { error: errorMessage }),
|
|
270
|
+
};
|
|
271
|
+
try {
|
|
272
|
+
const response = await executeFunctions.helpers.httpRequestWithAuthentication.call(executeFunctions, 'inNotesApi', {
|
|
273
|
+
method: 'POST',
|
|
274
|
+
url: `${baseUrl}/api/automation/callback`,
|
|
275
|
+
body,
|
|
276
|
+
headers: {
|
|
277
|
+
Accept: 'application/json',
|
|
278
|
+
'Content-Type': 'application/json',
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
return {
|
|
282
|
+
success: true,
|
|
283
|
+
...response,
|
|
284
|
+
jobsAdded,
|
|
285
|
+
status,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
|
|
290
|
+
message: `Failed to report job created: ${error.message}`,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
|
|
295
|
+
message: `The operation "${operation}" is not supported for resource "automation"!`,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
206
298
|
async executeContactOperation(executeFunctions, itemIndex, operation) {
|
|
207
299
|
const credentials = await executeFunctions.getCredentials('inNotesApi');
|
|
208
300
|
const baseUrl = credentials.baseUrl;
|
|
@@ -434,9 +526,9 @@ class InNotes {
|
|
|
434
526
|
});
|
|
435
527
|
// Find matching status by name (case-insensitive)
|
|
436
528
|
const statuses = Array.isArray(statusResponse) ? statusResponse : [statusResponse];
|
|
437
|
-
const matchingStatus = statuses.find((s) => s.name
|
|
529
|
+
const matchingStatus = statuses.find((s) => { var _a; return ((_a = s.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === status.toLowerCase(); });
|
|
438
530
|
if (matchingStatus) {
|
|
439
|
-
status_id = matchingStatus.id
|
|
531
|
+
status_id = parseInt(matchingStatus.id, 10);
|
|
440
532
|
}
|
|
441
533
|
else {
|
|
442
534
|
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
|
|
@@ -456,7 +548,6 @@ class InNotes {
|
|
|
456
548
|
const body = {
|
|
457
549
|
name,
|
|
458
550
|
company_name,
|
|
459
|
-
status,
|
|
460
551
|
...(description && { description }),
|
|
461
552
|
...(location && { location }),
|
|
462
553
|
...(remote_setting && { remote_setting }),
|
|
@@ -465,7 +556,7 @@ class InNotes {
|
|
|
465
556
|
...(url && { url }),
|
|
466
557
|
...(status_id && { status_id }),
|
|
467
558
|
...(ext_id && { ext_id }),
|
|
468
|
-
...(picture_url && { picture_url }),
|
|
559
|
+
...(picture_url && picture_url !== 'Not Available' && { picture_url }),
|
|
469
560
|
...(tags && { tags: tags.split(',').map((tag) => tag.trim()) }),
|
|
470
561
|
};
|
|
471
562
|
try {
|
|
@@ -484,7 +575,6 @@ class InNotes {
|
|
|
484
575
|
const requestParams = {
|
|
485
576
|
name,
|
|
486
577
|
company_name,
|
|
487
|
-
status,
|
|
488
578
|
...(description && { description }),
|
|
489
579
|
...(location && { location }),
|
|
490
580
|
...(remote_setting && { remote_setting }),
|
|
@@ -493,7 +583,7 @@ class InNotes {
|
|
|
493
583
|
...(url && { url }),
|
|
494
584
|
...(status_id && { status_id }),
|
|
495
585
|
...(ext_id && { ext_id }),
|
|
496
|
-
...(picture_url && { picture_url }),
|
|
586
|
+
...(picture_url && picture_url !== 'Not Available' && { picture_url }),
|
|
497
587
|
...(tags && { tags: tags.split(',').map((tag) => tag.trim()) }),
|
|
498
588
|
};
|
|
499
589
|
throw new n8n_workflow_1.NodeApiError(executeFunctions.getNode(), {
|
|
@@ -567,10 +657,10 @@ class InNotes {
|
|
|
567
657
|
});
|
|
568
658
|
// Find matching status by name (case-insensitive)
|
|
569
659
|
const statuses = Array.isArray(statusResponse) ? statusResponse : [statusResponse];
|
|
570
|
-
const matchingStatus = statuses.find((s) => s.name
|
|
660
|
+
const matchingStatus = statuses.find((s) => { var _a; return ((_a = s.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === updateFields.status.toLowerCase(); });
|
|
571
661
|
if (matchingStatus) {
|
|
572
662
|
// Replace status with status_id and remove status field
|
|
573
|
-
updateFields.status_id = matchingStatus.id
|
|
663
|
+
updateFields.status_id = parseInt(matchingStatus.id, 10);
|
|
574
664
|
delete updateFields.status;
|
|
575
665
|
}
|
|
576
666
|
else {
|
|
@@ -696,7 +786,7 @@ class InNotes {
|
|
|
696
786
|
// If we get here, the job exists by ID
|
|
697
787
|
return { exists: true, found_by: 'job_id', id };
|
|
698
788
|
}
|
|
699
|
-
catch
|
|
789
|
+
catch {
|
|
700
790
|
// Job not found by ID, try searching by ext_id
|
|
701
791
|
const searchResponse = await executeFunctions.helpers.httpRequestWithAuthentication.call(executeFunctions, 'inNotesApi', {
|
|
702
792
|
method: 'GET',
|
|
@@ -854,7 +944,7 @@ class InNotes {
|
|
|
854
944
|
companyBlacklist = parsedPreferences.companyBlacklist || [];
|
|
855
945
|
}
|
|
856
946
|
}
|
|
857
|
-
catch
|
|
947
|
+
catch {
|
|
858
948
|
// If parsing fails, keep empty arrays
|
|
859
949
|
}
|
|
860
950
|
}
|