n8n-nodes-hamkar 3.2.0 → 3.3.2
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 +1 -1
- package/dist/credentials/HamkarApi.credentials.js +2 -2
- package/dist/nodes/Hamkar/Hamkar.node.js +8 -8
- package/dist/nodes/Hamkar/HamkarBulkSms.node.d.ts +5 -0
- package/dist/nodes/Hamkar/HamkarBulkSms.node.js +90 -0
- package/dist/nodes/Hamkar/HamkarSendSms.node.js +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -235,7 +235,7 @@ For more examples and detailed guides, see [DOCUMENTATION.md](DOCUMENTATION.md).
|
|
|
235
235
|
## Resources
|
|
236
236
|
|
|
237
237
|
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
238
|
-
- [Hamkar.co API Documentation](https://
|
|
238
|
+
- [Hamkar.co API Documentation](https://stg-api.hamkar.co/docs)
|
|
239
239
|
|
|
240
240
|
## Development
|
|
241
241
|
|
|
@@ -5,7 +5,7 @@ class HamkarApi {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this.name = 'hamkarApi';
|
|
7
7
|
this.displayName = 'Hamkar API';
|
|
8
|
-
this.documentationUrl = 'https://
|
|
8
|
+
this.documentationUrl = 'https://stg-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://
|
|
32
|
+
baseURL: 'https://stg-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://
|
|
532
|
+
url: 'https://stg-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://
|
|
563
|
+
url: `https://stg-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://
|
|
574
|
+
url: `https://stg-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://
|
|
582
|
+
let url = 'https://stg-api.hamkar.co/api/contact/';
|
|
583
583
|
const qs = {};
|
|
584
584
|
if (search) {
|
|
585
585
|
qs.search = search;
|
|
@@ -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://
|
|
658
|
+
url: 'https://stg-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://
|
|
700
|
+
url: `https://stg-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://
|
|
711
|
+
url: `https://stg-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://
|
|
719
|
+
let url = 'https://stg-api.hamkar.co/api/record/';
|
|
720
720
|
const qs = {};
|
|
721
721
|
if (search) {
|
|
722
722
|
qs.search = search;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class HamkarBulkSms implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HamkarBulkSms = void 0;
|
|
4
|
+
class HamkarBulkSms {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'Hamkar Bulk SMS',
|
|
8
|
+
name: 'hamkarBulkSms',
|
|
9
|
+
icon: 'file:hamkar.svg',
|
|
10
|
+
group: ['transform'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '={{"Send to " + $parameter["phones"].length + " numbers"}}',
|
|
13
|
+
description: 'Send bulk SMS to multiple recipients via Hamkar',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Hamkar Bulk SMS',
|
|
16
|
+
},
|
|
17
|
+
inputs: ['main'],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'hamkarApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Phones (List)',
|
|
28
|
+
name: 'phones',
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: true,
|
|
31
|
+
default: '',
|
|
32
|
+
description: 'List of phone numbers (comma separated or from previous node)',
|
|
33
|
+
typeOptions: {
|
|
34
|
+
multipleValues: true,
|
|
35
|
+
multipleValueButtonText: 'Add Phone Number',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
displayName: 'Text (Common Message)',
|
|
40
|
+
name: 'text',
|
|
41
|
+
type: 'string',
|
|
42
|
+
typeOptions: { rows: 4 },
|
|
43
|
+
required: true,
|
|
44
|
+
default: '',
|
|
45
|
+
description: 'Common text message for all recipients',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async execute() {
|
|
51
|
+
const items = this.getInputData();
|
|
52
|
+
const returnData = [];
|
|
53
|
+
for (let i = 0; i < items.length; i++) {
|
|
54
|
+
let phonesParam = this.getNodeParameter('phones', i);
|
|
55
|
+
let phonesList = [];
|
|
56
|
+
if (typeof phonesParam === 'string') {
|
|
57
|
+
if (phonesParam.includes(',')) {
|
|
58
|
+
phonesList = phonesParam.split(',').map(p => p.trim());
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
phonesList = [phonesParam];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (Array.isArray(phonesParam)) {
|
|
65
|
+
phonesList = phonesParam;
|
|
66
|
+
}
|
|
67
|
+
const commonText = this.getNodeParameter('text', i);
|
|
68
|
+
const bulkData = {
|
|
69
|
+
text: commonText,
|
|
70
|
+
phones: phonesList,
|
|
71
|
+
total_count: phonesList.length
|
|
72
|
+
};
|
|
73
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
url: 'https://stg-api.hamkar.co/api/send-sms/bulk/',
|
|
76
|
+
body: bulkData,
|
|
77
|
+
json: true,
|
|
78
|
+
});
|
|
79
|
+
returnData.push({
|
|
80
|
+
success: true,
|
|
81
|
+
response: response,
|
|
82
|
+
sent_to: phonesList,
|
|
83
|
+
message: commonText,
|
|
84
|
+
count: phonesList.length
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return [this.helpers.returnJsonArray(returnData)];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.HamkarBulkSms = HamkarBulkSms;
|
|
@@ -50,7 +50,7 @@ class HamkarSendSms {
|
|
|
50
50
|
const text = this.getNodeParameter('text', i);
|
|
51
51
|
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'hamkarApi', {
|
|
52
52
|
method: 'POST',
|
|
53
|
-
url: 'https://
|
|
53
|
+
url: 'https://stg-api.hamkar.co/api/send-sms/',
|
|
54
54
|
body: { phone, text },
|
|
55
55
|
json: true,
|
|
56
56
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-hamkar",
|
|
3
|
-
"version": "3.2
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "n8n node for Hamkar.co API - Contact and Record management operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"nodes": [
|
|
40
40
|
"dist/nodes/Hamkar/Hamkar.node.js",
|
|
41
41
|
"dist/nodes/Hamkar/HamkarTrigger.node.js",
|
|
42
|
-
"dist/nodes/Hamkar/HamkarSendSms.node.js"
|
|
42
|
+
"dist/nodes/Hamkar/HamkarSendSms.node.js",
|
|
43
|
+
"dist/nodes/Hamkar/HamkarBulkSms.node.js"
|
|
43
44
|
]
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|