n8n-nodes-linq 0.1.2 → 0.1.4
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
CHANGED
|
@@ -19,17 +19,17 @@ Linq Partner API (v2) community node for n8n. This node lets you manage chats, m
|
|
|
19
19
|
|
|
20
20
|
## Credentials
|
|
21
21
|
|
|
22
|
-
Create a new credential of type
|
|
22
|
+
Create a new credential of type "Linq API" and set your Integration Token:
|
|
23
23
|
|
|
24
24
|
- Header used: `X-LINQ-INTEGRATION-TOKEN: <your token>`
|
|
25
25
|
- The field is hidden in the UI (password type).
|
|
26
26
|
|
|
27
|
-
Where it
|
|
27
|
+
Where it's defined:
|
|
28
28
|
- [class LinqApi implements ICredentialType](credentials/LinqApi.credentials.ts:1)
|
|
29
29
|
|
|
30
30
|
## Node usage
|
|
31
31
|
|
|
32
|
-
Add the
|
|
32
|
+
Add the "Linq" node to your workflow. The node provides Resources and Operations that map 1:1 to the documented Linq Partner API endpoints.
|
|
33
33
|
|
|
34
34
|
- Node implementation:
|
|
35
35
|
- [class Linq implements INodeType](nodes/Linq/Linq.node.ts:1)
|
|
@@ -61,32 +61,49 @@ The node implements all endpoints from your Linq Partner API documentation (v2):
|
|
|
61
61
|
- Resource: Phone Number
|
|
62
62
|
- Operations:
|
|
63
63
|
- Get Many → GET `/phone_numbers`
|
|
64
|
-
- Check iMessage Availability →
|
|
64
|
+
- Check iMessage Availability → GET `/phone_numbers/:phoneNumber/check_imessage`
|
|
65
65
|
|
|
66
66
|
- Resource: Webhook Subscription
|
|
67
67
|
- Operations:
|
|
68
68
|
- Get Many → GET `/webhook_subscriptions`
|
|
69
69
|
- Get One → GET `/webhook_subscriptions/:id`
|
|
70
|
-
- Create → POST `/webhook_subscriptions`
|
|
71
|
-
- Update → PUT `/webhook_subscriptions/:id`
|
|
70
|
+
- Create → POST `/webhook_subscriptions`
|
|
71
|
+
- Update → PUT `/webhook_subscriptions/:id`
|
|
72
72
|
- Delete → DELETE `/webhook_subscriptions/:id`
|
|
73
73
|
|
|
74
74
|
- Resource: Contact
|
|
75
75
|
- Operations:
|
|
76
|
-
- Create → POST `/contacts`
|
|
76
|
+
- Create → POST `/contacts`
|
|
77
77
|
- Get One → GET `/contacts/:id`
|
|
78
|
-
- Update → PUT `/contacts/:id`
|
|
78
|
+
- Update → PUT `/contacts/:id`
|
|
79
79
|
- Delete → DELETE `/contacts/:id`
|
|
80
80
|
|
|
81
|
-
###
|
|
81
|
+
### Linq Trigger Node
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
- Filtering (chats, find): `phoneNumber`
|
|
85
|
-
- IDs: `chatId`, `chatMessageId`, `contactId`, `webhookSubscriptionId`
|
|
83
|
+
Add the "Linq Trigger" node to automatically start workflows when Linq events occur. The node automatically registers a webhook with Linq when the workflow is activated.
|
|
86
84
|
|
|
87
|
-
|
|
85
|
+
- Supported Events:
|
|
86
|
+
- Message Sent (`message.sent`)
|
|
87
|
+
- Message Received (`message.received`)
|
|
88
|
+
- Message Read (`message.read`)
|
|
89
|
+
- Call Completed (`call.completed`)
|
|
90
|
+
- Contact Created (`contact.created`)
|
|
91
|
+
- Contact Updated (`contact.updated`)
|
|
92
|
+
- Contact Deleted (`contact.deleted`)
|
|
88
93
|
|
|
89
|
-
|
|
94
|
+
- Configuration:
|
|
95
|
+
1. Add the "Linq Trigger" node to your workflow
|
|
96
|
+
2. Select which events should trigger the workflow
|
|
97
|
+
3. Activate the workflow (this registers the webhook with Linq)
|
|
98
|
+
4. Linq will send events to your workflow when they occur
|
|
99
|
+
|
|
100
|
+
- Security:
|
|
101
|
+
- The node verifies the signature of incoming events using HMAC-SHA256
|
|
102
|
+
- Requires the same Linq API credentials as the main node
|
|
103
|
+
|
|
104
|
+
### Example workflows
|
|
105
|
+
|
|
106
|
+
1) Send a group message
|
|
90
107
|
- Resource: Chat
|
|
91
108
|
- Operation: Create
|
|
92
109
|
- Fields:
|
|
@@ -140,7 +157,7 @@ Local link for testing in a local n8n:
|
|
|
140
157
|
npm link
|
|
141
158
|
# in your n8n folder
|
|
142
159
|
npm link n8n-nodes-linq
|
|
143
|
-
# restart n8n, then add
|
|
160
|
+
# restart n8n, then add "Linq" node
|
|
144
161
|
```
|
|
145
162
|
|
|
146
163
|
Project files of interest:
|
|
@@ -174,9 +191,3 @@ npm publish --access public
|
|
|
174
191
|
- Node description references it as `icon: 'file:linq.svg'`, so it renders in the n8n UI.
|
|
175
192
|
|
|
176
193
|
## License
|
|
177
|
-
|
|
178
|
-
MIT — see [LICENSE.md](LICENSE.md:1)
|
|
179
|
-
|
|
180
|
-
## Support
|
|
181
|
-
|
|
182
|
-
Issues and suggestions are welcome. Please open an issue in your repository once you push the source (see `repository` field in [package.json](package.json:1)).
|
|
@@ -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.4",
|
|
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": {
|