@warriorteam/redai-zalo-sdk 1.6.0 → 1.6.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/CHANGELOG.md +304 -304
- package/UPDATE_ARTICLE_STATUS.md +152 -0
- package/dist/services/article.service.d.ts +10 -1
- package/dist/services/article.service.d.ts.map +1 -1
- package/dist/services/article.service.js +65 -0
- package/dist/services/article.service.js.map +1 -1
- package/docs/ARTICLE_MANAGEMENT.md +60 -1
- package/docs/CONSULTATION_SERVICE.md +512 -512
- package/docs/GROUP_MANAGEMENT.md +232 -232
- package/docs/USER_MANAGEMENT.md +481 -481
- package/docs/WEBHOOK_EVENTS.md +858 -858
- package/examples/article-status-update.ts +178 -0
- package/examples/user-list-post-example.ts +186 -186
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,304 +1,304 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [1.6.0] - 2025-01-09
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
#### 🆕 POST Method for User List Retrieval
|
|
13
|
-
- **New Method**: `postUserList()` in UserService for POST-based user list retrieval
|
|
14
|
-
- **Same Endpoint**: Uses identical URL as `getUserList()` but with POST method
|
|
15
|
-
- **Request Body**: Sends data via request body instead of URL parameters
|
|
16
|
-
- **Full Feature Parity**: Supports all same parameters as GET method
|
|
17
|
-
- **Type Safety**: Same TypeScript interfaces and response types
|
|
18
|
-
|
|
19
|
-
#### 📚 Enhanced Documentation & Examples
|
|
20
|
-
- **Comprehensive Example**: New `examples/user-list-post-example.ts` with detailed usage scenarios
|
|
21
|
-
- **Method Comparison**: Examples comparing GET vs POST approaches
|
|
22
|
-
- **Pagination Support**: Complete pagination examples using POST method
|
|
23
|
-
- **Filter Demonstrations**: Examples with tags, followers, and interaction periods
|
|
24
|
-
|
|
25
|
-
### Technical Details
|
|
26
|
-
|
|
27
|
-
#### POST Method Features
|
|
28
|
-
- **Endpoint**: `https://openapi.zalo.me/v3.0/oa/user/getlist` (same as GET)
|
|
29
|
-
- **Method**: POST with JSON body data
|
|
30
|
-
- **Parameters Support**:
|
|
31
|
-
- `offset`: Starting position for pagination
|
|
32
|
-
- `count`: Number of users to retrieve (max 50)
|
|
33
|
-
- `tag_name`: Filter by specific tag
|
|
34
|
-
- `last_interaction_period`: Filter by interaction timeframe
|
|
35
|
-
- `is_follower`: Filter by follower status
|
|
36
|
-
- **Response Format**: Identical to GET method (`UserListResponse`)
|
|
37
|
-
- **Error Handling**: Same comprehensive error handling as GET method
|
|
38
|
-
|
|
39
|
-
#### Use Cases for POST Method
|
|
40
|
-
- **Large Parameter Sets**: Better handling of complex filter combinations
|
|
41
|
-
- **Request Body Preference**: When POST body is preferred over URL parameters
|
|
42
|
-
- **API Consistency**: Matching backend API patterns that expect POST
|
|
43
|
-
- **Future Extensibility**: Easier to extend with additional body parameters
|
|
44
|
-
|
|
45
|
-
### Usage Examples
|
|
46
|
-
|
|
47
|
-
#### Basic POST Method Usage
|
|
48
|
-
```typescript
|
|
49
|
-
import { ZaloSDK } from "@warriorteam/redai-zalo-sdk";
|
|
50
|
-
|
|
51
|
-
const zalo = new ZaloSDK({
|
|
52
|
-
appId: "your-app-id",
|
|
53
|
-
appSecret: "your-app-secret"
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// POST method for user list
|
|
57
|
-
const result = await zalo.user.postUserList(accessToken, {
|
|
58
|
-
offset: 0,
|
|
59
|
-
count: 20,
|
|
60
|
-
tag_name: "VIP_CUSTOMER",
|
|
61
|
-
is_follower: true
|
|
62
|
-
});
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
#### Comparing GET vs POST Methods
|
|
66
|
-
```typescript
|
|
67
|
-
// GET method (existing)
|
|
68
|
-
const getResult = await zalo.user.getUserList(accessToken, request);
|
|
69
|
-
|
|
70
|
-
// POST method (new)
|
|
71
|
-
const postResult = await zalo.user.postUserList(accessToken, request);
|
|
72
|
-
|
|
73
|
-
// Results are identical
|
|
74
|
-
console.log(getResult.total === postResult.total); // true
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Files Added/Modified
|
|
78
|
-
|
|
79
|
-
#### New Files
|
|
80
|
-
- `examples/user-list-post-example.ts` - Comprehensive POST method examples
|
|
81
|
-
|
|
82
|
-
#### Modified Files
|
|
83
|
-
- `src/services/user.service.ts` - Added `postUserList()` method and `postList` endpoint
|
|
84
|
-
|
|
85
|
-
### Breaking Changes
|
|
86
|
-
None. This release maintains full backward compatibility.
|
|
87
|
-
|
|
88
|
-
### Migration Guide
|
|
89
|
-
No migration required. The new `postUserList()` method is an additional option alongside the existing `getUserList()` method.
|
|
90
|
-
|
|
91
|
-
Both methods provide identical functionality:
|
|
92
|
-
- Use `getUserList()` for GET-based requests (existing behavior)
|
|
93
|
-
- Use `postUserList()` for POST-based requests (new option)
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## [1.5.0] - 2025-01-09
|
|
98
|
-
|
|
99
|
-
### Added
|
|
100
|
-
|
|
101
|
-
#### 🆕 OA Quality Information API
|
|
102
|
-
- **New Method**: `getOAQuality()` in ZNSService for retrieving OA ZNS sending quality information
|
|
103
|
-
- **Quality Metrics**: Support for current (48-hour) and 7-day quality assessment periods
|
|
104
|
-
- **Quality Levels**: HIGH, MEDIUM, LOW, UNDEFINED quality level indicators
|
|
105
|
-
- **Type Safety**: New `ZNSOAQualityInfo` interface for comprehensive type support
|
|
106
|
-
|
|
107
|
-
#### 🔧 Enhanced URL Encoding
|
|
108
|
-
- **Improved Encoding**: Added `encodeURIComponent` for JSON data in UserService API calls
|
|
109
|
-
- **Better Compatibility**: Enhanced URL parameter handling for special characters
|
|
110
|
-
- **API Reliability**: Improved data transmission reliability for complex JSON structures
|
|
111
|
-
|
|
112
|
-
### Technical Details
|
|
113
|
-
|
|
114
|
-
#### OA Quality Information Features
|
|
115
|
-
- **Real-time Quality**: Get current OA ZNS sending quality (48-hour window)
|
|
116
|
-
- **Historical Quality**: Get 7-day quality assessment for trend analysis
|
|
117
|
-
- **Quality Indicators**:
|
|
118
|
-
- `HIGH`: Excellent sending quality
|
|
119
|
-
- `MEDIUM`: Average sending quality
|
|
120
|
-
- `LOW`: Poor sending quality
|
|
121
|
-
- `UNDEFINED`: Quality not determined (no ZNS sent in assessment period)
|
|
122
|
-
|
|
123
|
-
#### URL Encoding Improvements
|
|
124
|
-
- **JSON Parameter Encoding**: Proper encoding of JSON data in URL parameters
|
|
125
|
-
- **Special Character Support**: Enhanced handling of special characters in API requests
|
|
126
|
-
- **Cross-platform Compatibility**: Improved compatibility across different environments
|
|
127
|
-
|
|
128
|
-
### Usage Examples
|
|
129
|
-
|
|
130
|
-
#### OA Quality Information
|
|
131
|
-
```typescript
|
|
132
|
-
import { ZaloSDK } from "@warriorteam/redai-zalo-sdk";
|
|
133
|
-
|
|
134
|
-
const zalo = new ZaloSDK({
|
|
135
|
-
appId: "your-app-id",
|
|
136
|
-
appSecret: "your-app-secret"
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// Get OA quality information
|
|
140
|
-
const qualityInfo = await zalo.zns.getOAQuality(accessToken);
|
|
141
|
-
console.log('Current Quality:', qualityInfo.data.oaCurrentQuality);
|
|
142
|
-
console.log('7-day Quality:', qualityInfo.data.oa7dayQuality);
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Files Modified
|
|
146
|
-
- `src/services/zns.service.ts` - Added getOAQuality() method
|
|
147
|
-
- `src/types/zns.ts` - Added ZNSOAQualityInfo interface, updated quality types
|
|
148
|
-
- `src/services/user.service.ts` - Enhanced URL encoding with encodeURIComponent
|
|
149
|
-
|
|
150
|
-
### Breaking Changes
|
|
151
|
-
None. This release maintains full backward compatibility.
|
|
152
|
-
|
|
153
|
-
### Migration Guide
|
|
154
|
-
No migration required. All existing code will continue to work unchanged.
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## [1.2.0] - 2025-01-08
|
|
159
|
-
|
|
160
|
-
### Added
|
|
161
|
-
|
|
162
|
-
#### 🆕 ConsultationService - Customer Support Messaging
|
|
163
|
-
- **New Service**: `ConsultationService` for sending customer support messages within 48-hour interaction window
|
|
164
|
-
- **Text Messages**: Send consultation text messages with automatic validation (max 2000 characters)
|
|
165
|
-
- **Image Messages**: Send consultation images for visual support and guides
|
|
166
|
-
- **File Messages**: Send consultation file attachments (manuals, guides, documents)
|
|
167
|
-
- **Sticker Messages**: Send consultation sticker messages for friendly interactions
|
|
168
|
-
- **General Messages**: Send any type of consultation message with unified interface
|
|
169
|
-
|
|
170
|
-
#### 📚 Documentation & Examples
|
|
171
|
-
- **Comprehensive Guide**: New `docs/CONSULTATION_SERVICE.md` with detailed usage instructions
|
|
172
|
-
- **Practical Examples**: New `examples/consultation-service-example.ts` with 6 real-world scenarios
|
|
173
|
-
- **Smart Customer Support**: Example implementation of intelligent customer support bot
|
|
174
|
-
- **Webhook Integration**: Complete webhook integration examples for consultation service
|
|
175
|
-
- **Error Handling**: Detailed error handling and retry mechanism examples
|
|
176
|
-
|
|
177
|
-
#### 🔧 SDK Integration
|
|
178
|
-
- **Quick Access**: Available via `zalo.consultation` property
|
|
179
|
-
- **Quick Methods**: Added `zalo.sendConsultationText()` and `zalo.sendConsultationImage()` convenience methods
|
|
180
|
-
- **Type Safety**: Full TypeScript support with comprehensive type definitions
|
|
181
|
-
- **Error Handling**: Enhanced error handling with `ZaloSDKError` for consultation-specific errors
|
|
182
|
-
|
|
183
|
-
#### 📖 Documentation Updates
|
|
184
|
-
- **README.md**: Updated with ConsultationService examples and documentation links
|
|
185
|
-
- **SERVICES_ADDED.md**: Added detailed ConsultationService documentation
|
|
186
|
-
- **Keywords**: Enhanced package keywords for better discoverability
|
|
187
|
-
|
|
188
|
-
### Technical Details
|
|
189
|
-
|
|
190
|
-
#### Consultation Service Features
|
|
191
|
-
- **48-Hour Window**: Enforces Zalo's 48-hour interaction window for consultation messages
|
|
192
|
-
- **Content Validation**: Automatic validation of message content and format
|
|
193
|
-
- **Quota Management**: Built-in quota tracking and management
|
|
194
|
-
- **Anti-Spam**: Follows Zalo's anti-spam guidelines and best practices
|
|
195
|
-
- **Retry Logic**: Built-in retry mechanism for failed requests
|
|
196
|
-
|
|
197
|
-
#### Usage Conditions
|
|
198
|
-
- Messages must be sent within 48 hours of last user interaction
|
|
199
|
-
- Content must be consultation/support related (no direct advertising)
|
|
200
|
-
- User must have followed the OA and not blocked it
|
|
201
|
-
- No daily limit but must follow anti-spam guidelines
|
|
202
|
-
|
|
203
|
-
#### Integration Points
|
|
204
|
-
- Seamless integration with existing webhook system
|
|
205
|
-
- Compatible with all existing SDK features
|
|
206
|
-
- Follows established SDK patterns and conventions
|
|
207
|
-
- Full backward compatibility maintained
|
|
208
|
-
|
|
209
|
-
### Examples Added
|
|
210
|
-
|
|
211
|
-
1. **Basic Consultation**: Simple text message consultation
|
|
212
|
-
2. **Image Support**: Sending images for visual guidance
|
|
213
|
-
3. **File Attachments**: Sending documents and manuals
|
|
214
|
-
4. **Smart Customer Support**: AI-powered customer support bot
|
|
215
|
-
5. **Retry Mechanism**: Robust error handling and retry logic
|
|
216
|
-
6. **Webhook Integration**: Complete webhook event handling
|
|
217
|
-
|
|
218
|
-
### Files Added/Modified
|
|
219
|
-
|
|
220
|
-
#### New Files
|
|
221
|
-
- `src/services/consultation.service.ts` - Main ConsultationService implementation
|
|
222
|
-
- `docs/CONSULTATION_SERVICE.md` - Comprehensive documentation
|
|
223
|
-
- `examples/consultation-service-example.ts` - Practical examples
|
|
224
|
-
- `CHANGELOG.md` - This changelog file
|
|
225
|
-
|
|
226
|
-
#### Modified Files
|
|
227
|
-
- `README.md` - Added ConsultationService documentation and examples
|
|
228
|
-
- `SERVICES_ADDED.md` - Added ConsultationService details
|
|
229
|
-
- `package.json` - Updated version, description, keywords, and scripts
|
|
230
|
-
- `src/index.ts` - Export ConsultationService types and classes
|
|
231
|
-
- `src/zalo-sdk.ts` - Integrated ConsultationService into main SDK
|
|
232
|
-
|
|
233
|
-
### Breaking Changes
|
|
234
|
-
None. This release maintains full backward compatibility.
|
|
235
|
-
|
|
236
|
-
### Migration Guide
|
|
237
|
-
No migration required. All existing code will continue to work unchanged.
|
|
238
|
-
|
|
239
|
-
To use the new ConsultationService:
|
|
240
|
-
|
|
241
|
-
```typescript
|
|
242
|
-
import { ZaloSDK } from "@warriorteam/redai-zalo-sdk";
|
|
243
|
-
|
|
244
|
-
const zalo = new ZaloSDK({
|
|
245
|
-
appId: "your-app-id",
|
|
246
|
-
appSecret: "your-app-secret"
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
// Use consultation service
|
|
250
|
-
await zalo.consultation.sendTextMessage(
|
|
251
|
-
accessToken,
|
|
252
|
-
{ user_id: "user-id" },
|
|
253
|
-
{ type: "text", text: "How can I help you?" }
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
// Or use quick methods
|
|
257
|
-
await zalo.sendConsultationText(accessToken, "user-id", "Hello!");
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## [1.1.1] - 2024-12-XX
|
|
263
|
-
|
|
264
|
-
### Fixed
|
|
265
|
-
- Bug fixes and stability improvements
|
|
266
|
-
- Enhanced error handling
|
|
267
|
-
- Documentation updates
|
|
268
|
-
|
|
269
|
-
### Added
|
|
270
|
-
- Additional webhook event types
|
|
271
|
-
- Improved TypeScript definitions
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## [1.1.0] - 2024-11-XX
|
|
276
|
-
|
|
277
|
-
### Added
|
|
278
|
-
- Group Management Service
|
|
279
|
-
- Article Management Service
|
|
280
|
-
- Video Upload Service
|
|
281
|
-
- Enhanced webhook handling
|
|
282
|
-
- Comprehensive documentation
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## [1.0.0] - 2024-10-XX
|
|
287
|
-
|
|
288
|
-
### Added
|
|
289
|
-
- Initial release
|
|
290
|
-
- Official Account API support
|
|
291
|
-
- ZNS (Zalo Notification Service) support
|
|
292
|
-
- Social API support
|
|
293
|
-
- Authentication flow
|
|
294
|
-
- Basic messaging capabilities
|
|
295
|
-
- TypeScript support
|
|
296
|
-
- Comprehensive error handling
|
|
297
|
-
|
|
298
|
-
### Features
|
|
299
|
-
- OAuth 2.0 authentication
|
|
300
|
-
- Message sending (text, image, file, sticker)
|
|
301
|
-
- User management
|
|
302
|
-
- Template management
|
|
303
|
-
- Quota monitoring
|
|
304
|
-
- Webhook event handling
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.6.0] - 2025-01-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### 🆕 POST Method for User List Retrieval
|
|
13
|
+
- **New Method**: `postUserList()` in UserService for POST-based user list retrieval
|
|
14
|
+
- **Same Endpoint**: Uses identical URL as `getUserList()` but with POST method
|
|
15
|
+
- **Request Body**: Sends data via request body instead of URL parameters
|
|
16
|
+
- **Full Feature Parity**: Supports all same parameters as GET method
|
|
17
|
+
- **Type Safety**: Same TypeScript interfaces and response types
|
|
18
|
+
|
|
19
|
+
#### 📚 Enhanced Documentation & Examples
|
|
20
|
+
- **Comprehensive Example**: New `examples/user-list-post-example.ts` with detailed usage scenarios
|
|
21
|
+
- **Method Comparison**: Examples comparing GET vs POST approaches
|
|
22
|
+
- **Pagination Support**: Complete pagination examples using POST method
|
|
23
|
+
- **Filter Demonstrations**: Examples with tags, followers, and interaction periods
|
|
24
|
+
|
|
25
|
+
### Technical Details
|
|
26
|
+
|
|
27
|
+
#### POST Method Features
|
|
28
|
+
- **Endpoint**: `https://openapi.zalo.me/v3.0/oa/user/getlist` (same as GET)
|
|
29
|
+
- **Method**: POST with JSON body data
|
|
30
|
+
- **Parameters Support**:
|
|
31
|
+
- `offset`: Starting position for pagination
|
|
32
|
+
- `count`: Number of users to retrieve (max 50)
|
|
33
|
+
- `tag_name`: Filter by specific tag
|
|
34
|
+
- `last_interaction_period`: Filter by interaction timeframe
|
|
35
|
+
- `is_follower`: Filter by follower status
|
|
36
|
+
- **Response Format**: Identical to GET method (`UserListResponse`)
|
|
37
|
+
- **Error Handling**: Same comprehensive error handling as GET method
|
|
38
|
+
|
|
39
|
+
#### Use Cases for POST Method
|
|
40
|
+
- **Large Parameter Sets**: Better handling of complex filter combinations
|
|
41
|
+
- **Request Body Preference**: When POST body is preferred over URL parameters
|
|
42
|
+
- **API Consistency**: Matching backend API patterns that expect POST
|
|
43
|
+
- **Future Extensibility**: Easier to extend with additional body parameters
|
|
44
|
+
|
|
45
|
+
### Usage Examples
|
|
46
|
+
|
|
47
|
+
#### Basic POST Method Usage
|
|
48
|
+
```typescript
|
|
49
|
+
import { ZaloSDK } from "@warriorteam/redai-zalo-sdk";
|
|
50
|
+
|
|
51
|
+
const zalo = new ZaloSDK({
|
|
52
|
+
appId: "your-app-id",
|
|
53
|
+
appSecret: "your-app-secret"
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// POST method for user list
|
|
57
|
+
const result = await zalo.user.postUserList(accessToken, {
|
|
58
|
+
offset: 0,
|
|
59
|
+
count: 20,
|
|
60
|
+
tag_name: "VIP_CUSTOMER",
|
|
61
|
+
is_follower: true
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Comparing GET vs POST Methods
|
|
66
|
+
```typescript
|
|
67
|
+
// GET method (existing)
|
|
68
|
+
const getResult = await zalo.user.getUserList(accessToken, request);
|
|
69
|
+
|
|
70
|
+
// POST method (new)
|
|
71
|
+
const postResult = await zalo.user.postUserList(accessToken, request);
|
|
72
|
+
|
|
73
|
+
// Results are identical
|
|
74
|
+
console.log(getResult.total === postResult.total); // true
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Files Added/Modified
|
|
78
|
+
|
|
79
|
+
#### New Files
|
|
80
|
+
- `examples/user-list-post-example.ts` - Comprehensive POST method examples
|
|
81
|
+
|
|
82
|
+
#### Modified Files
|
|
83
|
+
- `src/services/user.service.ts` - Added `postUserList()` method and `postList` endpoint
|
|
84
|
+
|
|
85
|
+
### Breaking Changes
|
|
86
|
+
None. This release maintains full backward compatibility.
|
|
87
|
+
|
|
88
|
+
### Migration Guide
|
|
89
|
+
No migration required. The new `postUserList()` method is an additional option alongside the existing `getUserList()` method.
|
|
90
|
+
|
|
91
|
+
Both methods provide identical functionality:
|
|
92
|
+
- Use `getUserList()` for GET-based requests (existing behavior)
|
|
93
|
+
- Use `postUserList()` for POST-based requests (new option)
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## [1.5.0] - 2025-01-09
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
|
|
101
|
+
#### 🆕 OA Quality Information API
|
|
102
|
+
- **New Method**: `getOAQuality()` in ZNSService for retrieving OA ZNS sending quality information
|
|
103
|
+
- **Quality Metrics**: Support for current (48-hour) and 7-day quality assessment periods
|
|
104
|
+
- **Quality Levels**: HIGH, MEDIUM, LOW, UNDEFINED quality level indicators
|
|
105
|
+
- **Type Safety**: New `ZNSOAQualityInfo` interface for comprehensive type support
|
|
106
|
+
|
|
107
|
+
#### 🔧 Enhanced URL Encoding
|
|
108
|
+
- **Improved Encoding**: Added `encodeURIComponent` for JSON data in UserService API calls
|
|
109
|
+
- **Better Compatibility**: Enhanced URL parameter handling for special characters
|
|
110
|
+
- **API Reliability**: Improved data transmission reliability for complex JSON structures
|
|
111
|
+
|
|
112
|
+
### Technical Details
|
|
113
|
+
|
|
114
|
+
#### OA Quality Information Features
|
|
115
|
+
- **Real-time Quality**: Get current OA ZNS sending quality (48-hour window)
|
|
116
|
+
- **Historical Quality**: Get 7-day quality assessment for trend analysis
|
|
117
|
+
- **Quality Indicators**:
|
|
118
|
+
- `HIGH`: Excellent sending quality
|
|
119
|
+
- `MEDIUM`: Average sending quality
|
|
120
|
+
- `LOW`: Poor sending quality
|
|
121
|
+
- `UNDEFINED`: Quality not determined (no ZNS sent in assessment period)
|
|
122
|
+
|
|
123
|
+
#### URL Encoding Improvements
|
|
124
|
+
- **JSON Parameter Encoding**: Proper encoding of JSON data in URL parameters
|
|
125
|
+
- **Special Character Support**: Enhanced handling of special characters in API requests
|
|
126
|
+
- **Cross-platform Compatibility**: Improved compatibility across different environments
|
|
127
|
+
|
|
128
|
+
### Usage Examples
|
|
129
|
+
|
|
130
|
+
#### OA Quality Information
|
|
131
|
+
```typescript
|
|
132
|
+
import { ZaloSDK } from "@warriorteam/redai-zalo-sdk";
|
|
133
|
+
|
|
134
|
+
const zalo = new ZaloSDK({
|
|
135
|
+
appId: "your-app-id",
|
|
136
|
+
appSecret: "your-app-secret"
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Get OA quality information
|
|
140
|
+
const qualityInfo = await zalo.zns.getOAQuality(accessToken);
|
|
141
|
+
console.log('Current Quality:', qualityInfo.data.oaCurrentQuality);
|
|
142
|
+
console.log('7-day Quality:', qualityInfo.data.oa7dayQuality);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Files Modified
|
|
146
|
+
- `src/services/zns.service.ts` - Added getOAQuality() method
|
|
147
|
+
- `src/types/zns.ts` - Added ZNSOAQualityInfo interface, updated quality types
|
|
148
|
+
- `src/services/user.service.ts` - Enhanced URL encoding with encodeURIComponent
|
|
149
|
+
|
|
150
|
+
### Breaking Changes
|
|
151
|
+
None. This release maintains full backward compatibility.
|
|
152
|
+
|
|
153
|
+
### Migration Guide
|
|
154
|
+
No migration required. All existing code will continue to work unchanged.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## [1.2.0] - 2025-01-08
|
|
159
|
+
|
|
160
|
+
### Added
|
|
161
|
+
|
|
162
|
+
#### 🆕 ConsultationService - Customer Support Messaging
|
|
163
|
+
- **New Service**: `ConsultationService` for sending customer support messages within 48-hour interaction window
|
|
164
|
+
- **Text Messages**: Send consultation text messages with automatic validation (max 2000 characters)
|
|
165
|
+
- **Image Messages**: Send consultation images for visual support and guides
|
|
166
|
+
- **File Messages**: Send consultation file attachments (manuals, guides, documents)
|
|
167
|
+
- **Sticker Messages**: Send consultation sticker messages for friendly interactions
|
|
168
|
+
- **General Messages**: Send any type of consultation message with unified interface
|
|
169
|
+
|
|
170
|
+
#### 📚 Documentation & Examples
|
|
171
|
+
- **Comprehensive Guide**: New `docs/CONSULTATION_SERVICE.md` with detailed usage instructions
|
|
172
|
+
- **Practical Examples**: New `examples/consultation-service-example.ts` with 6 real-world scenarios
|
|
173
|
+
- **Smart Customer Support**: Example implementation of intelligent customer support bot
|
|
174
|
+
- **Webhook Integration**: Complete webhook integration examples for consultation service
|
|
175
|
+
- **Error Handling**: Detailed error handling and retry mechanism examples
|
|
176
|
+
|
|
177
|
+
#### 🔧 SDK Integration
|
|
178
|
+
- **Quick Access**: Available via `zalo.consultation` property
|
|
179
|
+
- **Quick Methods**: Added `zalo.sendConsultationText()` and `zalo.sendConsultationImage()` convenience methods
|
|
180
|
+
- **Type Safety**: Full TypeScript support with comprehensive type definitions
|
|
181
|
+
- **Error Handling**: Enhanced error handling with `ZaloSDKError` for consultation-specific errors
|
|
182
|
+
|
|
183
|
+
#### 📖 Documentation Updates
|
|
184
|
+
- **README.md**: Updated with ConsultationService examples and documentation links
|
|
185
|
+
- **SERVICES_ADDED.md**: Added detailed ConsultationService documentation
|
|
186
|
+
- **Keywords**: Enhanced package keywords for better discoverability
|
|
187
|
+
|
|
188
|
+
### Technical Details
|
|
189
|
+
|
|
190
|
+
#### Consultation Service Features
|
|
191
|
+
- **48-Hour Window**: Enforces Zalo's 48-hour interaction window for consultation messages
|
|
192
|
+
- **Content Validation**: Automatic validation of message content and format
|
|
193
|
+
- **Quota Management**: Built-in quota tracking and management
|
|
194
|
+
- **Anti-Spam**: Follows Zalo's anti-spam guidelines and best practices
|
|
195
|
+
- **Retry Logic**: Built-in retry mechanism for failed requests
|
|
196
|
+
|
|
197
|
+
#### Usage Conditions
|
|
198
|
+
- Messages must be sent within 48 hours of last user interaction
|
|
199
|
+
- Content must be consultation/support related (no direct advertising)
|
|
200
|
+
- User must have followed the OA and not blocked it
|
|
201
|
+
- No daily limit but must follow anti-spam guidelines
|
|
202
|
+
|
|
203
|
+
#### Integration Points
|
|
204
|
+
- Seamless integration with existing webhook system
|
|
205
|
+
- Compatible with all existing SDK features
|
|
206
|
+
- Follows established SDK patterns and conventions
|
|
207
|
+
- Full backward compatibility maintained
|
|
208
|
+
|
|
209
|
+
### Examples Added
|
|
210
|
+
|
|
211
|
+
1. **Basic Consultation**: Simple text message consultation
|
|
212
|
+
2. **Image Support**: Sending images for visual guidance
|
|
213
|
+
3. **File Attachments**: Sending documents and manuals
|
|
214
|
+
4. **Smart Customer Support**: AI-powered customer support bot
|
|
215
|
+
5. **Retry Mechanism**: Robust error handling and retry logic
|
|
216
|
+
6. **Webhook Integration**: Complete webhook event handling
|
|
217
|
+
|
|
218
|
+
### Files Added/Modified
|
|
219
|
+
|
|
220
|
+
#### New Files
|
|
221
|
+
- `src/services/consultation.service.ts` - Main ConsultationService implementation
|
|
222
|
+
- `docs/CONSULTATION_SERVICE.md` - Comprehensive documentation
|
|
223
|
+
- `examples/consultation-service-example.ts` - Practical examples
|
|
224
|
+
- `CHANGELOG.md` - This changelog file
|
|
225
|
+
|
|
226
|
+
#### Modified Files
|
|
227
|
+
- `README.md` - Added ConsultationService documentation and examples
|
|
228
|
+
- `SERVICES_ADDED.md` - Added ConsultationService details
|
|
229
|
+
- `package.json` - Updated version, description, keywords, and scripts
|
|
230
|
+
- `src/index.ts` - Export ConsultationService types and classes
|
|
231
|
+
- `src/zalo-sdk.ts` - Integrated ConsultationService into main SDK
|
|
232
|
+
|
|
233
|
+
### Breaking Changes
|
|
234
|
+
None. This release maintains full backward compatibility.
|
|
235
|
+
|
|
236
|
+
### Migration Guide
|
|
237
|
+
No migration required. All existing code will continue to work unchanged.
|
|
238
|
+
|
|
239
|
+
To use the new ConsultationService:
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
import { ZaloSDK } from "@warriorteam/redai-zalo-sdk";
|
|
243
|
+
|
|
244
|
+
const zalo = new ZaloSDK({
|
|
245
|
+
appId: "your-app-id",
|
|
246
|
+
appSecret: "your-app-secret"
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// Use consultation service
|
|
250
|
+
await zalo.consultation.sendTextMessage(
|
|
251
|
+
accessToken,
|
|
252
|
+
{ user_id: "user-id" },
|
|
253
|
+
{ type: "text", text: "How can I help you?" }
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
// Or use quick methods
|
|
257
|
+
await zalo.sendConsultationText(accessToken, "user-id", "Hello!");
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## [1.1.1] - 2024-12-XX
|
|
263
|
+
|
|
264
|
+
### Fixed
|
|
265
|
+
- Bug fixes and stability improvements
|
|
266
|
+
- Enhanced error handling
|
|
267
|
+
- Documentation updates
|
|
268
|
+
|
|
269
|
+
### Added
|
|
270
|
+
- Additional webhook event types
|
|
271
|
+
- Improved TypeScript definitions
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## [1.1.0] - 2024-11-XX
|
|
276
|
+
|
|
277
|
+
### Added
|
|
278
|
+
- Group Management Service
|
|
279
|
+
- Article Management Service
|
|
280
|
+
- Video Upload Service
|
|
281
|
+
- Enhanced webhook handling
|
|
282
|
+
- Comprehensive documentation
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## [1.0.0] - 2024-10-XX
|
|
287
|
+
|
|
288
|
+
### Added
|
|
289
|
+
- Initial release
|
|
290
|
+
- Official Account API support
|
|
291
|
+
- ZNS (Zalo Notification Service) support
|
|
292
|
+
- Social API support
|
|
293
|
+
- Authentication flow
|
|
294
|
+
- Basic messaging capabilities
|
|
295
|
+
- TypeScript support
|
|
296
|
+
- Comprehensive error handling
|
|
297
|
+
|
|
298
|
+
### Features
|
|
299
|
+
- OAuth 2.0 authentication
|
|
300
|
+
- Message sending (text, image, file, sticker)
|
|
301
|
+
- User management
|
|
302
|
+
- Template management
|
|
303
|
+
- Quota monitoring
|
|
304
|
+
- Webhook event handling
|