n8n-nodes-hamkar 3.1.1 → 3.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.
package/README.md
CHANGED
|
@@ -12,13 +12,13 @@ This is an n8n community node for integrating with the Hamkar.co API. It allows
|
|
|
12
12
|
|
|
13
13
|
## 📑 Quick Links
|
|
14
14
|
|
|
15
|
-
- [Installation](#installation)
|
|
16
|
-
- [Operations](#operations)
|
|
17
|
-
- [Credentials](#credentials)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Operations](#operations)
|
|
17
|
+
- [Credentials](#credentials)
|
|
18
18
|
- [Trigger Node](#trigger-node)
|
|
19
|
-
- [Example Workflows](#example-workflows)
|
|
20
|
-
- [Compatibility](#compatibility)
|
|
21
|
-
- [Resources](#resources)
|
|
19
|
+
- [Example Workflows](#example-workflows)
|
|
20
|
+
- [Compatibility](#compatibility)
|
|
21
|
+
- [Resources](#resources)
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
@@ -43,12 +43,14 @@ The Hamkar package includes two nodes:
|
|
|
43
43
|
### 1. Hamkar Node (Regular Operations)
|
|
44
44
|
|
|
45
45
|
#### Contact Operations
|
|
46
|
+
|
|
46
47
|
- **Create**: Create a new contact with name, phone numbers, address, and type (legal/natural)
|
|
47
48
|
- **Update**: Update an existing contact by ID
|
|
48
49
|
- **Delete**: Delete a contact by ID (or archive using update)
|
|
49
50
|
- **Get Many**: Retrieve multiple contacts with optional search filtering
|
|
50
51
|
|
|
51
52
|
#### Record Operations
|
|
53
|
+
|
|
52
54
|
- **Create**: Create a new record with contact information, products, and custom field answers
|
|
53
55
|
- **Update**: Update an existing record by ID
|
|
54
56
|
- **Delete**: Delete a record by ID
|
|
@@ -59,11 +61,13 @@ The Hamkar package includes two nodes:
|
|
|
59
61
|
Automatically triggers workflows when events occur in Hamkar:
|
|
60
62
|
|
|
61
63
|
#### Contact Triggers
|
|
64
|
+
|
|
62
65
|
- **Contact Created**: Triggers when a new contact is created
|
|
63
66
|
- **Contact Updated**: Triggers when a contact is modified
|
|
64
67
|
- **Contact Deleted**: Triggers when a contact is deleted
|
|
65
68
|
|
|
66
69
|
#### Record Triggers
|
|
70
|
+
|
|
67
71
|
- **Record Created**: Triggers when a new record is created
|
|
68
72
|
- **Record Updated**: Triggers when a record is modified
|
|
69
73
|
- **Record Deleted**: Triggers when a record is deleted
|
|
@@ -80,6 +84,7 @@ To use this node, you need a Hamkar API key:
|
|
|
80
84
|
4. Copy your API key (X-API-Key)
|
|
81
85
|
|
|
82
86
|
In n8n:
|
|
87
|
+
|
|
83
88
|
1. Go to **Credentials > New**
|
|
84
89
|
2. Search for **Hamkar API**
|
|
85
90
|
3. Paste your API key
|
|
@@ -95,6 +100,7 @@ In n8n:
|
|
|
95
100
|
### Creating a Contact
|
|
96
101
|
|
|
97
102
|
To create a contact, you need to provide:
|
|
103
|
+
|
|
98
104
|
- **Name**: Contact name
|
|
99
105
|
- **Phone Number**: Mobile phone number
|
|
100
106
|
- **Telephone Number** (optional): Landline number
|
|
@@ -105,6 +111,7 @@ To create a contact, you need to provide:
|
|
|
105
111
|
### Creating a Record
|
|
106
112
|
|
|
107
113
|
To create a record, you need to provide:
|
|
114
|
+
|
|
108
115
|
- **Tag**: Status title/tag
|
|
109
116
|
- **Topic**: Topic title
|
|
110
117
|
- **Due Date**: Date in YYYY-MM-DD format
|
|
@@ -123,6 +130,7 @@ Provide the **Record ID** of the record you want to delete.
|
|
|
123
130
|
### Listing Records
|
|
124
131
|
|
|
125
132
|
You can:
|
|
133
|
+
|
|
126
134
|
- Return all records or limit the number
|
|
127
135
|
- Use a search query to filter results
|
|
128
136
|
|
|
@@ -131,11 +139,13 @@ You can:
|
|
|
131
139
|
### Setup Webhook Triggers
|
|
132
140
|
|
|
133
141
|
1. **In n8n:**
|
|
142
|
+
|
|
134
143
|
- Add "Hamkar Trigger" node to your workflow
|
|
135
144
|
- Select the event you want to listen for
|
|
136
145
|
- Copy the webhook URL provided
|
|
137
146
|
|
|
138
147
|
2. **In Hamkar.co:**
|
|
148
|
+
|
|
139
149
|
- Navigate to Settings → Webhooks (if available)
|
|
140
150
|
- Add the webhook URL from n8n
|
|
141
151
|
- Select which events to send
|
|
@@ -224,8 +234,8 @@ For more examples and detailed guides, see [DOCUMENTATION.md](DOCUMENTATION.md).
|
|
|
224
234
|
|
|
225
235
|
## Resources
|
|
226
236
|
|
|
227
|
-
|
|
228
|
-
|
|
237
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
238
|
+
- [Hamkar.co API Documentation](https://dev-api.hamkar.co/docs)
|
|
229
239
|
|
|
230
240
|
## Development
|
|
231
241
|
|
|
@@ -269,6 +279,7 @@ Before asking for help, check these resources:
|
|
|
269
279
|
### Reporting Bugs
|
|
270
280
|
|
|
271
281
|
When reporting an issue, please include:
|
|
282
|
+
|
|
272
283
|
- n8n version
|
|
273
284
|
- Node package version
|
|
274
285
|
- Error message (full text)
|
|
@@ -282,8 +293,8 @@ See [CHANGELOG.md](CHANGELOG.md) for version history and updates.
|
|
|
282
293
|
**Current Version**: 3.0.12
|
|
283
294
|
|
|
284
295
|
### Recent Updates
|
|
296
|
+
|
|
285
297
|
- ✅ Added Hamkar Trigger node for automatic workflows
|
|
286
298
|
- ✅ Support for Contact and Record events
|
|
287
299
|
- ✅ Improved icon and UI elements
|
|
288
300
|
- ✅ Comprehensive documentation and guides
|
|
289
|
-
|
|
@@ -5,7 +5,7 @@ class HamkarApi {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this.name = 'hamkarApi';
|
|
7
7
|
this.displayName = 'Hamkar API';
|
|
8
|
-
this.documentationUrl = 'https://api.hamkar.co/docs';
|
|
8
|
+
this.documentationUrl = 'https://dev-api.hamkar.co/docs';
|
|
9
9
|
this.properties = [
|
|
10
10
|
{
|
|
11
11
|
displayName: 'API Key',
|
|
@@ -29,7 +29,7 @@ class HamkarApi {
|
|
|
29
29
|
};
|
|
30
30
|
this.test = {
|
|
31
31
|
request: {
|
|
32
|
-
baseURL: 'https://api.hamkar.co',
|
|
32
|
+
baseURL: 'https://dev-api.hamkar.co',
|
|
33
33
|
url: '/api/record/',
|
|
34
34
|
method: 'GET',
|
|
35
35
|
},
|
|
@@ -529,7 +529,7 @@ class Hamkar {
|
|
|
529
529
|
// Make API request
|
|
530
530
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
531
531
|
method: 'POST',
|
|
532
|
-
url: 'https://api.hamkar.co/api/contact/',
|
|
532
|
+
url: 'https://dev-api.hamkar.co/api/contact/',
|
|
533
533
|
body,
|
|
534
534
|
json: true,
|
|
535
535
|
});
|
|
@@ -560,7 +560,7 @@ class Hamkar {
|
|
|
560
560
|
// Make API request (supports both PUT and PATCH)
|
|
561
561
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
562
562
|
method: 'PUT',
|
|
563
|
-
url: `https://api.hamkar.co/api/contact/${contactId}`,
|
|
563
|
+
url: `https://dev-api.hamkar.co/api/contact/${contactId}`,
|
|
564
564
|
body,
|
|
565
565
|
json: true,
|
|
566
566
|
});
|
|
@@ -571,7 +571,7 @@ class Hamkar {
|
|
|
571
571
|
// Make API request
|
|
572
572
|
await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
573
573
|
method: 'DELETE',
|
|
574
|
-
url: `https://api.hamkar.co/api/contact/${contactId}`,
|
|
574
|
+
url: `https://dev-api.hamkar.co/api/contact/${contactId}`,
|
|
575
575
|
json: true,
|
|
576
576
|
});
|
|
577
577
|
returnData.push({ success: true, contact_id: contactId });
|
|
@@ -579,7 +579,7 @@ class Hamkar {
|
|
|
579
579
|
if (operation === 'getMany') {
|
|
580
580
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
581
581
|
const search = this.getNodeParameter('search', i, '');
|
|
582
|
-
let url = 'https://api.hamkar.co/api/contact/';
|
|
582
|
+
let url = 'https://dev-api.hamkar.co/api/contact/';
|
|
583
583
|
const qs = {};
|
|
584
584
|
if (search) {
|
|
585
585
|
qs.search = search;
|
|
@@ -589,12 +589,12 @@ class Hamkar {
|
|
|
589
589
|
let hasMore = true;
|
|
590
590
|
let nextUrl = url;
|
|
591
591
|
while (hasMore) {
|
|
592
|
-
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
592
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
593
593
|
method: 'GET',
|
|
594
594
|
url: nextUrl,
|
|
595
595
|
qs: nextUrl === url ? qs : {},
|
|
596
596
|
json: true,
|
|
597
|
-
});
|
|
597
|
+
}));
|
|
598
598
|
const results = response.results;
|
|
599
599
|
returnData.push(...results);
|
|
600
600
|
if (response.next) {
|
|
@@ -607,13 +607,13 @@ class Hamkar {
|
|
|
607
607
|
}
|
|
608
608
|
else {
|
|
609
609
|
const limit = this.getNodeParameter('limit', i);
|
|
610
|
-
qs.
|
|
611
|
-
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
610
|
+
qs.page_size = limit;
|
|
611
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
612
612
|
method: 'GET',
|
|
613
613
|
url,
|
|
614
614
|
qs,
|
|
615
615
|
json: true,
|
|
616
|
-
});
|
|
616
|
+
}));
|
|
617
617
|
const results = response.results;
|
|
618
618
|
returnData.push(...results);
|
|
619
619
|
}
|
|
@@ -655,7 +655,7 @@ class Hamkar {
|
|
|
655
655
|
// Make API request
|
|
656
656
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
657
657
|
method: 'POST',
|
|
658
|
-
url: 'https://api.hamkar.co/api/record/',
|
|
658
|
+
url: 'https://dev-api.hamkar.co/api/record/',
|
|
659
659
|
body,
|
|
660
660
|
json: true,
|
|
661
661
|
});
|
|
@@ -697,7 +697,7 @@ class Hamkar {
|
|
|
697
697
|
// Make API request
|
|
698
698
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
699
699
|
method: 'PUT',
|
|
700
|
-
url: `https://api.hamkar.co/api/record/${recordId}`,
|
|
700
|
+
url: `https://dev-api.hamkar.co/api/record/${recordId}`,
|
|
701
701
|
body,
|
|
702
702
|
json: true,
|
|
703
703
|
});
|
|
@@ -708,7 +708,7 @@ class Hamkar {
|
|
|
708
708
|
// Make API request
|
|
709
709
|
await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
710
710
|
method: 'DELETE',
|
|
711
|
-
url: `https://api.hamkar.co/api/record/${recordId}`,
|
|
711
|
+
url: `https://dev-api.hamkar.co/api/record/${recordId}`,
|
|
712
712
|
json: true,
|
|
713
713
|
});
|
|
714
714
|
returnData.push({ success: true, id: recordId });
|
|
@@ -716,7 +716,7 @@ class Hamkar {
|
|
|
716
716
|
if (operation === 'getMany') {
|
|
717
717
|
const returnAll = this.getNodeParameter('returnAll', i);
|
|
718
718
|
const search = this.getNodeParameter('search', i, '');
|
|
719
|
-
let url = 'https://api.hamkar.co/api/record/';
|
|
719
|
+
let url = 'https://dev-api.hamkar.co/api/record/';
|
|
720
720
|
const qs = {};
|
|
721
721
|
if (search) {
|
|
722
722
|
qs.search = search;
|
|
@@ -726,12 +726,12 @@ class Hamkar {
|
|
|
726
726
|
let hasMore = true;
|
|
727
727
|
let nextUrl = url;
|
|
728
728
|
while (hasMore) {
|
|
729
|
-
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
729
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
730
730
|
method: 'GET',
|
|
731
731
|
url: nextUrl,
|
|
732
732
|
qs: nextUrl === url ? qs : {},
|
|
733
733
|
json: true,
|
|
734
|
-
});
|
|
734
|
+
}));
|
|
735
735
|
const results = response.results;
|
|
736
736
|
returnData.push(...results);
|
|
737
737
|
if (response.next) {
|
|
@@ -745,12 +745,12 @@ class Hamkar {
|
|
|
745
745
|
else {
|
|
746
746
|
const limit = this.getNodeParameter('limit', i);
|
|
747
747
|
qs.limit = limit;
|
|
748
|
-
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
748
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
749
749
|
method: 'GET',
|
|
750
750
|
url,
|
|
751
751
|
qs,
|
|
752
752
|
json: true,
|
|
753
|
-
});
|
|
753
|
+
}));
|
|
754
754
|
const results = response.results;
|
|
755
755
|
returnData.push(...results);
|
|
756
756
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class HamkarSendSms implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HamkarSendSms = void 0;
|
|
4
|
+
class HamkarSendSms {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'Hamkar Send SMS',
|
|
8
|
+
name: 'hamkarSendSms',
|
|
9
|
+
icon: 'file:hamkar.svg',
|
|
10
|
+
group: ['transform'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '={{"Send " + $parameter["message"] + " to " + $parameter["phone"]}}',
|
|
13
|
+
description: 'Send SMS via Hamkar',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Hamkar Send SMS',
|
|
16
|
+
},
|
|
17
|
+
inputs: ['main'],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'hamkarApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Phone',
|
|
28
|
+
name: 'phone',
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: true,
|
|
31
|
+
default: '',
|
|
32
|
+
description: 'Receiver phone number',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Text',
|
|
36
|
+
name: 'text',
|
|
37
|
+
type: 'string',
|
|
38
|
+
typeOptions: { rows: 4 },
|
|
39
|
+
required: true,
|
|
40
|
+
default: '',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async execute() {
|
|
46
|
+
const items = this.getInputData();
|
|
47
|
+
const returnData = [];
|
|
48
|
+
for (let i = 0; i < items.length; i++) {
|
|
49
|
+
const phone = this.getNodeParameter('phone', i);
|
|
50
|
+
const text = this.getNodeParameter('text', i);
|
|
51
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
url: 'https://dev-api.hamkar.co/api/send-sms/',
|
|
54
|
+
body: { phone, text },
|
|
55
|
+
json: true,
|
|
56
|
+
});
|
|
57
|
+
returnData.push(response);
|
|
58
|
+
}
|
|
59
|
+
return [this.helpers.returnJsonArray(returnData)];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.HamkarSendSms = HamkarSendSms;
|
package/package.json
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
2
|
+
"name": "n8n-nodes-hamkar",
|
|
3
|
+
"version": "3.1.3",
|
|
4
|
+
"description": "n8n node for Hamkar.co API - Contact and Record management operations",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"hamkar",
|
|
9
|
+
"crm",
|
|
10
|
+
"records"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/yourusername/n8n-nodes-hamkar",
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Your Name",
|
|
16
|
+
"email": "your.email@example.com"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/yourusername/n8n-nodes-hamkar.git"
|
|
21
|
+
},
|
|
22
|
+
"main": "index.js",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc && gulp build:icons",
|
|
25
|
+
"dev": "tsc --watch",
|
|
26
|
+
"format": "prettier nodes credentials --write",
|
|
27
|
+
"lint": "eslint nodes/**/*.ts credentials/**/*.ts package.json",
|
|
28
|
+
"lintfix": "eslint nodes/**/*.ts credentials/**/*.ts package.json --fix",
|
|
29
|
+
"prepublishOnly": "npm run build && npm run lint"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"n8n": {
|
|
35
|
+
"n8nNodesApiVersion": 2,
|
|
36
|
+
"credentials": [
|
|
37
|
+
"dist/credentials/HamkarApi.credentials.js"
|
|
38
|
+
],
|
|
39
|
+
"nodes": [
|
|
40
|
+
"dist/nodes/Hamkar/Hamkar.node.js",
|
|
41
|
+
"dist/nodes/Hamkar/HamkarTrigger.node.js",
|
|
42
|
+
"dist/nodes/Hamkar/HamkarSendSms.node.js"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@typescript-eslint/parser": "^5.0.0",
|
|
47
|
+
"eslint": "^8.0.0",
|
|
48
|
+
"eslint-plugin-n8n-nodes-base": "^1.11.0",
|
|
49
|
+
"gulp": "^4.0.2",
|
|
50
|
+
"n8n-workflow": "^1.0.0",
|
|
51
|
+
"prettier": "^2.7.1",
|
|
52
|
+
"typescript": "~5.3.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"n8n-workflow": "*"
|
|
56
|
+
}
|
|
56
57
|
}
|