@warriorteam/redai-zalo-sdk 1.17.5 → 1.18.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.
- package/CHANGELOG.md +78 -0
- package/dist/services/consultation.service.d.ts +167 -0
- package/dist/services/consultation.service.d.ts.map +1 -1
- package/dist/services/consultation.service.js +274 -0
- package/dist/services/consultation.service.js.map +1 -1
- package/docs/message-sequence-api.md +464 -0
- package/examples/send-message-sequence.ts +200 -0
- package/package.json +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,84 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.18.0] - 2025-08-29
|
|
9
|
+
|
|
10
|
+
### 🚀 NEW FEATURES
|
|
11
|
+
|
|
12
|
+
#### Message Sequence APIs - Gửi Chuỗi Tin Nhắn Tự Động
|
|
13
|
+
- **ADDED**: `sendMessageSequence()` - Gửi chuỗi tin nhắn tư vấn với delay tùy chỉnh
|
|
14
|
+
- **ADDED**: `sendMessageSequenceToMultipleUsers()` - Gửi chuỗi tin nhắn tới nhiều users cùng lúc
|
|
15
|
+
- **SUPPORT**: Hỗ trợ đầy đủ 6 loại tin nhắn: text, image, gif, file, sticker, request_user_info
|
|
16
|
+
- **FLEXIBLE**: Delay riêng cho từng tin nhắn + delay mặc định cho toàn bộ chuỗi
|
|
17
|
+
- **SMART**: Tự động loại bỏ user IDs trùng lặp và validation đầy đủ
|
|
18
|
+
|
|
19
|
+
#### Real-time Progress Tracking
|
|
20
|
+
- **CALLBACK**: `onProgress` callback để tracking real-time từng user
|
|
21
|
+
- **DETAILED**: Thống kê chi tiết thành công/thất bại cho từng tin nhắn và user
|
|
22
|
+
- **ISOLATION**: Error của 1 user không ảnh hưởng đến users khác
|
|
23
|
+
- **METRICS**: Tracking thời gian thực hiện, success rate, và message statistics
|
|
24
|
+
|
|
25
|
+
#### Rate Limiting Protection
|
|
26
|
+
- **PROTECTION**: `delayBetweenUsers` để tránh hit rate limit của Zalo
|
|
27
|
+
- **SEQUENTIAL**: Gửi tuần tự từng user để đảm bảo stability
|
|
28
|
+
- **CONFIGURABLE**: Delay linh hoạt theo từng use case
|
|
29
|
+
|
|
30
|
+
### 📊 NEW INTERFACES
|
|
31
|
+
|
|
32
|
+
#### Message Sequence Types
|
|
33
|
+
- **ADDED**: `MessageItem` - Interface cho từng tin nhắn trong chuỗi
|
|
34
|
+
- **ADDED**: `SendMessageSequenceRequest` - Request cho single user
|
|
35
|
+
- **ADDED**: `SendMessageSequenceResponse` - Response với detailed results
|
|
36
|
+
- **ADDED**: `SendMessageSequenceToMultipleUsersRequest` - Request cho multiple users
|
|
37
|
+
- **ADDED**: `SendMessageSequenceToMultipleUsersResponse` - Response với user statistics
|
|
38
|
+
- **ADDED**: `UserProgressInfo` - Interface cho progress tracking callback
|
|
39
|
+
|
|
40
|
+
### 📚 DOCUMENTATION & EXAMPLES
|
|
41
|
+
|
|
42
|
+
#### New Documentation
|
|
43
|
+
- **ADDED**: `docs/message-sequence-api.md` - Comprehensive guide cho Message Sequence APIs
|
|
44
|
+
- **UPDATED**: Hướng dẫn chi tiết từng loại tin nhắn và use cases
|
|
45
|
+
- **ADDED**: So sánh API đơn user vs nhiều users với bảng feature comparison
|
|
46
|
+
|
|
47
|
+
#### New Examples
|
|
48
|
+
- **ADDED**: `examples/send-message-sequence.ts` - Ví dụ gửi chuỗi tin nhắn cho 1 user
|
|
49
|
+
- **ADDED**: `examples/send-message-sequence-multiple-users.ts` - Ví dụ gửi cho nhiều users
|
|
50
|
+
- **INCLUDED**: Marketing campaigns, customer support, VIP customer care examples
|
|
51
|
+
|
|
52
|
+
### 🎯 USE CASES
|
|
53
|
+
|
|
54
|
+
#### Marketing & Campaigns
|
|
55
|
+
- **CAMPAIGN**: Gửi chuỗi tin nhắn marketing tới danh sách khách hàng
|
|
56
|
+
- **PROMOTION**: Flash sales, khuyến mãi với hình ảnh và call-to-action
|
|
57
|
+
- **TRACKING**: Real-time tracking delivery success rate
|
|
58
|
+
|
|
59
|
+
#### Customer Support
|
|
60
|
+
- **NOTIFICATION**: Thông báo hệ thống, bảo trì tới tất cả users
|
|
61
|
+
- **SUPPORT**: Gửi hướng dẫn, tài liệu hỗ trợ với file attachments
|
|
62
|
+
- **CARE**: Chăm sóc khách hàng VIP với tin nhắn cá nhân hóa
|
|
63
|
+
|
|
64
|
+
#### Business Automation
|
|
65
|
+
- **ONBOARDING**: Chuỗi tin nhắn chào mừng khách hàng mới
|
|
66
|
+
- **FOLLOW-UP**: Theo dõi sau bán hàng với stickers và images
|
|
67
|
+
- **SURVEY**: Thu thập feedback với request user info messages
|
|
68
|
+
|
|
69
|
+
### 🔧 TECHNICAL IMPROVEMENTS
|
|
70
|
+
|
|
71
|
+
#### Error Handling
|
|
72
|
+
- **ROBUST**: Comprehensive error handling cho từng tin nhắn và user
|
|
73
|
+
- **CONTINUE**: Tiếp tục gửi khi gặp lỗi thay vì dừng toàn bộ process
|
|
74
|
+
- **DETAILED**: Error messages chi tiết với context information
|
|
75
|
+
|
|
76
|
+
#### Performance
|
|
77
|
+
- **EFFICIENT**: Sequential processing để tránh overwhelming Zalo servers
|
|
78
|
+
- **MEMORY**: Optimized memory usage cho large user lists
|
|
79
|
+
- **TIMEOUT**: Proper timeout handling và cleanup
|
|
80
|
+
|
|
81
|
+
#### Type Safety
|
|
82
|
+
- **TYPESCRIPT**: Full TypeScript support với strict typing
|
|
83
|
+
- **VALIDATION**: Runtime validation cho tất cả input parameters
|
|
84
|
+
- **INTELLISENSE**: Complete IDE support với detailed JSDoc comments
|
|
85
|
+
|
|
8
86
|
## [1.17.2] - 2025-08-29
|
|
9
87
|
|
|
10
88
|
### 🐛 BUG FIXES
|
|
@@ -1,5 +1,152 @@
|
|
|
1
1
|
import { ZaloClient } from "../clients/zalo-client";
|
|
2
2
|
import { MessageRecipient, SendMessageResponse, TextMessage, ConsultationQuoteMessage } from "../types/message";
|
|
3
|
+
/**
|
|
4
|
+
* Interface cho từng tin nhắn trong chuỗi tin nhắn
|
|
5
|
+
*/
|
|
6
|
+
export interface MessageItem {
|
|
7
|
+
/** Loại tin nhắn */
|
|
8
|
+
type: "text" | "image" | "gif" | "file" | "sticker" | "request_user_info";
|
|
9
|
+
/** Nội dung tin nhắn (cho text message) */
|
|
10
|
+
text?: string;
|
|
11
|
+
/** URL hình ảnh (cho image/gif message) */
|
|
12
|
+
imageUrl?: string;
|
|
13
|
+
/** URL GIF (cho gif message) */
|
|
14
|
+
gifUrl?: string;
|
|
15
|
+
/** Chiều rộng GIF (bắt buộc cho gif) */
|
|
16
|
+
width?: number;
|
|
17
|
+
/** Chiều cao GIF (bắt buộc cho gif) */
|
|
18
|
+
height?: number;
|
|
19
|
+
/** Token file (cho file message) */
|
|
20
|
+
fileToken?: string;
|
|
21
|
+
/** Attachment ID (cho image/sticker message) */
|
|
22
|
+
attachmentId?: string;
|
|
23
|
+
/** Sticker attachment ID (cho sticker message) */
|
|
24
|
+
stickerAttachmentId?: string;
|
|
25
|
+
/** Tiêu đề (cho request_user_info message) */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Tiêu đề phụ (cho request_user_info message) */
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
/** Delay sau khi gửi tin nhắn này (milliseconds) */
|
|
30
|
+
delay?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Interface cho request gửi chuỗi tin nhắn
|
|
34
|
+
*/
|
|
35
|
+
export interface SendMessageSequenceRequest {
|
|
36
|
+
/** Access token của Official Account */
|
|
37
|
+
accessToken: string;
|
|
38
|
+
/** ID người nhận */
|
|
39
|
+
userId: string;
|
|
40
|
+
/** Danh sách tin nhắn */
|
|
41
|
+
messages: MessageItem[];
|
|
42
|
+
/** Delay mặc định giữa các tin nhắn (milliseconds) - nếu không có delay riêng */
|
|
43
|
+
defaultDelay?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Interface cho response gửi chuỗi tin nhắn
|
|
47
|
+
*/
|
|
48
|
+
export interface SendMessageSequenceResponse {
|
|
49
|
+
/** Tổng số tin nhắn đã gửi thành công */
|
|
50
|
+
successCount: number;
|
|
51
|
+
/** Tổng số tin nhắn thất bại */
|
|
52
|
+
failureCount: number;
|
|
53
|
+
/** Chi tiết kết quả từng tin nhắn */
|
|
54
|
+
results: Array<{
|
|
55
|
+
/** Index của tin nhắn trong danh sách */
|
|
56
|
+
index: number;
|
|
57
|
+
/** Loại tin nhắn */
|
|
58
|
+
type: string;
|
|
59
|
+
/** Trạng thái gửi */
|
|
60
|
+
success: boolean;
|
|
61
|
+
/** Thông tin response nếu thành công */
|
|
62
|
+
response?: SendMessageResponse;
|
|
63
|
+
/** Thông tin lỗi nếu thất bại */
|
|
64
|
+
error?: string;
|
|
65
|
+
/** Thời gian gửi */
|
|
66
|
+
timestamp: number;
|
|
67
|
+
}>;
|
|
68
|
+
/** Tổng thời gian thực hiện (milliseconds) */
|
|
69
|
+
totalDuration: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Interface cho request gửi chuỗi tin nhắn tới nhiều users
|
|
73
|
+
*/
|
|
74
|
+
export interface SendMessageSequenceToMultipleUsersRequest {
|
|
75
|
+
/** Access token của Official Account */
|
|
76
|
+
accessToken: string;
|
|
77
|
+
/** Danh sách user IDs */
|
|
78
|
+
userIds: string[];
|
|
79
|
+
/** Danh sách tin nhắn */
|
|
80
|
+
messages: MessageItem[];
|
|
81
|
+
/** Delay mặc định giữa các tin nhắn (milliseconds) */
|
|
82
|
+
defaultDelay?: number;
|
|
83
|
+
/** Delay giữa các user (milliseconds) để tránh rate limit */
|
|
84
|
+
delayBetweenUsers?: number;
|
|
85
|
+
/** Callback function để tracking tiến trình */
|
|
86
|
+
onProgress?: (progress: UserProgressInfo) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Interface cho thông tin tiến trình từng user
|
|
90
|
+
*/
|
|
91
|
+
export interface UserProgressInfo {
|
|
92
|
+
/** User ID hiện tại */
|
|
93
|
+
userId: string;
|
|
94
|
+
/** Index của user trong danh sách (bắt đầu từ 0) */
|
|
95
|
+
userIndex: number;
|
|
96
|
+
/** Tổng số users */
|
|
97
|
+
totalUsers: number;
|
|
98
|
+
/** Trạng thái: 'started' | 'completed' | 'failed' */
|
|
99
|
+
status: 'started' | 'completed' | 'failed';
|
|
100
|
+
/** Kết quả gửi tin nhắn (nếu đã hoàn thành) */
|
|
101
|
+
result?: SendMessageSequenceResponse;
|
|
102
|
+
/** Thông tin lỗi (nếu thất bại) */
|
|
103
|
+
error?: string;
|
|
104
|
+
/** Thời gian bắt đầu */
|
|
105
|
+
startTime: number;
|
|
106
|
+
/** Thời gian kết thúc (nếu đã hoàn thành) */
|
|
107
|
+
endTime?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Interface cho response gửi chuỗi tin nhắn tới nhiều users
|
|
111
|
+
*/
|
|
112
|
+
export interface SendMessageSequenceToMultipleUsersResponse {
|
|
113
|
+
/** Tổng số users */
|
|
114
|
+
totalUsers: number;
|
|
115
|
+
/** Số users gửi thành công */
|
|
116
|
+
successfulUsers: number;
|
|
117
|
+
/** Số users gửi thất bại */
|
|
118
|
+
failedUsers: number;
|
|
119
|
+
/** Chi tiết kết quả từng user */
|
|
120
|
+
userResults: Array<{
|
|
121
|
+
/** User ID */
|
|
122
|
+
userId: string;
|
|
123
|
+
/** Index của user trong danh sách */
|
|
124
|
+
userIndex: number;
|
|
125
|
+
/** Trạng thái gửi cho user này */
|
|
126
|
+
success: boolean;
|
|
127
|
+
/** Kết quả chi tiết gửi tin nhắn */
|
|
128
|
+
messageSequenceResult?: SendMessageSequenceResponse;
|
|
129
|
+
/** Thông tin lỗi nếu thất bại */
|
|
130
|
+
error?: string;
|
|
131
|
+
/** Thời gian bắt đầu gửi */
|
|
132
|
+
startTime: number;
|
|
133
|
+
/** Thời gian kết thúc */
|
|
134
|
+
endTime: number;
|
|
135
|
+
/** Thời gian thực hiện (milliseconds) */
|
|
136
|
+
duration: number;
|
|
137
|
+
}>;
|
|
138
|
+
/** Tổng thời gian thực hiện (milliseconds) */
|
|
139
|
+
totalDuration: number;
|
|
140
|
+
/** Thống kê tin nhắn tổng cộng */
|
|
141
|
+
messageStats: {
|
|
142
|
+
/** Tổng số tin nhắn đã gửi thành công */
|
|
143
|
+
totalSuccessfulMessages: number;
|
|
144
|
+
/** Tổng số tin nhắn thất bại */
|
|
145
|
+
totalFailedMessages: number;
|
|
146
|
+
/** Tổng số tin nhắn */
|
|
147
|
+
totalMessages: number;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
3
150
|
/**
|
|
4
151
|
* Service xử lý các API tin nhắn tư vấn của Zalo Official Account
|
|
5
152
|
*
|
|
@@ -133,5 +280,25 @@ export declare class ConsultationService {
|
|
|
133
280
|
* Xem video hướng dẫn: https://vimeo.com/649330161
|
|
134
281
|
*/
|
|
135
282
|
sendStickerMessage(accessToken: string, userId: string, stickerAttachmentId: string): Promise<SendMessageResponse>;
|
|
283
|
+
/**
|
|
284
|
+
* Gửi chuỗi tin nhắn tư vấn với delay tùy chỉnh
|
|
285
|
+
* Hỗ trợ tất cả các loại tin nhắn: text, image, gif, file, sticker, request_user_info
|
|
286
|
+
*
|
|
287
|
+
* @param request Thông tin request gửi chuỗi tin nhắn
|
|
288
|
+
* @returns Kết quả gửi từng tin nhắn
|
|
289
|
+
*/
|
|
290
|
+
sendMessageSequence(request: SendMessageSequenceRequest): Promise<SendMessageSequenceResponse>;
|
|
291
|
+
/**
|
|
292
|
+
* Gửi chuỗi tin nhắn tư vấn tới nhiều users với callback tracking
|
|
293
|
+
*
|
|
294
|
+
* @param request Thông tin request gửi chuỗi tin nhắn tới nhiều users
|
|
295
|
+
* @returns Kết quả gửi tin nhắn cho tất cả users
|
|
296
|
+
*/
|
|
297
|
+
sendMessageSequenceToMultipleUsers(request: SendMessageSequenceToMultipleUsersRequest): Promise<SendMessageSequenceToMultipleUsersResponse>;
|
|
298
|
+
/**
|
|
299
|
+
* Utility method để sleep/delay
|
|
300
|
+
* @param ms Thời gian delay tính bằng milliseconds
|
|
301
|
+
*/
|
|
302
|
+
private sleep;
|
|
136
303
|
}
|
|
137
304
|
//# sourceMappingURL=consultation.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consultation.service.d.ts","sourceRoot":"","sources":["../../src/services/consultation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,mBAAmB;IAIlB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgD;gBAE5C,MAAM,EAAE,UAAU;IAE/C;;;;;;OAMG;IACU,eAAe,CAC1B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,mBAAmB,CAAC;IAoD/B;;;;;;;OAOG;IACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,gBAAgB,EAC3B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,mBAAmB,CAAC;IA6D/B;;;;;;OAMG;IACI,kBAAkB,CACvB,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,wBAAwB;IAW3B;;;;;;;;;;OAUG;IACU,gBAAgB,CAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,mBAAmB,CAAC;IAiE/B;;;;;;;;;;OAUG;IACU,uBAAuB,CAClC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,mBAAmB,CAAC;IAiE/B;;;;;;;;;;;;OAYG;IACU,cAAc,CACzB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,mBAAmB,CAAC;IAqE/B;;;;;;;;;;;OAWG;IACU,eAAe,CAC1B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC;IAiD/B;;;;;;;;;;;OAWG;IACU,0BAA0B,CACrC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IAyE/B;;;;;;;;;;;;OAYG;IACU,kBAAkB,CAC7B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"consultation.service.d.ts","sourceRoot":"","sources":["../../src/services/consultation.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAG1B;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,IAAI,E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,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -484,6 +484,280 @@ class ConsultationService {
|
|
|
484
484
|
throw new common_1.ZaloSDKError(`Failed to send consultation sticker message: ${error.message}`, -1, error);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Gửi chuỗi tin nhắn tư vấn với delay tùy chỉnh
|
|
489
|
+
* Hỗ trợ tất cả các loại tin nhắn: text, image, gif, file, sticker, request_user_info
|
|
490
|
+
*
|
|
491
|
+
* @param request Thông tin request gửi chuỗi tin nhắn
|
|
492
|
+
* @returns Kết quả gửi từng tin nhắn
|
|
493
|
+
*/
|
|
494
|
+
async sendMessageSequence(request) {
|
|
495
|
+
const startTime = Date.now();
|
|
496
|
+
const results = [];
|
|
497
|
+
let successCount = 0;
|
|
498
|
+
let failureCount = 0;
|
|
499
|
+
try {
|
|
500
|
+
// Validate input
|
|
501
|
+
if (!request.accessToken || request.accessToken.trim().length === 0) {
|
|
502
|
+
throw new common_1.ZaloSDKError("Access token không được để trống", -1);
|
|
503
|
+
}
|
|
504
|
+
if (!request.userId || request.userId.trim().length === 0) {
|
|
505
|
+
throw new common_1.ZaloSDKError("User ID không được để trống", -1);
|
|
506
|
+
}
|
|
507
|
+
if (!request.messages || request.messages.length === 0) {
|
|
508
|
+
throw new common_1.ZaloSDKError("Danh sách tin nhắn không được để trống", -1);
|
|
509
|
+
}
|
|
510
|
+
// Gửi từng tin nhắn theo thứ tự
|
|
511
|
+
for (let i = 0; i < request.messages.length; i++) {
|
|
512
|
+
const message = request.messages[i];
|
|
513
|
+
const messageResult = {
|
|
514
|
+
index: i,
|
|
515
|
+
type: message.type,
|
|
516
|
+
success: false,
|
|
517
|
+
timestamp: Date.now(),
|
|
518
|
+
};
|
|
519
|
+
try {
|
|
520
|
+
let response;
|
|
521
|
+
// Gửi tin nhắn theo loại
|
|
522
|
+
switch (message.type) {
|
|
523
|
+
case "text":
|
|
524
|
+
if (!message.text) {
|
|
525
|
+
throw new Error("Text không được để trống cho text message");
|
|
526
|
+
}
|
|
527
|
+
response = await this.sendTextMessage(request.accessToken, { user_id: request.userId }, { type: "text", text: message.text });
|
|
528
|
+
break;
|
|
529
|
+
case "image":
|
|
530
|
+
if (message.imageUrl) {
|
|
531
|
+
response = await this.sendImageMessage(request.accessToken, request.userId, message.imageUrl, message.text);
|
|
532
|
+
}
|
|
533
|
+
else if (message.attachmentId) {
|
|
534
|
+
response = await this.sendImageByAttachmentId(request.accessToken, request.userId, message.attachmentId, message.text);
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
throw new Error("imageUrl hoặc attachmentId là bắt buộc cho image message");
|
|
538
|
+
}
|
|
539
|
+
break;
|
|
540
|
+
case "gif":
|
|
541
|
+
if (!message.gifUrl || !message.width || !message.height) {
|
|
542
|
+
throw new Error("gifUrl, width và height là bắt buộc cho gif message");
|
|
543
|
+
}
|
|
544
|
+
response = await this.sendGifMessage(request.accessToken, request.userId, message.gifUrl, message.width, message.height, message.text);
|
|
545
|
+
break;
|
|
546
|
+
case "file":
|
|
547
|
+
if (!message.fileToken) {
|
|
548
|
+
throw new Error("fileToken là bắt buộc cho file message");
|
|
549
|
+
}
|
|
550
|
+
response = await this.sendFileMessage(request.accessToken, request.userId, message.fileToken);
|
|
551
|
+
break;
|
|
552
|
+
case "sticker":
|
|
553
|
+
if (!message.stickerAttachmentId) {
|
|
554
|
+
throw new Error("stickerAttachmentId là bắt buộc cho sticker message");
|
|
555
|
+
}
|
|
556
|
+
response = await this.sendStickerMessage(request.accessToken, request.userId, message.stickerAttachmentId);
|
|
557
|
+
break;
|
|
558
|
+
case "request_user_info":
|
|
559
|
+
if (!message.title || !message.subtitle || !message.imageUrl) {
|
|
560
|
+
throw new Error("title, subtitle và imageUrl là bắt buộc cho request_user_info message");
|
|
561
|
+
}
|
|
562
|
+
response = await this.sendRequestUserInfoMessage(request.accessToken, request.userId, message.title, message.subtitle, message.imageUrl);
|
|
563
|
+
break;
|
|
564
|
+
default:
|
|
565
|
+
throw new Error(`Loại tin nhắn không được hỗ trợ: ${message.type}`);
|
|
566
|
+
}
|
|
567
|
+
// Ghi nhận thành công
|
|
568
|
+
messageResult.success = true;
|
|
569
|
+
messageResult.response = response;
|
|
570
|
+
successCount++;
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
// Ghi nhận thất bại
|
|
574
|
+
messageResult.success = false;
|
|
575
|
+
messageResult.error = error instanceof Error ? error.message : String(error);
|
|
576
|
+
failureCount++;
|
|
577
|
+
}
|
|
578
|
+
results.push(messageResult);
|
|
579
|
+
// Delay trước khi gửi tin nhắn tiếp theo (trừ tin nhắn cuối cùng)
|
|
580
|
+
if (i < request.messages.length - 1) {
|
|
581
|
+
const delayTime = message.delay ?? request.defaultDelay ?? 0;
|
|
582
|
+
if (delayTime > 0) {
|
|
583
|
+
await this.sleep(delayTime);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const totalDuration = Date.now() - startTime;
|
|
588
|
+
return {
|
|
589
|
+
successCount,
|
|
590
|
+
failureCount,
|
|
591
|
+
results,
|
|
592
|
+
totalDuration,
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
catch (error) {
|
|
596
|
+
// Lỗi tổng quát
|
|
597
|
+
const totalDuration = Date.now() - startTime;
|
|
598
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
599
|
+
throw error;
|
|
600
|
+
}
|
|
601
|
+
throw new common_1.ZaloSDKError(`Failed to send message sequence: ${error.message}`, -1, {
|
|
602
|
+
successCount,
|
|
603
|
+
failureCount,
|
|
604
|
+
results,
|
|
605
|
+
totalDuration,
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Gửi chuỗi tin nhắn tư vấn tới nhiều users với callback tracking
|
|
611
|
+
*
|
|
612
|
+
* @param request Thông tin request gửi chuỗi tin nhắn tới nhiều users
|
|
613
|
+
* @returns Kết quả gửi tin nhắn cho tất cả users
|
|
614
|
+
*/
|
|
615
|
+
async sendMessageSequenceToMultipleUsers(request) {
|
|
616
|
+
const startTime = Date.now();
|
|
617
|
+
const userResults = [];
|
|
618
|
+
let successfulUsers = 0;
|
|
619
|
+
let failedUsers = 0;
|
|
620
|
+
let totalSuccessfulMessages = 0;
|
|
621
|
+
let totalFailedMessages = 0;
|
|
622
|
+
try {
|
|
623
|
+
// Validate input
|
|
624
|
+
if (!request.accessToken || request.accessToken.trim().length === 0) {
|
|
625
|
+
throw new common_1.ZaloSDKError("Access token không được để trống", -1);
|
|
626
|
+
}
|
|
627
|
+
if (!request.userIds || request.userIds.length === 0) {
|
|
628
|
+
throw new common_1.ZaloSDKError("Danh sách user IDs không được để trống", -1);
|
|
629
|
+
}
|
|
630
|
+
if (!request.messages || request.messages.length === 0) {
|
|
631
|
+
throw new common_1.ZaloSDKError("Danh sách tin nhắn không được để trống", -1);
|
|
632
|
+
}
|
|
633
|
+
// Loại bỏ user IDs trùng lặp và rỗng
|
|
634
|
+
const uniqueUserIds = [...new Set(request.userIds.filter(id => id && id.trim().length > 0))];
|
|
635
|
+
if (uniqueUserIds.length === 0) {
|
|
636
|
+
throw new common_1.ZaloSDKError("Không có user ID hợp lệ nào", -1);
|
|
637
|
+
}
|
|
638
|
+
// Gửi tin nhắn cho từng user tuần tự
|
|
639
|
+
for (let i = 0; i < uniqueUserIds.length; i++) {
|
|
640
|
+
const userId = uniqueUserIds[i];
|
|
641
|
+
const userStartTime = Date.now();
|
|
642
|
+
// Callback: Bắt đầu gửi cho user
|
|
643
|
+
if (request.onProgress) {
|
|
644
|
+
request.onProgress({
|
|
645
|
+
userId,
|
|
646
|
+
userIndex: i,
|
|
647
|
+
totalUsers: uniqueUserIds.length,
|
|
648
|
+
status: 'started',
|
|
649
|
+
startTime: userStartTime,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
const userResult = {
|
|
653
|
+
userId,
|
|
654
|
+
userIndex: i,
|
|
655
|
+
success: false,
|
|
656
|
+
startTime: userStartTime,
|
|
657
|
+
endTime: 0,
|
|
658
|
+
duration: 0,
|
|
659
|
+
};
|
|
660
|
+
try {
|
|
661
|
+
// Gửi chuỗi tin nhắn cho user này
|
|
662
|
+
const messageSequenceResult = await this.sendMessageSequence({
|
|
663
|
+
accessToken: request.accessToken,
|
|
664
|
+
userId,
|
|
665
|
+
messages: request.messages,
|
|
666
|
+
defaultDelay: request.defaultDelay,
|
|
667
|
+
});
|
|
668
|
+
// Ghi nhận thành công
|
|
669
|
+
const userEndTime = Date.now();
|
|
670
|
+
userResult.success = true;
|
|
671
|
+
userResult.messageSequenceResult = messageSequenceResult;
|
|
672
|
+
userResult.endTime = userEndTime;
|
|
673
|
+
userResult.duration = userEndTime - userStartTime;
|
|
674
|
+
successfulUsers++;
|
|
675
|
+
totalSuccessfulMessages += messageSequenceResult.successCount;
|
|
676
|
+
totalFailedMessages += messageSequenceResult.failureCount;
|
|
677
|
+
// Callback: Hoàn thành thành công
|
|
678
|
+
if (request.onProgress) {
|
|
679
|
+
request.onProgress({
|
|
680
|
+
userId,
|
|
681
|
+
userIndex: i,
|
|
682
|
+
totalUsers: uniqueUserIds.length,
|
|
683
|
+
status: 'completed',
|
|
684
|
+
result: messageSequenceResult,
|
|
685
|
+
startTime: userStartTime,
|
|
686
|
+
endTime: userEndTime,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
catch (error) {
|
|
691
|
+
// Ghi nhận thất bại
|
|
692
|
+
const userEndTime = Date.now();
|
|
693
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
694
|
+
userResult.success = false;
|
|
695
|
+
userResult.error = errorMessage;
|
|
696
|
+
userResult.endTime = userEndTime;
|
|
697
|
+
userResult.duration = userEndTime - userStartTime;
|
|
698
|
+
failedUsers++;
|
|
699
|
+
// Với user thất bại, coi như tất cả tin nhắn đều thất bại
|
|
700
|
+
totalFailedMessages += request.messages.length;
|
|
701
|
+
// Callback: Thất bại
|
|
702
|
+
if (request.onProgress) {
|
|
703
|
+
request.onProgress({
|
|
704
|
+
userId,
|
|
705
|
+
userIndex: i,
|
|
706
|
+
totalUsers: uniqueUserIds.length,
|
|
707
|
+
status: 'failed',
|
|
708
|
+
error: errorMessage,
|
|
709
|
+
startTime: userStartTime,
|
|
710
|
+
endTime: userEndTime,
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
userResults.push(userResult);
|
|
715
|
+
// Delay giữa các user (trừ user cuối cùng)
|
|
716
|
+
if (i < uniqueUserIds.length - 1 && request.delayBetweenUsers && request.delayBetweenUsers > 0) {
|
|
717
|
+
await this.sleep(request.delayBetweenUsers);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
const totalDuration = Date.now() - startTime;
|
|
721
|
+
const totalMessages = uniqueUserIds.length * request.messages.length;
|
|
722
|
+
return {
|
|
723
|
+
totalUsers: uniqueUserIds.length,
|
|
724
|
+
successfulUsers,
|
|
725
|
+
failedUsers,
|
|
726
|
+
userResults,
|
|
727
|
+
totalDuration,
|
|
728
|
+
messageStats: {
|
|
729
|
+
totalSuccessfulMessages,
|
|
730
|
+
totalFailedMessages,
|
|
731
|
+
totalMessages,
|
|
732
|
+
},
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
catch (error) {
|
|
736
|
+
const totalDuration = Date.now() - startTime;
|
|
737
|
+
if (error instanceof common_1.ZaloSDKError) {
|
|
738
|
+
throw error;
|
|
739
|
+
}
|
|
740
|
+
throw new common_1.ZaloSDKError(`Failed to send message sequence to multiple users: ${error.message}`, -1, {
|
|
741
|
+
totalUsers: request.userIds?.length || 0,
|
|
742
|
+
successfulUsers,
|
|
743
|
+
failedUsers,
|
|
744
|
+
userResults,
|
|
745
|
+
totalDuration,
|
|
746
|
+
messageStats: {
|
|
747
|
+
totalSuccessfulMessages,
|
|
748
|
+
totalFailedMessages,
|
|
749
|
+
totalMessages: (request.userIds?.length || 0) * (request.messages?.length || 0),
|
|
750
|
+
},
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Utility method để sleep/delay
|
|
756
|
+
* @param ms Thời gian delay tính bằng milliseconds
|
|
757
|
+
*/
|
|
758
|
+
sleep(ms) {
|
|
759
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
760
|
+
}
|
|
487
761
|
}
|
|
488
762
|
exports.ConsultationService = ConsultationService;
|
|
489
763
|
//# sourceMappingURL=consultation.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consultation.service.js","sourceRoot":"","sources":["../../src/services/consultation.service.ts"],"names":[],"mappings":";;;AAOA,4CAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,mBAAmB;IAI9B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAH/C,8CAA8C;QAC7B,aAAQ,GAAG,4CAA4C,CAAC;IAEvB,CAAC;IAEnD;;;;;;OAMG;IACI,KAAK,CAAC,eAAe,CAC1B,WAAmB,EACnB,SAA2B,EAC3B,OAAoB;QAEpB,IAAI,CAAC;YACH,8CAA8C;YAC9C,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtD,MAAM,IAAI,qBAAY,CAAC,uCAAuC,EAAE,CAAC,CAAC,CAAC,CAAC;YACtE,CAAC;YAED,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;gBAC/B,MAAM,IAAI,qBAAY,CACpB,kDAAkD,EAClD,CAAC,CAAC,CACH,CAAC;YACJ,CAAC;YAED,kCAAkC;YAClC,MAAM,OAAO,GAAG;gBACd,SAAS,EAAE;oBACT,OAAO,EAAE,SAAS,CAAC,OAAO;iBAC3B;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO,CAAC,IAA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AAE;oBACT,OAAO,EAAE,MAAM;iBAChB;gBACD,OAAO,EAAE;oBACP,UAAU,EAAE;wBACV,IAAI,EAAE,UAAU;wBAChB,OAAO,EAAE;4BACP,aAAa,EAAE,OAAO;4BACtB,QAAQ,EAAE;gCACR;oCACE,UAAU,EAAE,SAAS;oCACrB,aAAa,EAAE,mBAAmB;iCACnC;6BACF;yBACF;qBACF;iBACF;aACF,CAAC;YAEF,MAAM,MAAM,GACV,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YAEjE,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;gBACvB,MAAM,IAAI,qBAAY,CACpB,MAAM,CAAC,OAAO,IAAI,6CAA6C,EAC/D,MAAM,CAAC,KAAK,EACZ,MAAM,CACP,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjB,MAAM,IAAI,qBAAY,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAC,CAAC;YAC1D,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,qBAAY,EAAE,CAAC;gBAClC,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,qBAAY,CACpB,gDACG,KAAe,CAAC,OACnB,EAAE,EACF,CAAC,CAAC,EACF,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAroBD,kDAqoBC"}
|
|
1
|
+
{"version":3,"file":"consultation.service.js","sourceRoot":"","sources":["../../src/services/consultation.service.ts"],"names":[],"mappings":";;;AAOA,4CAA6D;AA2J7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,mBAAmB;IAI9B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAH/C,8CAA8C;QAC7B,a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BACE,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;gBACxC,eAAe;gBACf,WAAW;gBACX,WAAW;gBACX,aAAa;gBACb,YAAY,EAAE;oBACZ,uBAAuB;oBACvB,mBAAmB;oBACnB,aAAa,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC;iBAChF;aACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AA/+BD,kDA++BC"}
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
# API Gửi Chuỗi Tin Nhắn Tư Vấn
|
|
2
|
+
|
|
3
|
+
API này cho phép gửi một chuỗi tin nhắn tư vấn tới một người dùng với khả năng delay tùy chỉnh giữa các tin nhắn.
|
|
4
|
+
|
|
5
|
+
## Tính năng
|
|
6
|
+
|
|
7
|
+
- ✅ Hỗ trợ tất cả các loại tin nhắn: `text`, `image`, `gif`, `file`, `sticker`, `request_user_info`
|
|
8
|
+
- ✅ Delay tùy chỉnh cho từng tin nhắn
|
|
9
|
+
- ✅ Delay mặc định cho toàn bộ chuỗi tin nhắn
|
|
10
|
+
- ✅ Xử lý lỗi chi tiết cho từng tin nhắn
|
|
11
|
+
- ✅ Thống kê kết quả gửi tin nhắn
|
|
12
|
+
- ✅ Ghi log thời gian thực hiện
|
|
13
|
+
|
|
14
|
+
## Cách sử dụng
|
|
15
|
+
|
|
16
|
+
### 1. Import các interface và service
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import {
|
|
20
|
+
ConsultationService,
|
|
21
|
+
MessageItem,
|
|
22
|
+
SendMessageSequenceRequest
|
|
23
|
+
} from "../src/services/consultation.service";
|
|
24
|
+
import { ZaloClient } from "../src/clients/zalo-client";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Khởi tạo service
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
const zaloClient = new ZaloClient();
|
|
31
|
+
const consultationService = new ConsultationService(zaloClient);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Định nghĩa chuỗi tin nhắn
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const messages: MessageItem[] = [
|
|
38
|
+
{
|
|
39
|
+
type: "text",
|
|
40
|
+
text: "Xin chào! 👋",
|
|
41
|
+
delay: 2000, // Delay 2 giây sau tin nhắn này
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "image",
|
|
45
|
+
imageUrl: "https://example.com/image.jpg",
|
|
46
|
+
text: "Hình ảnh minh họa",
|
|
47
|
+
delay: 1500,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: "sticker",
|
|
51
|
+
stickerAttachmentId: "STICKER_ID",
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 4. Gửi chuỗi tin nhắn
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const request: SendMessageSequenceRequest = {
|
|
60
|
+
accessToken: "YOUR_ACCESS_TOKEN",
|
|
61
|
+
userId: "USER_ID",
|
|
62
|
+
messages,
|
|
63
|
+
defaultDelay: 1000, // Delay mặc định 1 giây
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const result = await consultationService.sendMessageSequence(request);
|
|
68
|
+
console.log(`Thành công: ${result.successCount}/${messages.length}`);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error("Lỗi:", error);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Các loại tin nhắn được hỗ trợ
|
|
75
|
+
|
|
76
|
+
### 1. Text Message
|
|
77
|
+
```typescript
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: "Nội dung tin nhắn",
|
|
81
|
+
delay: 1000, // Optional
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Image Message
|
|
86
|
+
```typescript
|
|
87
|
+
// Sử dụng URL
|
|
88
|
+
{
|
|
89
|
+
type: "image",
|
|
90
|
+
imageUrl: "https://example.com/image.jpg",
|
|
91
|
+
text: "Caption cho ảnh", // Optional
|
|
92
|
+
delay: 1500,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Hoặc sử dụng attachment ID
|
|
96
|
+
{
|
|
97
|
+
type: "image",
|
|
98
|
+
attachmentId: "ATTACHMENT_ID",
|
|
99
|
+
text: "Caption cho ảnh", // Optional
|
|
100
|
+
delay: 1500,
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 3. GIF Message
|
|
105
|
+
```typescript
|
|
106
|
+
{
|
|
107
|
+
type: "gif",
|
|
108
|
+
gifUrl: "https://example.com/animation.gif",
|
|
109
|
+
width: 300, // Bắt buộc
|
|
110
|
+
height: 200, // Bắt buộc
|
|
111
|
+
text: "Caption cho GIF", // Optional
|
|
112
|
+
delay: 2000,
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 4. File Message
|
|
117
|
+
```typescript
|
|
118
|
+
{
|
|
119
|
+
type: "file",
|
|
120
|
+
fileToken: "FILE_TOKEN_FROM_UPLOAD_API", // Bắt buộc
|
|
121
|
+
delay: 1000,
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 5. Sticker Message
|
|
126
|
+
```typescript
|
|
127
|
+
{
|
|
128
|
+
type: "sticker",
|
|
129
|
+
stickerAttachmentId: "STICKER_ID", // Bắt buộc
|
|
130
|
+
delay: 500,
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 6. Request User Info Message
|
|
135
|
+
```typescript
|
|
136
|
+
{
|
|
137
|
+
type: "request_user_info",
|
|
138
|
+
title: "Đăng ký tư vấn", // Bắt buộc, max 100 ký tự
|
|
139
|
+
subtitle: "Vui lòng cung cấp...", // Bắt buộc, max 500 ký tự
|
|
140
|
+
imageUrl: "https://example.com/form.jpg", // Bắt buộc
|
|
141
|
+
delay: 2000,
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Interface chi tiết
|
|
146
|
+
|
|
147
|
+
### MessageItem
|
|
148
|
+
```typescript
|
|
149
|
+
interface MessageItem {
|
|
150
|
+
type: "text" | "image" | "gif" | "file" | "sticker" | "request_user_info";
|
|
151
|
+
text?: string;
|
|
152
|
+
imageUrl?: string;
|
|
153
|
+
gifUrl?: string;
|
|
154
|
+
width?: number;
|
|
155
|
+
height?: number;
|
|
156
|
+
fileToken?: string;
|
|
157
|
+
attachmentId?: string;
|
|
158
|
+
stickerAttachmentId?: string;
|
|
159
|
+
title?: string;
|
|
160
|
+
subtitle?: string;
|
|
161
|
+
delay?: number; // milliseconds
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### SendMessageSequenceRequest
|
|
166
|
+
```typescript
|
|
167
|
+
interface SendMessageSequenceRequest {
|
|
168
|
+
accessToken: string;
|
|
169
|
+
userId: string;
|
|
170
|
+
messages: MessageItem[];
|
|
171
|
+
defaultDelay?: number; // milliseconds
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### SendMessageSequenceResponse
|
|
176
|
+
```typescript
|
|
177
|
+
interface SendMessageSequenceResponse {
|
|
178
|
+
successCount: number;
|
|
179
|
+
failureCount: number;
|
|
180
|
+
results: Array<{
|
|
181
|
+
index: number;
|
|
182
|
+
type: string;
|
|
183
|
+
success: boolean;
|
|
184
|
+
response?: SendMessageResponse;
|
|
185
|
+
error?: string;
|
|
186
|
+
timestamp: number;
|
|
187
|
+
}>;
|
|
188
|
+
totalDuration: number; // milliseconds
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Ví dụ thực tế
|
|
193
|
+
|
|
194
|
+
### Chuỗi tin nhắn chào mừng khách hàng mới
|
|
195
|
+
```typescript
|
|
196
|
+
const welcomeMessages: MessageItem[] = [
|
|
197
|
+
{
|
|
198
|
+
type: "text",
|
|
199
|
+
text: "🎉 Chào mừng bạn đến với dịch vụ của chúng tôi!",
|
|
200
|
+
delay: 2000,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
type: "sticker",
|
|
204
|
+
stickerAttachmentId: "WELCOME_STICKER_ID",
|
|
205
|
+
delay: 1500,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
type: "image",
|
|
209
|
+
imageUrl: "https://company.com/welcome-banner.jpg",
|
|
210
|
+
text: "Khám phá các dịch vụ tuyệt vời",
|
|
211
|
+
delay: 3000,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
type: "text",
|
|
215
|
+
text: "Chúng tôi sẽ hỗ trợ bạn 24/7. Hãy cho chúng tôi biết nếu bạn cần giúp đỡ! 💪",
|
|
216
|
+
},
|
|
217
|
+
];
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Chuỗi tin nhắn hỗ trợ kỹ thuật
|
|
221
|
+
```typescript
|
|
222
|
+
const supportMessages: MessageItem[] = [
|
|
223
|
+
{
|
|
224
|
+
type: "text",
|
|
225
|
+
text: "Chúng tôi đã nhận được yêu cầu hỗ trợ của bạn 🔧",
|
|
226
|
+
delay: 1000,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
type: "file",
|
|
230
|
+
fileToken: "TROUBLESHOOTING_GUIDE_TOKEN",
|
|
231
|
+
delay: 2000,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
type: "text",
|
|
235
|
+
text: "Vui lòng tham khảo hướng dẫn trên. Nếu vẫn gặp vấn đề, hãy liên hệ trực tiếp:",
|
|
236
|
+
delay: 1500,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
type: "request_user_info",
|
|
240
|
+
title: "Thông tin liên hệ",
|
|
241
|
+
subtitle: "Để chúng tôi hỗ trợ bạn nhanh nhất",
|
|
242
|
+
imageUrl: "https://company.com/support-form.jpg",
|
|
243
|
+
},
|
|
244
|
+
];
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Lưu ý quan trọng
|
|
248
|
+
|
|
249
|
+
1. **Delay**: Tính bằng milliseconds. Delay chỉ áp dụng giữa các tin nhắn, không có delay sau tin nhắn cuối cùng.
|
|
250
|
+
|
|
251
|
+
2. **Error Handling**: API sẽ tiếp tục gửi các tin nhắn tiếp theo ngay cả khi một tin nhắn thất bại.
|
|
252
|
+
|
|
253
|
+
3. **Rate Limiting**: Cần tuân thủ giới hạn tần suất gửi tin nhắn của Zalo để tránh bị chặn.
|
|
254
|
+
|
|
255
|
+
4. **Validation**: Mỗi loại tin nhắn có các trường bắt buộc riêng, cần đảm bảo cung cấp đầy đủ thông tin.
|
|
256
|
+
|
|
257
|
+
5. **File Upload**: Đối với file message, cần upload file trước và lấy token từ API upload của Zalo.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
# API Gửi Chuỗi Tin Nhắn Tới Nhiều Users
|
|
262
|
+
|
|
263
|
+
API mở rộng cho phép gửi chuỗi tin nhắn tư vấn tới nhiều users cùng lúc với callback tracking real-time.
|
|
264
|
+
|
|
265
|
+
## Tính năng mới
|
|
266
|
+
|
|
267
|
+
- ✅ Gửi chuỗi tin nhắn tới nhiều users
|
|
268
|
+
- ✅ Callback tracking real-time cho từng user
|
|
269
|
+
- ✅ Thống kê chi tiết (thành công/thất bại)
|
|
270
|
+
- ✅ Delay tùy chỉnh giữa các users
|
|
271
|
+
- ✅ Loại bỏ user IDs trùng lặp tự động
|
|
272
|
+
- ✅ Error handling riêng biệt cho từng user
|
|
273
|
+
|
|
274
|
+
## Cách sử dụng
|
|
275
|
+
|
|
276
|
+
### 1. Import interface mới
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
import {
|
|
280
|
+
SendMessageSequenceToMultipleUsersRequest,
|
|
281
|
+
UserProgressInfo
|
|
282
|
+
} from "../src/services/consultation.service";
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 2. Định nghĩa callback tracking
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
const onProgress = (progress: UserProgressInfo) => {
|
|
289
|
+
switch (progress.status) {
|
|
290
|
+
case 'started':
|
|
291
|
+
console.log(`🚀 Bắt đầu gửi cho User ${progress.userIndex + 1}/${progress.totalUsers}`);
|
|
292
|
+
break;
|
|
293
|
+
case 'completed':
|
|
294
|
+
console.log(`✅ Hoàn thành User ${progress.userIndex + 1} - Thành công: ${progress.result?.successCount}`);
|
|
295
|
+
break;
|
|
296
|
+
case 'failed':
|
|
297
|
+
console.log(`❌ Thất bại User ${progress.userIndex + 1} - Lỗi: ${progress.error}`);
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 3. Gửi tới nhiều users
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
const request: SendMessageSequenceToMultipleUsersRequest = {
|
|
307
|
+
accessToken: "YOUR_ACCESS_TOKEN",
|
|
308
|
+
userIds: ["USER_1", "USER_2", "USER_3"],
|
|
309
|
+
messages: [
|
|
310
|
+
{ type: "text", text: "Tin nhắn 1", delay: 1000 },
|
|
311
|
+
{ type: "text", text: "Tin nhắn 2" },
|
|
312
|
+
],
|
|
313
|
+
delayBetweenUsers: 2000, // Delay 2s giữa các user
|
|
314
|
+
onProgress, // Callback tracking
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const result = await consultationService.sendMessageSequenceToMultipleUsers(request);
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Interface chi tiết
|
|
321
|
+
|
|
322
|
+
### SendMessageSequenceToMultipleUsersRequest
|
|
323
|
+
```typescript
|
|
324
|
+
interface SendMessageSequenceToMultipleUsersRequest {
|
|
325
|
+
accessToken: string;
|
|
326
|
+
userIds: string[]; // Danh sách user IDs
|
|
327
|
+
messages: MessageItem[]; // Chuỗi tin nhắn
|
|
328
|
+
defaultDelay?: number; // Delay giữa tin nhắn (ms)
|
|
329
|
+
delayBetweenUsers?: number; // Delay giữa users (ms)
|
|
330
|
+
onProgress?: (progress: UserProgressInfo) => void; // Callback tracking
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### UserProgressInfo
|
|
335
|
+
```typescript
|
|
336
|
+
interface UserProgressInfo {
|
|
337
|
+
userId: string; // User ID hiện tại
|
|
338
|
+
userIndex: number; // Index của user (0-based)
|
|
339
|
+
totalUsers: number; // Tổng số users
|
|
340
|
+
status: 'started' | 'completed' | 'failed'; // Trạng thái
|
|
341
|
+
result?: SendMessageSequenceResponse; // Kết quả (nếu completed)
|
|
342
|
+
error?: string; // Lỗi (nếu failed)
|
|
343
|
+
startTime: number; // Thời gian bắt đầu
|
|
344
|
+
endTime?: number; // Thời gian kết thúc
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### SendMessageSequenceToMultipleUsersResponse
|
|
349
|
+
```typescript
|
|
350
|
+
interface SendMessageSequenceToMultipleUsersResponse {
|
|
351
|
+
totalUsers: number; // Tổng số users
|
|
352
|
+
successfulUsers: number; // Số users thành công
|
|
353
|
+
failedUsers: number; // Số users thất bại
|
|
354
|
+
userResults: Array<{ // Chi tiết từng user
|
|
355
|
+
userId: string;
|
|
356
|
+
userIndex: number;
|
|
357
|
+
success: boolean;
|
|
358
|
+
messageSequenceResult?: SendMessageSequenceResponse;
|
|
359
|
+
error?: string;
|
|
360
|
+
startTime: number;
|
|
361
|
+
endTime: number;
|
|
362
|
+
duration: number;
|
|
363
|
+
}>;
|
|
364
|
+
totalDuration: number; // Tổng thời gian (ms)
|
|
365
|
+
messageStats: { // Thống kê tin nhắn
|
|
366
|
+
totalSuccessfulMessages: number;
|
|
367
|
+
totalFailedMessages: number;
|
|
368
|
+
totalMessages: number;
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
## Ví dụ thực tế
|
|
374
|
+
|
|
375
|
+
### Marketing Campaign
|
|
376
|
+
```typescript
|
|
377
|
+
const marketingMessages: MessageItem[] = [
|
|
378
|
+
{
|
|
379
|
+
type: "text",
|
|
380
|
+
text: "🎉 Flash Sale 24h - Giảm 50% tất cả sản phẩm!",
|
|
381
|
+
delay: 2000,
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
type: "image",
|
|
385
|
+
imageUrl: "https://shop.com/flash-sale-banner.jpg",
|
|
386
|
+
text: "Khuyến mãi khủng - Số lượng có hạn",
|
|
387
|
+
delay: 3000,
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: "text",
|
|
391
|
+
text: "⏰ Chỉ còn 12 giờ! Mua ngay: https://shop.com/sale",
|
|
392
|
+
},
|
|
393
|
+
];
|
|
394
|
+
|
|
395
|
+
const customerIds = ["CUSTOMER_1", "CUSTOMER_2", "CUSTOMER_3"];
|
|
396
|
+
|
|
397
|
+
let sentCount = 0;
|
|
398
|
+
const onProgress = (progress: UserProgressInfo) => {
|
|
399
|
+
if (progress.status === 'completed') {
|
|
400
|
+
sentCount++;
|
|
401
|
+
console.log(`📤 Đã gửi cho ${sentCount}/${progress.totalUsers} khách hàng`);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const result = await consultationService.sendMessageSequenceToMultipleUsers({
|
|
406
|
+
accessToken: "TOKEN",
|
|
407
|
+
userIds: customerIds,
|
|
408
|
+
messages: marketingMessages,
|
|
409
|
+
delayBetweenUsers: 1500, // Tránh spam
|
|
410
|
+
onProgress,
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
console.log(`🎯 Campaign hoàn thành: ${result.successfulUsers}/${result.totalUsers} khách hàng`);
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Customer Support Notification
|
|
417
|
+
```typescript
|
|
418
|
+
const supportMessages: MessageItem[] = [
|
|
419
|
+
{
|
|
420
|
+
type: "text",
|
|
421
|
+
text: "🔧 Hệ thống sẽ bảo trì từ 2:00-4:00 sáng mai",
|
|
422
|
+
delay: 1000,
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
type: "text",
|
|
426
|
+
text: "📞 Hotline hỗ trợ 24/7: 1900-xxxx",
|
|
427
|
+
},
|
|
428
|
+
];
|
|
429
|
+
|
|
430
|
+
const allCustomers = ["USER_1", "USER_2", "USER_3", "USER_4"];
|
|
431
|
+
|
|
432
|
+
const result = await consultationService.sendMessageSequenceToMultipleUsers({
|
|
433
|
+
accessToken: "TOKEN",
|
|
434
|
+
userIds: allCustomers,
|
|
435
|
+
messages: supportMessages,
|
|
436
|
+
delayBetweenUsers: 500,
|
|
437
|
+
onProgress: (progress) => {
|
|
438
|
+
if (progress.status === 'failed') {
|
|
439
|
+
console.log(`❌ Không gửi được cho ${progress.userId}: ${progress.error}`);
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
console.log(`📢 Thông báo đã gửi tới ${result.successfulUsers} khách hàng`);
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
## So sánh API cũ vs mới
|
|
448
|
+
|
|
449
|
+
| Tính năng | API đơn user | API nhiều users |
|
|
450
|
+
|-----------|-------------|-----------------|
|
|
451
|
+
| Số lượng users | 1 user | Nhiều users |
|
|
452
|
+
| Callback tracking | ❌ | ✅ Real-time |
|
|
453
|
+
| Thống kê tổng quan | ❌ | ✅ Chi tiết |
|
|
454
|
+
| Delay giữa users | ❌ | ✅ Tùy chỉnh |
|
|
455
|
+
| Error handling | Dừng khi lỗi | Tiếp tục với user khác |
|
|
456
|
+
| Use case | Tư vấn 1-1 | Marketing, thông báo |
|
|
457
|
+
|
|
458
|
+
## Lưu ý quan trọng
|
|
459
|
+
|
|
460
|
+
1. **Rate Limiting**: Sử dụng `delayBetweenUsers` để tránh hit rate limit của Zalo
|
|
461
|
+
2. **Memory Usage**: Với số lượng users lớn, cân nhắc chia batch
|
|
462
|
+
3. **Callback Performance**: Callback không nên thực hiện operations nặng
|
|
463
|
+
4. **Error Isolation**: Lỗi của 1 user không ảnh hưởng đến users khác
|
|
464
|
+
5. **Duplicate Handling**: API tự động loại bỏ user IDs trùng lặp
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { ConsultationService, MessageItem, SendMessageSequenceRequest } from "../src/services/consultation.service";
|
|
2
|
+
import { ZaloClient } from "../src/clients/zalo-client";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Ví dụ sử dụng API gửi chuỗi tin nhắn tư vấn
|
|
6
|
+
*/
|
|
7
|
+
async function sendMessageSequenceExample() {
|
|
8
|
+
// Khởi tạo Zalo client và consultation service
|
|
9
|
+
const zaloClient = new ZaloClient();
|
|
10
|
+
const consultationService = new ConsultationService(zaloClient);
|
|
11
|
+
|
|
12
|
+
// Thông tin cấu hình
|
|
13
|
+
const accessToken = "YOUR_ACCESS_TOKEN";
|
|
14
|
+
const userId = "USER_ID_TO_SEND_TO";
|
|
15
|
+
|
|
16
|
+
// Định nghĩa chuỗi tin nhắn
|
|
17
|
+
const messages: MessageItem[] = [
|
|
18
|
+
// 1. Tin nhắn chào hỏi
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: "Xin chào! Cảm ơn bạn đã liên hệ với chúng tôi 👋",
|
|
22
|
+
delay: 2000, // Delay 2 giây sau tin nhắn này
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// 2. Gửi sticker
|
|
26
|
+
{
|
|
27
|
+
type: "sticker",
|
|
28
|
+
stickerAttachmentId: "STICKER_ID",
|
|
29
|
+
delay: 1500, // Delay 1.5 giây
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
// 3. Tin nhắn giới thiệu dịch vụ
|
|
33
|
+
{
|
|
34
|
+
type: "text",
|
|
35
|
+
text: "Chúng tôi cung cấp các dịch vụ tư vấn chuyên nghiệp. Dưới đây là một số thông tin chi tiết:",
|
|
36
|
+
delay: 3000, // Delay 3 giây
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// 4. Gửi hình ảnh minh họa
|
|
40
|
+
{
|
|
41
|
+
type: "image",
|
|
42
|
+
imageUrl: "https://example.com/service-image.jpg",
|
|
43
|
+
text: "Dịch vụ tư vấn của chúng tôi",
|
|
44
|
+
delay: 2000,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
// 5. Gửi file tài liệu
|
|
48
|
+
{
|
|
49
|
+
type: "file",
|
|
50
|
+
fileToken: "FILE_TOKEN_FROM_UPLOAD_API",
|
|
51
|
+
delay: 1000,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// 6. Gửi GIF
|
|
55
|
+
{
|
|
56
|
+
type: "gif",
|
|
57
|
+
gifUrl: "https://example.com/animation.gif",
|
|
58
|
+
width: 300,
|
|
59
|
+
height: 200,
|
|
60
|
+
text: "Quy trình làm việc của chúng tôi",
|
|
61
|
+
delay: 2500,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
// 7. Yêu cầu thông tin người dùng
|
|
65
|
+
{
|
|
66
|
+
type: "request_user_info",
|
|
67
|
+
title: "Đăng ký tư vấn miễn phí",
|
|
68
|
+
subtitle: "Vui lòng cung cấp thông tin để chúng tôi hỗ trợ bạn tốt nhất",
|
|
69
|
+
imageUrl: "https://example.com/consultation-form.jpg",
|
|
70
|
+
delay: 1000,
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// 8. Tin nhắn kết thúc (không có delay vì là tin cuối)
|
|
74
|
+
{
|
|
75
|
+
type: "text",
|
|
76
|
+
text: "Cảm ơn bạn! Chúng tôi sẽ liên hệ lại trong thời gian sớm nhất. 🙏",
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// Tạo request
|
|
81
|
+
const request: SendMessageSequenceRequest = {
|
|
82
|
+
accessToken,
|
|
83
|
+
userId,
|
|
84
|
+
messages,
|
|
85
|
+
defaultDelay: 1000, // Delay mặc định 1 giây nếu tin nhắn không có delay riêng
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
console.log("🚀 Bắt đầu gửi chuỗi tin nhắn...");
|
|
90
|
+
console.log(`📝 Tổng số tin nhắn: ${messages.length}`);
|
|
91
|
+
|
|
92
|
+
// Gửi chuỗi tin nhắn
|
|
93
|
+
const result = await consultationService.sendMessageSequence(request);
|
|
94
|
+
|
|
95
|
+
console.log("\n✅ Kết quả gửi tin nhắn:");
|
|
96
|
+
console.log(`✅ Thành công: ${result.successCount}/${messages.length}`);
|
|
97
|
+
console.log(`❌ Thất bại: ${result.failureCount}/${messages.length}`);
|
|
98
|
+
console.log(`⏱️ Tổng thời gian: ${result.totalDuration}ms`);
|
|
99
|
+
|
|
100
|
+
// In chi tiết kết quả từng tin nhắn
|
|
101
|
+
console.log("\n📊 Chi tiết từng tin nhắn:");
|
|
102
|
+
result.results.forEach((messageResult, index) => {
|
|
103
|
+
const status = messageResult.success ? "✅" : "❌";
|
|
104
|
+
const time = new Date(messageResult.timestamp).toLocaleTimeString();
|
|
105
|
+
|
|
106
|
+
console.log(`${status} [${index + 1}] ${messageResult.type} - ${time}`);
|
|
107
|
+
|
|
108
|
+
if (messageResult.success && messageResult.response) {
|
|
109
|
+
console.log(` 📧 Message ID: ${messageResult.response.message_id}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!messageResult.success && messageResult.error) {
|
|
113
|
+
console.log(` ❌ Lỗi: ${messageResult.error}`);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error("❌ Lỗi khi gửi chuỗi tin nhắn:", error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Ví dụ gửi chuỗi tin nhắn đơn giản chỉ có text
|
|
124
|
+
*/
|
|
125
|
+
async function sendSimpleTextSequence() {
|
|
126
|
+
const zaloClient = new ZaloClient();
|
|
127
|
+
const consultationService = new ConsultationService(zaloClient);
|
|
128
|
+
|
|
129
|
+
const accessToken = "YOUR_ACCESS_TOKEN";
|
|
130
|
+
const userId = "USER_ID_TO_SEND_TO";
|
|
131
|
+
|
|
132
|
+
const messages: MessageItem[] = [
|
|
133
|
+
{
|
|
134
|
+
type: "text",
|
|
135
|
+
text: "Tin nhắn đầu tiên",
|
|
136
|
+
delay: 1000,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "text",
|
|
140
|
+
text: "Tin nhắn thứ hai",
|
|
141
|
+
delay: 1500,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: "text",
|
|
145
|
+
text: "Tin nhắn cuối cùng",
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
|
|
149
|
+
const request: SendMessageSequenceRequest = {
|
|
150
|
+
accessToken,
|
|
151
|
+
userId,
|
|
152
|
+
messages,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
const result = await consultationService.sendMessageSequence(request);
|
|
157
|
+
console.log("Kết quả:", result);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.error("Lỗi:", error);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Ví dụ gửi chuỗi tin nhắn với delay mặc định
|
|
165
|
+
*/
|
|
166
|
+
async function sendSequenceWithDefaultDelay() {
|
|
167
|
+
const zaloClient = new ZaloClient();
|
|
168
|
+
const consultationService = new ConsultationService(zaloClient);
|
|
169
|
+
|
|
170
|
+
const accessToken = "YOUR_ACCESS_TOKEN";
|
|
171
|
+
const userId = "USER_ID_TO_SEND_TO";
|
|
172
|
+
|
|
173
|
+
// Các tin nhắn không có delay riêng sẽ sử dụng defaultDelay
|
|
174
|
+
const messages: MessageItem[] = [
|
|
175
|
+
{ type: "text", text: "Tin nhắn 1" },
|
|
176
|
+
{ type: "text", text: "Tin nhắn 2" },
|
|
177
|
+
{ type: "text", text: "Tin nhắn 3" },
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
const request: SendMessageSequenceRequest = {
|
|
181
|
+
accessToken,
|
|
182
|
+
userId,
|
|
183
|
+
messages,
|
|
184
|
+
defaultDelay: 2000, // Delay 2 giây giữa các tin nhắn
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
const result = await consultationService.sendMessageSequence(request);
|
|
189
|
+
console.log("Kết quả:", result);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.error("Lỗi:", error);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Export các function để sử dụng
|
|
196
|
+
export {
|
|
197
|
+
sendMessageSequenceExample,
|
|
198
|
+
sendSimpleTextSequence,
|
|
199
|
+
sendSequenceWithDefaultDelay,
|
|
200
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warriorteam/redai-zalo-sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Comprehensive TypeScript/JavaScript SDK for Zalo APIs - Official Account, ZNS, Consultation Service, Group Messaging, Social APIs,
|
|
3
|
+
"version": "1.18.0",
|
|
4
|
+
"description": "Comprehensive TypeScript/JavaScript SDK for Zalo APIs - Official Account, ZNS, Consultation Service, Group Messaging, Social APIs, Enhanced Article Management, and Message Sequence APIs with Real-time Tracking",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -33,7 +33,14 @@
|
|
|
33
33
|
"article-management",
|
|
34
34
|
"auto-pagination",
|
|
35
35
|
"bulk-fetch",
|
|
36
|
-
"progress-tracking"
|
|
36
|
+
"progress-tracking",
|
|
37
|
+
"message-sequence",
|
|
38
|
+
"bulk-messaging",
|
|
39
|
+
"marketing-automation",
|
|
40
|
+
"real-time-tracking",
|
|
41
|
+
"callback-tracking",
|
|
42
|
+
"multiple-users",
|
|
43
|
+
"campaign-management"
|
|
37
44
|
],
|
|
38
45
|
"author": "RedAI Team",
|
|
39
46
|
"license": "MIT",
|