n8n-nodes-zalo-loma-funnel 1.0.2 → 1.1.0

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.
Files changed (129) hide show
  1. package/{LICENSE → LICENSE.md} +7 -9
  2. package/README.md +67 -56
  3. package/dist/credentials/N8nZaloApi.credentials.d.ts +8 -0
  4. package/dist/credentials/N8nZaloApi.credentials.js +31 -0
  5. package/dist/credentials/N8nZaloApi.credentials.js.map +1 -0
  6. package/dist/credentials/N8nZaloApi.credentials.ts +32 -0
  7. package/dist/credentials/{zalo-api.credentials.d.ts → ZaloApi.credentials.d.ts} +2 -2
  8. package/dist/credentials/ZaloApi.credentials.js +64 -0
  9. package/dist/credentials/ZaloApi.credentials.js.map +1 -0
  10. package/dist/credentials/ZaloApi.credentials.ts +66 -0
  11. package/dist/credentials/shared/n8n.png +0 -0
  12. package/dist/credentials/shared/zalo.svg +10 -0
  13. package/dist/nodes/ZaloFriendTrigger/ZaloFriendTrigger.node.d.ts +12 -0
  14. package/dist/nodes/ZaloFriendTrigger/ZaloFriendTrigger.node.js +129 -0
  15. package/dist/nodes/ZaloFriendTrigger/ZaloFriendTrigger.node.js.map +1 -0
  16. package/dist/nodes/{ZaloSend/zalo-send.node.d.ts → ZaloGroup/ZaloGroup.node.d.ts} +1 -2
  17. package/dist/nodes/ZaloGroup/ZaloGroup.node.js +228 -0
  18. package/dist/nodes/ZaloGroup/ZaloGroup.node.js.map +1 -0
  19. package/dist/nodes/ZaloGroup/ZaloGroupDescription.d.ts +3 -0
  20. package/dist/nodes/ZaloGroup/ZaloGroupDescription.js +348 -0
  21. package/dist/nodes/ZaloGroup/ZaloGroupDescription.js.map +1 -0
  22. package/dist/nodes/{ZaloManage/zalo-manage.node.d.ts → ZaloLoginByQr/ZaloLoginByQr.node.d.ts} +1 -2
  23. package/dist/nodes/ZaloLoginByQr/ZaloLoginByQr.node.js +422 -0
  24. package/dist/nodes/ZaloLoginByQr/ZaloLoginByQr.node.js.map +1 -0
  25. package/dist/nodes/ZaloMessageTrigger/ZaloMessageTrigger.node.d.ts +12 -0
  26. package/dist/nodes/ZaloMessageTrigger/ZaloMessageTrigger.node.js +147 -0
  27. package/dist/nodes/ZaloMessageTrigger/ZaloMessageTrigger.node.js.map +1 -0
  28. package/dist/nodes/ZaloPoll/ZaloPoll.node.d.ts +5 -0
  29. package/dist/nodes/ZaloPoll/ZaloPoll.node.js +187 -0
  30. package/dist/nodes/ZaloPoll/ZaloPoll.node.js.map +1 -0
  31. package/dist/nodes/ZaloPoll/ZaloPollDescription.d.ts +3 -0
  32. package/dist/nodes/ZaloPoll/ZaloPollDescription.js +260 -0
  33. package/dist/nodes/ZaloPoll/ZaloPollDescription.js.map +1 -0
  34. package/dist/nodes/ZaloSendMessage/ZaloSendMessage.node.d.ts +5 -0
  35. package/dist/nodes/ZaloSendMessage/ZaloSendMessage.node.js +307 -0
  36. package/dist/nodes/ZaloSendMessage/ZaloSendMessage.node.js.map +1 -0
  37. package/dist/nodes/ZaloTag/ZaloTag.node.d.ts +5 -0
  38. package/dist/nodes/ZaloTag/ZaloTag.node.js +81 -0
  39. package/dist/nodes/ZaloTag/ZaloTag.node.js.map +1 -0
  40. package/dist/nodes/ZaloUser/ZaloUser.node.d.ts +5 -0
  41. package/dist/nodes/ZaloUser/ZaloUser.node.js +229 -0
  42. package/dist/nodes/ZaloUser/ZaloUser.node.js.map +1 -0
  43. package/dist/nodes/ZaloUser/ZaloUserDescription.d.ts +3 -0
  44. package/dist/nodes/ZaloUser/ZaloUserDescription.js +361 -0
  45. package/dist/nodes/ZaloUser/ZaloUserDescription.js.map +1 -0
  46. package/dist/nodes/shared/zalo.svg +10 -0
  47. package/dist/nodes/utils/helper.d.ts +2 -0
  48. package/dist/nodes/utils/helper.js +42 -0
  49. package/dist/nodes/utils/helper.js.map +1 -0
  50. package/dist/package.json +74 -0
  51. package/dist/tsconfig.tsbuildinfo +1 -0
  52. package/index.js +0 -0
  53. package/package.json +72 -74
  54. package/dist/bridge/zalo-bridge.d.ts +0 -46
  55. package/dist/bridge/zalo-bridge.d.ts.map +0 -1
  56. package/dist/bridge/zalo-bridge.js +0 -213
  57. package/dist/bridge/zalo-bridge.js.map +0 -1
  58. package/dist/credentials/zalo-api.credentials.d.ts.map +0 -1
  59. package/dist/credentials/zalo-api.credentials.js +0 -82
  60. package/dist/credentials/zalo-api.credentials.js.map +0 -1
  61. package/dist/index.d.ts +0 -9
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/index.js +0 -36
  64. package/dist/index.js.map +0 -1
  65. package/dist/interfaces/auth.interface.d.ts +0 -33
  66. package/dist/interfaces/auth.interface.d.ts.map +0 -1
  67. package/dist/interfaces/auth.interface.js +0 -3
  68. package/dist/interfaces/auth.interface.js.map +0 -1
  69. package/dist/interfaces/config.interface.d.ts +0 -37
  70. package/dist/interfaces/config.interface.d.ts.map +0 -1
  71. package/dist/interfaces/config.interface.js +0 -3
  72. package/dist/interfaces/config.interface.js.map +0 -1
  73. package/dist/interfaces/index.d.ts +0 -4
  74. package/dist/interfaces/index.d.ts.map +0 -1
  75. package/dist/interfaces/index.js +0 -20
  76. package/dist/interfaces/index.js.map +0 -1
  77. package/dist/interfaces/zalo.interface.d.ts +0 -74
  78. package/dist/interfaces/zalo.interface.d.ts.map +0 -1
  79. package/dist/interfaces/zalo.interface.js +0 -14
  80. package/dist/interfaces/zalo.interface.js.map +0 -1
  81. package/dist/nodes/ZaloManage/zalo-manage.node.d.ts.map +0 -1
  82. package/dist/nodes/ZaloManage/zalo-manage.node.js +0 -426
  83. package/dist/nodes/ZaloManage/zalo-manage.node.js.map +0 -1
  84. package/dist/nodes/ZaloManage/zalo.svg +0 -5
  85. package/dist/nodes/ZaloSend/zalo-send.node.d.ts.map +0 -1
  86. package/dist/nodes/ZaloSend/zalo-send.node.js +0 -538
  87. package/dist/nodes/ZaloSend/zalo-send.node.js.map +0 -1
  88. package/dist/nodes/ZaloSend/zalo.svg +0 -5
  89. package/dist/nodes/ZaloTrigger/zalo-trigger.node.d.ts +0 -6
  90. package/dist/nodes/ZaloTrigger/zalo-trigger.node.d.ts.map +0 -1
  91. package/dist/nodes/ZaloTrigger/zalo-trigger.node.js +0 -308
  92. package/dist/nodes/ZaloTrigger/zalo-trigger.node.js.map +0 -1
  93. package/dist/nodes/ZaloTrigger/zalo.svg +0 -5
  94. package/dist/queues/in-memory-queue.d.ts +0 -20
  95. package/dist/queues/in-memory-queue.d.ts.map +0 -1
  96. package/dist/queues/in-memory-queue.js +0 -68
  97. package/dist/queues/in-memory-queue.js.map +0 -1
  98. package/dist/queues/index.d.ts +0 -4
  99. package/dist/queues/index.d.ts.map +0 -1
  100. package/dist/queues/index.js +0 -8
  101. package/dist/queues/index.js.map +0 -1
  102. package/dist/queues/queue.interface.d.ts +0 -15
  103. package/dist/queues/queue.interface.d.ts.map +0 -1
  104. package/dist/queues/queue.interface.js +0 -3
  105. package/dist/queues/queue.interface.js.map +0 -1
  106. package/dist/queues/redis-queue.d.ts +0 -22
  107. package/dist/queues/redis-queue.d.ts.map +0 -1
  108. package/dist/queues/redis-queue.js +0 -65
  109. package/dist/queues/redis-queue.js.map +0 -1
  110. package/dist/services/error-handler.service.d.ts +0 -67
  111. package/dist/services/error-handler.service.d.ts.map +0 -1
  112. package/dist/services/error-handler.service.js +0 -201
  113. package/dist/services/error-handler.service.js.map +0 -1
  114. package/dist/services/index.d.ts +0 -4
  115. package/dist/services/index.d.ts.map +0 -1
  116. package/dist/services/index.js +0 -13
  117. package/dist/services/index.js.map +0 -1
  118. package/dist/services/rate-limiter.service.d.ts +0 -68
  119. package/dist/services/rate-limiter.service.d.ts.map +0 -1
  120. package/dist/services/rate-limiter.service.js +0 -149
  121. package/dist/services/rate-limiter.service.js.map +0 -1
  122. package/dist/services/zalo-connection-manager.service.d.ts +0 -85
  123. package/dist/services/zalo-connection-manager.service.d.ts.map +0 -1
  124. package/dist/services/zalo-connection-manager.service.js +0 -243
  125. package/dist/services/zalo-connection-manager.service.js.map +0 -1
  126. package/dist/utils/auth-helpers.d.ts +0 -25
  127. package/dist/utils/auth-helpers.d.ts.map +0 -1
  128. package/dist/utils/auth-helpers.js +0 -66
  129. package/dist/utils/auth-helpers.js.map +0 -1
@@ -1,13 +1,11 @@
1
- MIT License
1
+ Copyright 2022 n8n
2
2
 
3
- Copyright (c) 2025 Loma Funnel
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
11
9
 
12
10
  The above copyright notice and this permission notice shall be included in all
13
11
  copies or substantial portions of the Software.
package/README.md CHANGED
@@ -1,82 +1,93 @@
1
- # n8n-nodes-zalo-loma-funnel
1
+ ![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)
2
2
 
3
- n8n community nodes for Zalo messaging automation via zca-js.
3
+ # n8n-nodes-zalo-tools
4
+ Node dành riêng cho n8n này được thiết kế hoạt động hoàn toàn bên trong instance n8n của bạn. Không cần sử dụng API của bên thứ ba hay phụ thuộc ngoại vi nào — chỉ có sự tự động hóa quy trình thuần túy, đảm bảo dữ liệu của bạn luôn được giữ riêng tư và an toàn.
4
5
 
5
- ## ⚠️ Disclaimer
6
+ Node này mô phỏng trình duyệt để tương tác trực tiếp với Zalo Web, cho phép tự động hóa liền mạch ngay trong n8n. Đây là dự án mã nguồn mở, mở rộng cơ hội cho cộng đồng cùng đóng góp ý kiến và phát triển thêm các tính năng mới, nhằm xây dựng hệ thống tự động hóa Zalo tiên tiến, hiệu quả và an toàn hơn.
6
7
 
7
- This package uses **zca-js**, an unofficial Zalo API library.
8
- - Use at your own risk
9
- - May violate Zalo Terms of Service
10
- - Accounts could be banned
11
- - Not affiliated with Zalo/VNG
8
+ ## Buy me a coffee
9
+ Nếu **node** này giúp bạn tiết kiệm thời gian hoặc giải quyết được vấn đề khó nhằn, hãy cân nhắc ủng hộ tôi một ☕ (Buy me a coffee) hoặc đơn giản là nhấn **★ Star** cho dự án.
10
+ Sự động viên nhỏ ấy sẽ tiếp thêm năng lượng để mình tiếp tục duy trì, cập nhật và phát triển thêm nhiều tính năng hữu ích hơn nữa.
11
+ Cám ơn bạn rất nhiều! 💛
12
12
 
13
- ## Features
13
+ ![Alt text](qr.png)
14
+ ## Tác giả
15
+ - Dương Đình Trung - ChickenAI Team
14
16
 
15
- | Node | Description |
16
- |------|-------------|
17
- | **Zalo Trigger** | Receive messages (WebSocket or Redis polling) |
18
- | **Zalo Send** | Send text, images, videos, files, stickers |
19
- | **Zalo Manage** | Get profile, contacts, groups |
17
+ ## Hướng dẫn cài đặt node này:
20
18
 
21
- ## Installation
19
+ **Community Nodes (Khuyến nghị)**
22
20
 
23
- ### Via n8n UI
21
+ Đối với người dùng n8n v0.187+, bạn có thể cài đặt node này trực tiếp từ bảng Community Nodes trong trình soạn thảo n8n.
24
22
 
25
- 1. Go to **Settings** **Community Nodes**
26
- 2. Enter `n8n-nodes-zalo-loma-funnel`
27
- 3. Click **Install**
23
+ 1. Mở trình soạn thảo n8n của bạn.
24
+ 2. Vào Settings > Community Nodes.
25
+ 3. Tìm kiếm "n8n-nodes-zalo-tools".
26
+ 4. Nhấp vào Install.
27
+ 5. Tải lại trình soạn thảo.
28
28
 
29
- ### Via npm
29
+ **Cài đặt thủ công**
30
30
 
31
- ```bash
32
- npm install n8n-nodes-zalo-loma-funnel
33
- ```
34
-
35
- ## Configuration
36
-
37
- ### Get Zalo Authentication
31
+ Bạn cũng có thể cài đặt node này theo cách thủ công:
38
32
 
39
- 1. Open **chat.zalo.me** in Chrome
40
- 2. Press **F12** → **Application** tab
41
- 3. Copy the following:
33
+ ```
34
+ cd YOUR_N8N_INSTALLATION_DIRECTORY
35
+ npm install n8n-nodes-zalo-tools
36
+ ```
42
37
 
43
- | Field | Location |
44
- |-------|----------|
45
- | Cookie | Cookies → chat.zalo.me → Copy all |
46
- | IMEI | Local Storage → `zalo_imei` |
47
- | User Agent | Network → any request → User-Agent header |
38
+ ## Available Nodes
48
39
 
49
- ### Create Credentials in n8n
40
+ 1. Zalo Login By QR
41
+ Node cho phép đăng nhập vào Zalo thông qua mã QR.
50
42
 
51
- 1. Go to **Credentials** → **New**
52
- 2. Select **Zalo API**
53
- 3. Enter Cookie, IMEI, User Agent
54
- 4. Save
43
+ 2. Zalo Group
44
+ Node quản các hoạt động nhóm.
45
+ Operations:
46
+ createGroup: Tạo nhóm mới
47
+ getGroupInfo: Lấy thông tin nhóm
48
+ addGroupDeputy: Thêm phó nhóm
49
+ addUserToGroup: Thêm thành viên
50
+ changeGroupAvatar: Đổi avatar nhóm
51
+ changeGroupName: Đổi tên nhóm
52
+ getGroupMembers: Lấy danh sách thành viên
53
+ getAllGroups: Lấy tất cả nhóm
54
+ removeUserFromGroup: Xóa thành viên
55
55
 
56
- ## Usage
56
+ 3. Zalo User
57
+ Node quản lý người dùng và bạn bè.
58
+ Operations:
59
+ acceptFriendRequest: Chấp nhận lời mời kết bạn
60
+ sendFriendRequest: Gửi lời mời kết bạn
61
+ blockUser: Chặn người dùng
62
+ unblockUser: Bỏ chặn người dùng
63
+ changeAccountAvatar: Đổi ảnh đại diện
64
+ changeAccountSetting: Thay đổi cài đặt tài khoản
65
+ getUserInfo: Lấy thông tin người dùng
66
+ getAllFriends: Lấy danh sách bạn bè
67
+ findUser: Tìm kiếm người dùng qua số điện thoại
57
68
 
58
- ### Zalo Trigger
69
+ 4. Zalo Send Message
70
+ Node gửi tin nhắn tới người dùng hoặc nhóm.
71
+ Features:
72
+ Gửi tin nhắn văn bản
59
73
 
60
- Receive incoming messages:
61
- - **Embedded WebSocket**: Simple, runs in n8n process
62
- - **External Bridge**: Production-grade, requires Redis
63
74
 
64
- ### Zalo Send
75
+ 5. Zalo Message Trigger
76
+ Node lắng nghe và xử lý các sự kiện tin nhắn.
77
+ Events:
78
+ Tin nhắn mới
79
+ Tin nhắn nhóm
80
+ Thay đổi trạng thái tin nhắn
65
81
 
66
- Send messages with rate limiting (1-5s random delay):
67
- - Text, Image, Video, File, Sticker
68
- - Reply/Quote, Reactions
69
- - Typing indicator support
82
+ ## Warning and Thanks
70
83
 
71
- ### Zalo Manage
84
+ **Please read this carefully before using the Zalo nodes:**
72
85
 
73
- Access resources:
74
- - Profile, Contacts, Groups lookup
86
+ Lưu ý: việc sử dụng thư viện này đồng nghĩa với việc bạn đang làm trái với chính sách của Zalo và nó có thể khiến cho tài khoản của bạn bị vô hiệu hóa. Chúng tôi sẽ không chịu trách nhiệm nếu điều đó xảy ra, vậy nên hãy cân nhắc trước khi sử dụng.
75
87
 
76
- ## Rate Limiting
88
+ We would like to thank ZCA-JS for their work on this library.
77
89
 
78
- Messages automatically delayed 1-5s randomly per account to avoid bans.
79
90
 
80
91
  ## License
81
92
 
82
- MIT
93
+ [MIT](https://github.com/n8n-io/n8n-nodes-starter/blob/master/LICENSE.md)
@@ -0,0 +1,8 @@
1
+ import { ICredentialType, INodeProperties, Icon } from 'n8n-workflow';
2
+ export declare class N8nZaloApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ icon: Icon;
7
+ properties: INodeProperties[];
8
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.N8nZaloApi = void 0;
4
+ class N8nZaloApi {
5
+ constructor() {
6
+ this.name = 'n8nZaloApi';
7
+ this.displayName = 'n8n Zalo Account Credential';
8
+ this.documentationUrl = 'n8n-n8n-api';
9
+ this.icon = 'file:shared/n8n.png';
10
+ this.properties = [
11
+ {
12
+ displayName: 'API Key',
13
+ name: 'apiKey',
14
+ type: 'string',
15
+ default: '',
16
+ description: 'The API key used to authenticate with the n8n API.',
17
+ required: true,
18
+ },
19
+ {
20
+ displayName: 'URL',
21
+ name: 'url',
22
+ type: 'string',
23
+ default: 'http://127.0.0.1:5678',
24
+ description: 'The URL of the n8n instance',
25
+ required: true,
26
+ }
27
+ ];
28
+ }
29
+ }
30
+ exports.N8nZaloApi = N8nZaloApi;
31
+ //# sourceMappingURL=N8nZaloApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"N8nZaloApi.credentials.js","sourceRoot":"","sources":["../../credentials/N8nZaloApi.credentials.ts"],"names":[],"mappings":";;;AAME,MAAa,UAAU;IAAvB;QACE,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,6BAA6B,CAAC;QAC5C,qBAAgB,GAAG,aAAa,CAAC;QAEjC,SAAI,GAAS,qBAAqB,CAAC;QAEnC,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,oDAAoD;gBACjE,QAAQ,EAAG,IAAI;aAChB;YACD;gBACE,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,WAAW,EAAE,6BAA6B;gBAC1C,QAAQ,EAAG,IAAI;aAChB;SACF,CAAC;IACJ,CAAC;CAAA;AAzBD,gCAyBC"}
@@ -0,0 +1,32 @@
1
+ import {
2
+ ICredentialType,
3
+ INodeProperties,
4
+ Icon,
5
+ } from 'n8n-workflow';
6
+
7
+ export class N8nZaloApi implements ICredentialType {
8
+ name = 'n8nZaloApi';
9
+ displayName = 'n8n Zalo Account Credential';
10
+ documentationUrl = 'n8n-n8n-api';
11
+
12
+ icon: Icon = 'file:shared/n8n.png';
13
+
14
+ properties: INodeProperties[] = [
15
+ {
16
+ displayName: 'API Key',
17
+ name: 'apiKey',
18
+ type: 'string',
19
+ default: '',
20
+ description: 'The API key used to authenticate with the n8n API.',
21
+ required: true,
22
+ },
23
+ {
24
+ displayName: 'URL',
25
+ name: 'url',
26
+ type: 'string',
27
+ default: 'http://127.0.0.1:5678',
28
+ description: 'The URL of the n8n instance',
29
+ required: true,
30
+ }
31
+ ];
32
+ }
@@ -1,8 +1,8 @@
1
- import { ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import { ICredentialType, INodeProperties, Icon } from 'n8n-workflow';
2
2
  export declare class ZaloApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
+ icon: Icon;
6
7
  properties: INodeProperties[];
7
8
  }
8
- //# sourceMappingURL=zalo-api.credentials.d.ts.map
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZaloApi = void 0;
4
+ class ZaloApi {
5
+ constructor() {
6
+ this.name = 'zaloApi';
7
+ this.displayName = 'Zalo API';
8
+ this.documentationUrl = 'https://developers.zalo.me/docs';
9
+ this.icon = 'file:shared/zalo.svg';
10
+ this.properties = [
11
+ {
12
+ displayName: 'Cookie',
13
+ name: 'cookie',
14
+ type: 'string',
15
+ default: '',
16
+ typeOptions: {
17
+ password: true,
18
+ },
19
+ description: 'Cookie from Zalo login session',
20
+ },
21
+ {
22
+ displayName: 'IMEI',
23
+ name: 'imei',
24
+ type: 'string',
25
+ default: '',
26
+ description: 'IMEI identifier from Zalo login session',
27
+ },
28
+ {
29
+ displayName: 'User Agent',
30
+ name: 'userAgent',
31
+ type: 'string',
32
+ default: '',
33
+ description: 'User Agent from Zalo login session',
34
+ },
35
+ {
36
+ displayName: 'Proxy',
37
+ name: 'proxy',
38
+ type: 'string',
39
+ default: '',
40
+ placeholder: 'http(s)://user:pass@host:port',
41
+ description: 'HTTP proxy to use for Zalo API requests',
42
+ },
43
+ {
44
+ displayName: 'Support Code',
45
+ name: 'supportCode',
46
+ type: 'string',
47
+ default: '',
48
+ description: 'Support code for Zalo API',
49
+ },
50
+ {
51
+ displayName: 'License Key',
52
+ name: 'licenseKey',
53
+ type: 'string',
54
+ default: '',
55
+ description: 'License key for Zalo API',
56
+ typeOptions: {
57
+ password: true,
58
+ },
59
+ },
60
+ ];
61
+ }
62
+ }
63
+ exports.ZaloApi = ZaloApi;
64
+ //# sourceMappingURL=ZaloApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZaloApi.credentials.js","sourceRoot":"","sources":["../../credentials/ZaloApi.credentials.ts"],"names":[],"mappings":";;;AAMA,MAAa,OAAO;IAApB;QACC,SAAI,GAAG,SAAS,CAAC;QACjB,gBAAW,GAAG,UAAU,CAAC;QACzB,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,SAAI,GAAS,sBAAsB,CAAC;QAEpC,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,WAAW,EAAE,gCAAgC;aAC7C;YACD;gBACC,WAAW,EAAE,MAAM;gBACnB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,yCAAyC;aACtD;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,oCAAoC;aACjD;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,+BAA+B;gBAC5C,WAAW,EAAE,yCAAyC;aACtD;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2BAA2B;aACxC;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,0BAA0B;gBACvC,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;aACD;SACD,CAAC;IAEH,CAAC;CAAA;AA3DD,0BA2DC"}
@@ -0,0 +1,66 @@
1
+ import {
2
+ ICredentialType,
3
+ INodeProperties,
4
+ Icon,
5
+ } from 'n8n-workflow';
6
+
7
+ export class ZaloApi implements ICredentialType {
8
+ name = 'zaloApi';
9
+ displayName = 'Zalo API';
10
+ documentationUrl = 'https://developers.zalo.me/docs';
11
+
12
+ icon: Icon = 'file:shared/zalo.svg';
13
+
14
+ properties: INodeProperties[] = [
15
+ {
16
+ displayName: 'Cookie',
17
+ name: 'cookie',
18
+ type: 'string',
19
+ default: '',
20
+ typeOptions: {
21
+ password: true,
22
+ },
23
+ description: 'Cookie from Zalo login session',
24
+ },
25
+ {
26
+ displayName: 'IMEI',
27
+ name: 'imei',
28
+ type: 'string',
29
+ default: '',
30
+ description: 'IMEI identifier from Zalo login session',
31
+ },
32
+ {
33
+ displayName: 'User Agent',
34
+ name: 'userAgent',
35
+ type: 'string',
36
+ default: '',
37
+ description: 'User Agent from Zalo login session',
38
+ },
39
+ {
40
+ displayName: 'Proxy',
41
+ name: 'proxy',
42
+ type: 'string',
43
+ default: '',
44
+ placeholder: 'http(s)://user:pass@host:port',
45
+ description: 'HTTP proxy to use for Zalo API requests',
46
+ },
47
+ {
48
+ displayName: 'Support Code',
49
+ name: 'supportCode',
50
+ type: 'string',
51
+ default: '',
52
+ description: 'Support code for Zalo API',
53
+ },
54
+ {
55
+ displayName: 'License Key',
56
+ name: 'licenseKey',
57
+ type: 'string',
58
+ default: '',
59
+ description: 'License key for Zalo API',
60
+ typeOptions: {
61
+ password: true,
62
+ },
63
+ },
64
+ ];
65
+
66
+ }
Binary file
@@ -0,0 +1,10 @@
1
+ <svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M22.782 0.166016H27.199C33.2653 0.166016 36.8103 1.05701 39.9572 2.74421C43.1041 4.4314 45.5875 6.89585 47.2557 10.0428C48.9429 13.1897 49.8339 16.7347 49.8339 22.801V27.1991C49.8339 33.2654 48.9429 36.8104 47.2557 39.9573C45.5685 43.1042 43.1041 45.5877 39.9572 47.2559C36.8103 48.9431 33.2653 49.8341 27.199 49.8341H22.8009C16.7346 49.8341 13.1896 48.9431 10.0427 47.2559C6.89583 45.5687 4.41243 43.1042 2.7442 39.9573C1.057 36.8104 0.166016 33.2654 0.166016 27.1991V22.801C0.166016 16.7347 1.057 13.1897 2.7442 10.0428C4.43139 6.89585 6.89583 4.41245 10.0427 2.74421C13.1707 1.05701 16.7346 0.166016 22.782 0.166016Z" fill="#0068FF"/>
3
+ <path opacity="0.12" fill-rule="evenodd" clip-rule="evenodd" d="M49.8336 26.4736V27.1994C49.8336 33.2657 48.9427 36.8107 47.2555 39.9576C45.5683 43.1045 43.1038 45.5879 39.9569 47.2562C36.81 48.9434 33.265 49.8344 27.1987 49.8344H22.8007C17.8369 49.8344 14.5612 49.2378 11.8104 48.0966L7.27539 43.4267L49.8336 26.4736Z" fill="#001A33"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.779 43.5892C10.1019 43.846 13.0061 43.1836 15.0682 42.1825C24.0225 47.1318 38.0197 46.8954 46.4923 41.4732C46.8209 40.9803 47.1279 40.4677 47.4128 39.9363C49.1062 36.7779 50.0004 33.22 50.0004 27.1316V22.7175C50.0004 16.629 49.1062 13.0711 47.4128 9.91273C45.7385 6.75436 43.2461 4.28093 40.0877 2.58758C36.9293 0.894239 33.3714 0 27.283 0H22.8499C17.6644 0 14.2982 0.652754 11.4699 1.89893C11.3153 2.03737 11.1636 2.17818 11.0151 2.32135C2.71734 10.3203 2.08658 27.6593 9.12279 37.0782C9.13064 37.0921 9.13933 37.1061 9.14889 37.1203C10.2334 38.7185 9.18694 41.5154 7.55068 43.1516C7.28431 43.399 7.37944 43.5512 7.779 43.5892Z" fill="white"/>
5
+ <path d="M20.5632 17H10.8382V19.0853H17.5869L10.9329 27.3317C10.7244 27.635 10.5728 27.9194 10.5728 28.5639V29.0947H19.748C20.203 29.0947 20.5822 28.7156 20.5822 28.2606V27.1421H13.4922L19.748 19.2938C19.8428 19.1801 20.0134 18.9716 20.0893 18.8768L20.1272 18.8199C20.4874 18.2891 20.5632 17.8341 20.5632 17.2844V17Z" fill="#0068FF"/>
6
+ <path d="M32.9416 29.0947H34.3255V17H32.2402V28.3933C32.2402 28.7725 32.5435 29.0947 32.9416 29.0947Z" fill="#0068FF"/>
7
+ <path d="M25.814 19.6924C23.1979 19.6924 21.0747 21.8156 21.0747 24.4317C21.0747 27.0478 23.1979 29.171 25.814 29.171C28.4301 29.171 30.5533 27.0478 30.5533 24.4317C30.5723 21.8156 28.4491 19.6924 25.814 19.6924ZM25.814 27.2184C24.2785 27.2184 23.0273 25.9672 23.0273 24.4317C23.0273 22.8962 24.2785 21.645 25.814 21.645C27.3495 21.645 28.6007 22.8962 28.6007 24.4317C28.6007 25.9672 27.3685 27.2184 25.814 27.2184Z" fill="#0068FF"/>
8
+ <path d="M40.4867 19.6162C37.8516 19.6162 35.7095 21.7584 35.7095 24.3934C35.7095 27.0285 37.8516 29.1707 40.4867 29.1707C43.1217 29.1707 45.2639 27.0285 45.2639 24.3934C45.2639 21.7584 43.1217 19.6162 40.4867 19.6162ZM40.4867 27.2181C38.9322 27.2181 37.681 25.9669 37.681 24.4124C37.681 22.8579 38.9322 21.6067 40.4867 21.6067C42.0412 21.6067 43.2924 22.8579 43.2924 24.4124C43.2924 25.9669 42.0412 27.2181 40.4867 27.2181Z" fill="#0068FF"/>
9
+ <path d="M29.4562 29.0944H30.5747V19.957H28.6221V28.2793C28.6221 28.7153 29.0012 29.0944 29.4562 29.0944Z" fill="#0068FF"/>
10
+ </svg>
@@ -0,0 +1,12 @@
1
+ import { INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData, IHookFunctions } from 'n8n-workflow';
2
+ export declare class ZaloFriendTrigger 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,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZaloFriendTrigger = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const zca_js_1 = require("zca-js");
6
+ let api;
7
+ let reconnectTimer;
8
+ class ZaloFriendTrigger {
9
+ constructor() {
10
+ this.description = {
11
+ displayName: 'Zalo Friend Trigger',
12
+ name: 'zaloFriendTrigger',
13
+ icon: 'file:../shared/zalo.svg',
14
+ group: ['trigger'],
15
+ version: 1,
16
+ description: 'Lắng nghe sự kiện kết bạn trên Zalo',
17
+ defaults: {
18
+ name: 'Zalo Friend Trigger',
19
+ },
20
+ inputs: [],
21
+ outputs: ['main'],
22
+ webhooks: [
23
+ {
24
+ name: 'default',
25
+ httpMethod: 'POST',
26
+ responseMode: 'onReceived',
27
+ path: 'webhook',
28
+ },
29
+ ],
30
+ credentials: [
31
+ {
32
+ name: 'zaloApi',
33
+ required: true,
34
+ displayName: 'Zalo Credential to connect with',
35
+ },
36
+ ],
37
+ properties: [
38
+ {
39
+ displayName: 'Event Types',
40
+ name: 'eventTypes',
41
+ type: 'multiOptions',
42
+ options: [
43
+ {
44
+ name: 'Friend Requests',
45
+ value: zca_js_1.FriendEventType.REQUEST,
46
+ description: 'Nghe sự kiện yêu cầu kết bạn',
47
+ }
48
+ ],
49
+ default: [zca_js_1.FriendEventType.REQUEST],
50
+ required: true,
51
+ description: 'Friend events to listen for',
52
+ },
53
+ ],
54
+ };
55
+ this.webhookMethods = {
56
+ default: {
57
+ async checkExists() {
58
+ const webhookData = this.getWorkflowStaticData('node');
59
+ return !!webhookData.isConnected;
60
+ },
61
+ async create() {
62
+ const credentials = await this.getCredentials('zaloApi');
63
+ if (!credentials) {
64
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No credentials found');
65
+ }
66
+ try {
67
+ const cookieFromCred = JSON.parse(credentials.cookie);
68
+ const imeiFromCred = credentials.imei;
69
+ const userAgentFromCred = credentials.userAgent;
70
+ const zalo = new zca_js_1.Zalo();
71
+ api = await zalo.login({ cookie: cookieFromCred, imei: imeiFromCred, userAgent: userAgentFromCred });
72
+ if (!api) {
73
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No API instance found. Please make sure to provide valid credentials.');
74
+ }
75
+ const webhookUrl = this.getNodeWebhookUrl('default');
76
+ console.log(webhookUrl);
77
+ api.listener.on('friend_event', async (event) => {
78
+ const nodeEventTypes = this.getNodeParameter('eventTypes', 0);
79
+ if (nodeEventTypes.includes(event.type)) {
80
+ this.helpers.httpRequest({
81
+ method: 'POST',
82
+ url: webhookUrl,
83
+ body: {
84
+ friendEvent: event.data,
85
+ },
86
+ headers: {
87
+ 'Content-Type': 'application/json',
88
+ },
89
+ });
90
+ }
91
+ });
92
+ api.listener.start();
93
+ const webhookData = this.getWorkflowStaticData('node');
94
+ webhookData.isConnected = true;
95
+ webhookData.eventTypes = this.getNodeParameter('eventTypes', 0);
96
+ return true;
97
+ }
98
+ catch (error) {
99
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Zalo connection failed');
100
+ }
101
+ },
102
+ async delete() {
103
+ const webhookData = this.getWorkflowStaticData('node');
104
+ if (api) {
105
+ api.listener.stop();
106
+ api = undefined;
107
+ }
108
+ if (reconnectTimer) {
109
+ clearTimeout(reconnectTimer);
110
+ reconnectTimer = undefined;
111
+ }
112
+ delete webhookData.isConnected;
113
+ delete webhookData.eventTypes;
114
+ return true;
115
+ },
116
+ },
117
+ };
118
+ }
119
+ async webhook() {
120
+ const req = this.getRequestObject();
121
+ const body = req.body;
122
+ console.log(body);
123
+ return {
124
+ workflowData: [this.helpers.returnJsonArray(req.body)],
125
+ };
126
+ }
127
+ }
128
+ exports.ZaloFriendTrigger = ZaloFriendTrigger;
129
+ //# sourceMappingURL=ZaloFriendTrigger.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZaloFriendTrigger.node.js","sourceRoot":"","sources":["../../../nodes/ZaloFriendTrigger/ZaloFriendTrigger.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,mCAAiE;AAEjE,IAAI,GAAoB,CAAC;AACzB,IAAI,cAA0C,CAAC;AAE/C,MAAa,iBAAiB;IAA9B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE;gBACT,IAAI,EAAE,qBAAqB;aAC3B;YAED,MAAM,EAAE,EAAE;YAEV,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;oBAC1B,IAAI,EAAE,SAAS;iBACf;aACD;YACD,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,iCAAiC;iBAC9C;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,aA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CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;wBACpB,GAAG,GAAG,SAAS,CAAC;oBACjB,CAAC;oBAED,IAAI,cAAc,EAAE,CAAC;wBACpB,YAAY,CAAC,cAAc,CAAC,CAAC;wBAC7B,cAAc,GAAG,SAAS,CAAC;oBAC5B,CAAC;oBAED,OAAO,WAAW,CAAC,WAAW,CAAC;oBAC/B,OAAO,WAAW,CAAC,UAAU,CAAC;oBAC9B,OAAO,IAAI,CAAC;gBACb,CAAC;aACD;SACD,CAAC;IAWH,CAAC;IATA,KAAK,CAAC,OAAO;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAElB,OAAO;YACN,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACtD,CAAC;IACH,CAAC;CACD;AA5ID,8CA4IC"}
@@ -1,6 +1,5 @@
1
1
  import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
- export declare class ZaloSend implements INodeType {
2
+ export declare class ZaloGroup implements INodeType {
3
3
  description: INodeTypeDescription;
4
4
  execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
5
  }
6
- //# sourceMappingURL=zalo-send.node.d.ts.map