n8n-nodes-linq 0.1.2 → 0.1.3
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.
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LinqTrigger = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class LinqTrigger {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Linq Trigger',
|
|
9
|
+
name: 'linqTrigger',
|
|
10
|
+
icon: 'file:linq.svg',
|
|
11
|
+
group: ['trigger'],
|
|
12
|
+
version: 1,
|
|
13
|
+
description: 'Handle Linq webhook events',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Linq Trigger',
|
|
16
|
+
},
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: ["main" /* NodeConnectionType.Main */],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'linqApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
webhooks: [
|
|
26
|
+
{
|
|
27
|
+
name: 'default',
|
|
28
|
+
httpMethod: 'POST',
|
|
29
|
+
responseCode: '200',
|
|
30
|
+
path: 'webhook',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Events',
|
|
36
|
+
name: 'events',
|
|
37
|
+
type: 'multiOptions',
|
|
38
|
+
options: [
|
|
39
|
+
{
|
|
40
|
+
name: 'Call Completed',
|
|
41
|
+
value: 'call.completed',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Contact Created',
|
|
45
|
+
value: 'contact.created',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Contact Deleted',
|
|
49
|
+
value: 'contact.deleted',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Contact Updated',
|
|
53
|
+
value: 'contact.updated',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Message Read',
|
|
57
|
+
value: 'message.read',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Message Received',
|
|
61
|
+
value: 'message.received',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Message Sent',
|
|
65
|
+
value: 'message.sent',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
default: [],
|
|
69
|
+
description: 'Select the events to listen for',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async webhook() {
|
|
75
|
+
const bodyData = this.getBodyData();
|
|
76
|
+
const headers = this.getHeaderData();
|
|
77
|
+
const event = headers['x-linq-event'];
|
|
78
|
+
const signature = headers['x-linq-signature'];
|
|
79
|
+
// Verify signature (optional but recommended)
|
|
80
|
+
const credentials = await this.getCredentials('linqApi');
|
|
81
|
+
const crypto = require('crypto');
|
|
82
|
+
const expectedSignature = crypto
|
|
83
|
+
.createHmac('sha256', credentials.integrationToken)
|
|
84
|
+
.update(JSON.stringify(bodyData))
|
|
85
|
+
.digest('hex');
|
|
86
|
+
if (signature !== expectedSignature) {
|
|
87
|
+
throw new n8n_workflow_1.ApplicationError('Invalid signature');
|
|
88
|
+
}
|
|
89
|
+
// Return the event data to start the workflow
|
|
90
|
+
const returnData = [
|
|
91
|
+
{
|
|
92
|
+
json: {
|
|
93
|
+
event,
|
|
94
|
+
payload: bodyData,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
return {
|
|
99
|
+
workflowData: [returnData],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.LinqTrigger = LinqTrigger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-linq",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Linq API integration for n8n",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"dist/credentials/LinqApi.credentials.js"
|
|
37
37
|
],
|
|
38
38
|
"nodes": [
|
|
39
|
-
"dist/nodes/Linq/Linq.node.js"
|
|
39
|
+
"dist/nodes/Linq/Linq.node.js",
|
|
40
|
+
"dist/nodes/LinqTrigger/LinqTrigger.node.js"
|
|
40
41
|
]
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|