n8n-nodes-hamkar 3.0.10 → 3.0.12
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,12 @@
|
|
|
1
|
+
import { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class HamkarTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhookMethods: {
|
|
5
|
+
default: {
|
|
6
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
7
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
8
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HamkarTrigger = void 0;
|
|
4
|
+
class HamkarTrigger {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'Hamkar Trigger',
|
|
8
|
+
name: 'hamkarTrigger',
|
|
9
|
+
icon: 'file:hamkar.svg',
|
|
10
|
+
group: ['trigger'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '={{$parameter["event"]}}',
|
|
13
|
+
description: 'Starts the workflow when Hamkar events occur',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Hamkar Trigger',
|
|
16
|
+
},
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'hamkarApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
webhooks: [
|
|
26
|
+
{
|
|
27
|
+
name: 'default',
|
|
28
|
+
httpMethod: 'POST',
|
|
29
|
+
responseMode: 'onReceived',
|
|
30
|
+
path: 'webhook',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Event',
|
|
36
|
+
name: 'event',
|
|
37
|
+
type: 'options',
|
|
38
|
+
options: [
|
|
39
|
+
{
|
|
40
|
+
name: 'Contact Created',
|
|
41
|
+
value: 'contact.created',
|
|
42
|
+
description: 'Triggers when a new contact is created',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Contact Updated',
|
|
46
|
+
value: 'contact.updated',
|
|
47
|
+
description: 'Triggers when a contact is updated',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Contact Deleted',
|
|
51
|
+
value: 'contact.deleted',
|
|
52
|
+
description: 'Triggers when a contact is deleted',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'Record Created',
|
|
56
|
+
value: 'record.created',
|
|
57
|
+
description: 'Triggers when a new record is created',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Record Updated',
|
|
61
|
+
value: 'record.updated',
|
|
62
|
+
description: 'Triggers when a record is updated',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Record Deleted',
|
|
66
|
+
value: 'record.deleted',
|
|
67
|
+
description: 'Triggers when a record is deleted',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
default: 'contact.created',
|
|
71
|
+
description: 'The event to listen to',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
this.webhookMethods = {
|
|
76
|
+
default: {
|
|
77
|
+
async checkExists() {
|
|
78
|
+
return false;
|
|
79
|
+
},
|
|
80
|
+
async create() {
|
|
81
|
+
return true;
|
|
82
|
+
},
|
|
83
|
+
async delete() {
|
|
84
|
+
return true;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
async webhook() {
|
|
90
|
+
const bodyData = this.getBodyData();
|
|
91
|
+
const event = this.getNodeParameter('event');
|
|
92
|
+
// Verify the event matches
|
|
93
|
+
if (bodyData.event && bodyData.event !== event) {
|
|
94
|
+
// Event doesn't match, don't trigger
|
|
95
|
+
return {
|
|
96
|
+
workflowData: [[]],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// Return the webhook data
|
|
100
|
+
return {
|
|
101
|
+
workflowData: [this.helpers.returnJsonArray(bodyData)],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.HamkarTrigger = HamkarTrigger;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-hamkar",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.12",
|
|
4
4
|
"description": "n8n node for Hamkar.co API - Contact and Record management operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"dist/credentials/HamkarApi.credentials.js"
|
|
38
38
|
],
|
|
39
39
|
"nodes": [
|
|
40
|
-
"dist/nodes/Hamkar/Hamkar.node.js"
|
|
40
|
+
"dist/nodes/Hamkar/Hamkar.node.js",
|
|
41
|
+
"dist/nodes/Hamkar/HamkarTrigger.node.js"
|
|
41
42
|
]
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|