node-easywechat 2.7.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/BaseService/Jssdk/JssdkClient.js +5 -5
- package/dist/BaseService/Media/MediaClient.js +1 -1
- package/dist/Core/AES.d.ts +1 -1
- package/dist/Core/AES.js +4 -4
- package/dist/Core/BaseAccessToken.js +2 -2
- package/dist/Core/BaseApplication.js +4 -4
- package/dist/Core/BaseClient.js +2 -2
- package/dist/Core/Cache/FileCache.js +3 -3
- package/dist/Core/Encryptor.js +3 -3
- package/dist/Core/Http/Request.js +11 -11
- package/dist/Core/Http/StreamResponse.js +1 -1
- package/dist/Core/Messages/Media.js +2 -2
- package/dist/Core/Messages/Message.js +7 -9
- package/dist/Core/Mixins/HttpMixin.js +4 -4
- package/dist/Core/ServerGuard.d.ts +1 -0
- package/dist/Core/ServerGuard.js +8 -5
- package/dist/Core/Utils.js +18 -18
- package/dist/MicroMerchant/Application.js +1 -1
- package/dist/MicroMerchant/Base/MicroMerchantBase.js +6 -6
- package/dist/MicroMerchant/Certficates/CertficatesClient.js +1 -1
- package/dist/MicroMerchant/Core/BaseClient.js +8 -8
- package/dist/MicroMerchant/Media/MediaClient.js +1 -1
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.js +1 -1
- package/dist/MicroMerchant/Meterial/MeterialClient.js +4 -4
- package/dist/MicroMerchant/Withdraw/WithdrawClient.js +2 -2
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.js +3 -3
- package/dist/MiniProgram/AppCode/AppCodeClient.js +2 -2
- package/dist/MiniProgram/Application.d.ts +6 -0
- package/dist/MiniProgram/Application.js +15 -0
- package/dist/MiniProgram/Base/MiniProgramBase.js +1 -1
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.js +3 -3
- package/dist/MiniProgram/OpenData/OpenDataClient.js +2 -2
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.d.ts +10 -0
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.js +20 -0
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.js +1 -1
- package/dist/MiniProgram/ShortLink/ShortLinkClient.d.ts +11 -0
- package/dist/MiniProgram/ShortLink/ShortLinkClient.js +23 -0
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.js +5 -5
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.js +3 -3
- package/dist/MiniProgram/Union/UnionClient.d.ts +3 -0
- package/dist/MiniProgram/Union/UnionClient.js +9 -0
- package/dist/MiniProgram/UrlLink/UrlLinkClient.d.ts +9 -0
- package/dist/MiniProgram/UrlLink/UrlLinkClient.js +17 -0
- package/dist/OfficialAccount/Base/OfficialAccountBase.js +2 -2
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.js +2 -2
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.js +1 -1
- package/dist/OfficialAccount/Card/Client.js +1 -1
- package/dist/OfficialAccount/Card/JssdkClient.js +2 -2
- package/dist/OfficialAccount/Card/MemberCardClient.js +1 -1
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.js +2 -2
- package/dist/OfficialAccount/CustomerService/Messenger.js +1 -1
- package/dist/OfficialAccount/DataCube/DataCubeClient.js +1 -1
- package/dist/OfficialAccount/Material/MaterialClient.js +2 -2
- package/dist/OfficialAccount/OCR/OCRClient.js +1 -1
- package/dist/OfficialAccount/Semantic/SemanticClient.js +1 -1
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.js +4 -4
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.js +4 -4
- package/dist/OpenPlatform/Application.js +7 -7
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.js +1 -1
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.js +1 -1
- package/dist/Payment/Application.js +4 -4
- package/dist/Payment/Bill/BillClient.js +2 -2
- package/dist/Payment/Core/BaseClient.js +8 -8
- package/dist/Payment/Jssdk/JssdkClient.d.ts +12 -0
- package/dist/Payment/Jssdk/JssdkClient.js +41 -9
- package/dist/Payment/Merchant/MerchantClient.js +1 -1
- package/dist/Payment/Notify/Handler.js +5 -5
- package/dist/Payment/Notify/Refunded.js +1 -1
- package/dist/Payment/Notify/Scanned.js +2 -2
- package/dist/Payment/Order/OrderClient.js +1 -1
- package/dist/Payment/Redpack/RedpackClient.js +5 -5
- package/dist/Payment/Refund/RefundClient.js +3 -3
- package/dist/Payment/Sandbox/SandboxClient.js +1 -1
- package/dist/Payment/Transfer/TransferClient.js +1 -1
- package/dist/Work/Agent/AgentClient.js +1 -1
- package/dist/Work/Calendar/CalendarClient.js +1 -1
- package/dist/Work/Chat/ChatClient.js +1 -1
- package/dist/Work/Department/DepartmentClient.js +1 -1
- package/dist/Work/ExternalContact/Client.d.ts +191 -3
- package/dist/Work/ExternalContact/Client.js +228 -6
- package/dist/Work/ExternalContact/ContactWayClient.js +2 -2
- package/dist/Work/ExternalContact/MessageClient.d.ts +45 -0
- package/dist/Work/ExternalContact/MessageClient.js +90 -4
- package/dist/Work/ExternalContact/MessageTemplateClient.js +3 -3
- package/dist/Work/Jssdk/JssdkClient.js +3 -3
- package/dist/Work/Media/MediaClient.js +1 -1
- package/dist/Work/Message/Messenger.js +2 -2
- package/dist/Work/Schedule/ScheduleClient.js +1 -1
- package/dist/Work/User/UserClient.js +3 -3
- package/dist/index.js +1 -1
- package/node-easywechat.file_cache.easywechat.kernel.access_token.8a9684b45da7de42a06a70ba01a7005a.cache +1 -1
- package/node-easywechat.file_cache.easywechat.kernel.access_token.c3d06edaf326aad75d32f31348df787a.cache +1 -1
- package/package.json +11 -11
|
@@ -1,23 +1,211 @@
|
|
|
1
1
|
import BaseClient from '../../Core/BaseClient';
|
|
2
2
|
export default class ExternalContactClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取配置了客户联系功能的成员列表
|
|
5
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91554
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
3
8
|
getFollowUsers(): Promise<any>;
|
|
9
|
+
/**
|
|
10
|
+
* 获取外部联系人列表
|
|
11
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91555
|
|
12
|
+
* @param userId
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
4
15
|
list(userId: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* 获取外部联系人详情
|
|
18
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91556
|
|
19
|
+
* @param externalUserId
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
5
22
|
get(externalUserId: string): Promise<any>;
|
|
6
|
-
|
|
7
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 批量获取客户详情
|
|
25
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92994
|
|
26
|
+
* @param userIdList
|
|
27
|
+
* @param cursor
|
|
28
|
+
* @param limit
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
batchGet(userIdList: string[], cursor?: string, limit?: number): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* 批量获取外部联系人详情
|
|
34
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/93010
|
|
35
|
+
* @param userIdList
|
|
36
|
+
* @param cursor
|
|
37
|
+
* @param limit
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
batchGetByUser(userIdList: string[], cursor?: string, limit?: number): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* 修改客户备注信息
|
|
43
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92115
|
|
44
|
+
* @param data
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
8
47
|
remark(data: object): Promise<any>;
|
|
48
|
+
/**
|
|
49
|
+
* 获取离职成员的客户列表
|
|
50
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92124
|
|
51
|
+
* @param pageId
|
|
52
|
+
* @param pageSize
|
|
53
|
+
* @param cursor
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
9
56
|
getUnassigned(pageId?: number, pageSize?: number, cursor?: string): Promise<any>;
|
|
57
|
+
/**
|
|
58
|
+
* 离职成员的外部联系人再分配
|
|
59
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91564
|
|
60
|
+
* @param externalUserId
|
|
61
|
+
* @param handoverUserId
|
|
62
|
+
* @param takeoverUserId
|
|
63
|
+
* @param transferSuccessMessage
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
10
66
|
transfer(externalUserId: string, handoverUserId: string, takeoverUserId: string, transferSuccessMessage: string): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* 分配在职成员的客户
|
|
69
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92125
|
|
70
|
+
* @param externalUserId
|
|
71
|
+
* @param handoverUserId
|
|
72
|
+
* @param takeoverUserId
|
|
73
|
+
* @param transferSuccessMessage
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
11
76
|
transferCustomer(externalUserId: string, handoverUserId: string, takeoverUserId: string, transferSuccessMessage: string): Promise<any>;
|
|
77
|
+
/**
|
|
78
|
+
* 分配离职成员的客户
|
|
79
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/94081
|
|
80
|
+
* @param externalUserId
|
|
81
|
+
* @param handoverUserId
|
|
82
|
+
* @param takeoverUserId
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
12
85
|
resignedTransferCustomer(externalUserId: string, handoverUserId: string, takeoverUserId: string): Promise<any>;
|
|
86
|
+
/**
|
|
87
|
+
* 离职成员的群再分配
|
|
88
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92127
|
|
89
|
+
* @param chatIds
|
|
90
|
+
* @param newOwner
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
13
93
|
transferGroupChat(chatIds: string[], newOwner: string): Promise<any>;
|
|
94
|
+
/**
|
|
95
|
+
* 查询客户接替状态
|
|
96
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/94082
|
|
97
|
+
* @param handoverUserId
|
|
98
|
+
* @param takeoverUserId
|
|
99
|
+
* @param cursor
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
14
102
|
transferResult(handoverUserId: string, takeoverUserId: string, cursor?: string): Promise<any>;
|
|
103
|
+
/**
|
|
104
|
+
* 查询客户接替结果
|
|
105
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/93009
|
|
106
|
+
* @param externalUserId
|
|
107
|
+
* @param handoverUserId
|
|
108
|
+
* @param takeoverUserId
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
15
111
|
getTransferResult(externalUserId: string, handoverUserId: string, takeoverUserId: string): Promise<any>;
|
|
112
|
+
/**
|
|
113
|
+
* 获取客户群列表
|
|
114
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92120
|
|
115
|
+
* @param data
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
16
118
|
getGroupChats(data: object): Promise<any>;
|
|
17
|
-
|
|
119
|
+
/**
|
|
120
|
+
* 获取客户群详情
|
|
121
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92122
|
|
122
|
+
* @param chatId
|
|
123
|
+
* @param needName
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
getGroupChat(chatId: string, needName?: number): Promise<any>;
|
|
127
|
+
/**
|
|
128
|
+
* 获取企业标签库
|
|
129
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#获取企业标签库
|
|
130
|
+
* @param tagIds
|
|
131
|
+
* @param groupIds
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
18
134
|
getCorpTags(tagIds: string[], groupIds: string[]): Promise<any>;
|
|
135
|
+
/**
|
|
136
|
+
* 添加企业客户标签
|
|
137
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#添加企业客户标签
|
|
138
|
+
* @param data
|
|
139
|
+
* @returns
|
|
140
|
+
*/
|
|
19
141
|
addCorpTag(data: object): Promise<any>;
|
|
142
|
+
/**
|
|
143
|
+
* 编辑企业客户标签
|
|
144
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#编辑企业客户标签
|
|
145
|
+
* @param id
|
|
146
|
+
* @param name
|
|
147
|
+
* @param order
|
|
148
|
+
* @returns
|
|
149
|
+
*/
|
|
20
150
|
updateCorpTag(id: string, name?: string, order?: number): Promise<any>;
|
|
151
|
+
/**
|
|
152
|
+
* 删除企业客户标签
|
|
153
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#删除企业客户标签
|
|
154
|
+
* @param tagId
|
|
155
|
+
* @param groupId
|
|
156
|
+
* @returns
|
|
157
|
+
*/
|
|
21
158
|
deleteCorpTag(tagId: string[], groupId: string[]): Promise<any>;
|
|
159
|
+
/**
|
|
160
|
+
* 编辑客户企业标签
|
|
161
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92118
|
|
162
|
+
* @param data
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
22
165
|
markTags(data: object): Promise<any>;
|
|
166
|
+
/**
|
|
167
|
+
* 外部联系人unionid转换
|
|
168
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/93274
|
|
169
|
+
* @param unionid 微信客户的unionid
|
|
170
|
+
* @param openid 微信客户的openid
|
|
171
|
+
* @returns
|
|
172
|
+
*/
|
|
173
|
+
unionidToExternalUserid(unionid?: string, openid?: string): Promise<any>;
|
|
174
|
+
/**
|
|
175
|
+
* 代开发应用external_userid转换
|
|
176
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/95195
|
|
177
|
+
* @param unionid 微信客户的unionid
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
toServiceExternalUserid(externalUserid: string): Promise<any>;
|
|
181
|
+
/**
|
|
182
|
+
* 转换external_userid
|
|
183
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#%E8%BD%AC%E6%8D%A2external_userid
|
|
184
|
+
* @param externalUserIds
|
|
185
|
+
* @returns
|
|
186
|
+
*/
|
|
187
|
+
getNewExternalUserid(externalUserIds: string[]): Promise<any>;
|
|
188
|
+
/**
|
|
189
|
+
* 设置迁移完成
|
|
190
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#%E8%AE%BE%E7%BD%AE%E8%BF%81%E7%A7%BB%E5%AE%8C%E6%88%90
|
|
191
|
+
* @param corpid
|
|
192
|
+
* @returns
|
|
193
|
+
*/
|
|
194
|
+
finishExternalUseridMigration(corpid: string): Promise<any>;
|
|
195
|
+
/**
|
|
196
|
+
* unionid查询external_userid
|
|
197
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#4.2%20unionid%E6%9F%A5%E8%AF%A2external_userid
|
|
198
|
+
* @param unionid
|
|
199
|
+
* @param openid
|
|
200
|
+
* @param corpid
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
unionidToexternalUserid3rd(unionid: string, openid: string, corpid?: string): Promise<any>;
|
|
204
|
+
/**
|
|
205
|
+
* 客户群opengid转换
|
|
206
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/94822
|
|
207
|
+
* @param opengid
|
|
208
|
+
* @returns
|
|
209
|
+
*/
|
|
210
|
+
opengidToChatid(opengid: string): Promise<any>;
|
|
23
211
|
}
|
|
@@ -5,43 +5,105 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
7
|
class ExternalContactClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取配置了客户联系功能的成员列表
|
|
10
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91554
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
8
13
|
getFollowUsers() {
|
|
9
14
|
return this.httpGet('cgi-bin/externalcontact/get_follow_user_list');
|
|
10
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* 获取外部联系人列表
|
|
18
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91555
|
|
19
|
+
* @param userId
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
11
22
|
list(userId) {
|
|
12
23
|
return this.httpGet('cgi-bin/externalcontact/list', {
|
|
13
24
|
userid: userId,
|
|
14
25
|
});
|
|
15
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* 获取外部联系人详情
|
|
29
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91556
|
|
30
|
+
* @param externalUserId
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
16
33
|
get(externalUserId) {
|
|
17
34
|
return this.httpGet('cgi-bin/externalcontact/get', {
|
|
18
35
|
external_userid: externalUserId,
|
|
19
36
|
});
|
|
20
37
|
}
|
|
21
|
-
|
|
38
|
+
/**
|
|
39
|
+
* 批量获取客户详情
|
|
40
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92994
|
|
41
|
+
* @param userIdList
|
|
42
|
+
* @param cursor
|
|
43
|
+
* @param limit
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
batchGet(userIdList, cursor = '', limit = 1) {
|
|
22
47
|
return this.httpPostJson('cgi-bin/externalcontact/batch/get_by_user', {
|
|
23
|
-
|
|
48
|
+
userid_list: userIdList,
|
|
24
49
|
cursor,
|
|
25
50
|
limit,
|
|
26
51
|
});
|
|
27
52
|
}
|
|
28
|
-
|
|
53
|
+
/**
|
|
54
|
+
* 批量获取外部联系人详情
|
|
55
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/93010
|
|
56
|
+
* @param userIdList
|
|
57
|
+
* @param cursor
|
|
58
|
+
* @param limit
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
batchGetByUser(userIdList, cursor = '', limit = 1) {
|
|
29
62
|
return this.httpPostJson('cgi-bin/externalcontact/batch/get_by_user', {
|
|
30
|
-
|
|
63
|
+
userid_list: userIdList,
|
|
31
64
|
cursor,
|
|
32
65
|
limit,
|
|
33
66
|
});
|
|
34
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* 修改客户备注信息
|
|
70
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92115
|
|
71
|
+
* @param data
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
35
74
|
remark(data) {
|
|
36
75
|
return this.httpPostJson('cgi-bin/externalcontact/remark', data);
|
|
37
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* 获取离职成员的客户列表
|
|
79
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92124
|
|
80
|
+
* @param pageId
|
|
81
|
+
* @param pageSize
|
|
82
|
+
* @param cursor
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
38
85
|
getUnassigned(pageId = 0, pageSize = 1000, cursor = null) {
|
|
39
|
-
|
|
86
|
+
let params = {
|
|
40
87
|
page_id: pageId,
|
|
41
88
|
page_size: pageSize,
|
|
42
89
|
cursor,
|
|
90
|
+
};
|
|
91
|
+
Object.keys(params).map(key => {
|
|
92
|
+
if (params[key] === null || params[key] === undefined) {
|
|
93
|
+
delete params[key];
|
|
94
|
+
}
|
|
43
95
|
});
|
|
96
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_unassigned_list', params);
|
|
44
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* 离职成员的外部联系人再分配
|
|
100
|
+
* @see https://work.weixin.qq.com/api/doc#90000/90135/91564
|
|
101
|
+
* @param externalUserId
|
|
102
|
+
* @param handoverUserId
|
|
103
|
+
* @param takeoverUserId
|
|
104
|
+
* @param transferSuccessMessage
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
45
107
|
transfer(externalUserId, handoverUserId, takeoverUserId, transferSuccessMessage) {
|
|
46
108
|
return this.httpPostJson('cgi-bin/externalcontact/transfer', {
|
|
47
109
|
external_userid: externalUserId,
|
|
@@ -50,6 +112,15 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
50
112
|
transfer_success_msg: transferSuccessMessage,
|
|
51
113
|
});
|
|
52
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* 分配在职成员的客户
|
|
117
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92125
|
|
118
|
+
* @param externalUserId
|
|
119
|
+
* @param handoverUserId
|
|
120
|
+
* @param takeoverUserId
|
|
121
|
+
* @param transferSuccessMessage
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
53
124
|
transferCustomer(externalUserId, handoverUserId, takeoverUserId, transferSuccessMessage) {
|
|
54
125
|
return this.httpPostJson('cgi-bin/externalcontact/transfer_customer', {
|
|
55
126
|
external_userid: externalUserId,
|
|
@@ -58,6 +129,14 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
58
129
|
transfer_success_msg: transferSuccessMessage,
|
|
59
130
|
});
|
|
60
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* 分配离职成员的客户
|
|
134
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/94081
|
|
135
|
+
* @param externalUserId
|
|
136
|
+
* @param handoverUserId
|
|
137
|
+
* @param takeoverUserId
|
|
138
|
+
* @returns
|
|
139
|
+
*/
|
|
61
140
|
resignedTransferCustomer(externalUserId, handoverUserId, takeoverUserId) {
|
|
62
141
|
return this.httpPostJson('cgi-bin/externalcontact/resigned/transfer_customer', {
|
|
63
142
|
external_userid: externalUserId,
|
|
@@ -65,12 +144,27 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
65
144
|
takeover_userid: takeoverUserId,
|
|
66
145
|
});
|
|
67
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* 离职成员的群再分配
|
|
149
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92127
|
|
150
|
+
* @param chatIds
|
|
151
|
+
* @param newOwner
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
68
154
|
transferGroupChat(chatIds, newOwner) {
|
|
69
155
|
return this.httpPostJson('cgi-bin/externalcontact/groupchat/transfer', {
|
|
70
156
|
chat_id_list: chatIds,
|
|
71
157
|
new_owner: newOwner,
|
|
72
158
|
});
|
|
73
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* 查询客户接替状态
|
|
162
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/94082
|
|
163
|
+
* @param handoverUserId
|
|
164
|
+
* @param takeoverUserId
|
|
165
|
+
* @param cursor
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
74
168
|
transferResult(handoverUserId, takeoverUserId, cursor = null) {
|
|
75
169
|
return this.httpPostJson('cgi-bin/externalcontact/resigned/transfer_result', {
|
|
76
170
|
handover_userid: handoverUserId,
|
|
@@ -78,6 +172,14 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
78
172
|
cursor,
|
|
79
173
|
});
|
|
80
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* 查询客户接替结果
|
|
177
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/93009
|
|
178
|
+
* @param externalUserId
|
|
179
|
+
* @param handoverUserId
|
|
180
|
+
* @param takeoverUserId
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
81
183
|
getTransferResult(externalUserId, handoverUserId, takeoverUserId) {
|
|
82
184
|
return this.httpPostJson('cgi-bin/externalcontact/get_transfer_result', {
|
|
83
185
|
external_userid: externalUserId,
|
|
@@ -85,23 +187,58 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
85
187
|
takeover_userid: takeoverUserId,
|
|
86
188
|
});
|
|
87
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* 获取客户群列表
|
|
192
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92120
|
|
193
|
+
* @param data
|
|
194
|
+
* @returns
|
|
195
|
+
*/
|
|
88
196
|
getGroupChats(data) {
|
|
89
197
|
return this.httpPostJson('cgi-bin/externalcontact/groupchat/list', data);
|
|
90
198
|
}
|
|
91
|
-
|
|
199
|
+
/**
|
|
200
|
+
* 获取客户群详情
|
|
201
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92122
|
|
202
|
+
* @param chatId
|
|
203
|
+
* @param needName
|
|
204
|
+
* @returns
|
|
205
|
+
*/
|
|
206
|
+
getGroupChat(chatId, needName = 0) {
|
|
92
207
|
return this.httpPostJson('cgi-bin/externalcontact/groupchat/get', {
|
|
93
208
|
chat_id: chatId,
|
|
209
|
+
need_name: needName,
|
|
94
210
|
});
|
|
95
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* 获取企业标签库
|
|
214
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#获取企业标签库
|
|
215
|
+
* @param tagIds
|
|
216
|
+
* @param groupIds
|
|
217
|
+
* @returns
|
|
218
|
+
*/
|
|
96
219
|
getCorpTags(tagIds, groupIds) {
|
|
97
220
|
return this.httpPostJson('cgi-bin/externalcontact/get_corp_tag_list', {
|
|
98
221
|
tag_id: tagIds,
|
|
99
222
|
group_id: groupIds,
|
|
100
223
|
});
|
|
101
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* 添加企业客户标签
|
|
227
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#添加企业客户标签
|
|
228
|
+
* @param data
|
|
229
|
+
* @returns
|
|
230
|
+
*/
|
|
102
231
|
addCorpTag(data) {
|
|
103
232
|
return this.httpPostJson('cgi-bin/externalcontact/add_corp_tag', data);
|
|
104
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* 编辑企业客户标签
|
|
236
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#编辑企业客户标签
|
|
237
|
+
* @param id
|
|
238
|
+
* @param name
|
|
239
|
+
* @param order
|
|
240
|
+
* @returns
|
|
241
|
+
*/
|
|
105
242
|
updateCorpTag(id, name = null, order = null) {
|
|
106
243
|
let params = {
|
|
107
244
|
id,
|
|
@@ -114,14 +251,99 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
114
251
|
}
|
|
115
252
|
return this.httpPostJson('cgi-bin/externalcontact/edit_corp_tag', params);
|
|
116
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* 删除企业客户标签
|
|
256
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92117#删除企业客户标签
|
|
257
|
+
* @param tagId
|
|
258
|
+
* @param groupId
|
|
259
|
+
* @returns
|
|
260
|
+
*/
|
|
117
261
|
deleteCorpTag(tagId, groupId) {
|
|
118
262
|
return this.httpPostJson('cgi-bin/externalcontact/del_corp_tag', {
|
|
119
263
|
tag_id: tagId,
|
|
120
264
|
group_id: groupId,
|
|
121
265
|
});
|
|
122
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* 编辑客户企业标签
|
|
269
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92118
|
|
270
|
+
* @param data
|
|
271
|
+
* @returns
|
|
272
|
+
*/
|
|
123
273
|
markTags(data) {
|
|
124
274
|
return this.httpPostJson('cgi-bin/externalcontact/mark_tag', data);
|
|
125
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* 外部联系人unionid转换
|
|
278
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/93274
|
|
279
|
+
* @param unionid 微信客户的unionid
|
|
280
|
+
* @param openid 微信客户的openid
|
|
281
|
+
* @returns
|
|
282
|
+
*/
|
|
283
|
+
unionidToExternalUserid(unionid = null, openid = null) {
|
|
284
|
+
return this.httpPostJson('cgi-bin/externalcontact/unionid_to_external_userid', {
|
|
285
|
+
unionid,
|
|
286
|
+
openid,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* 代开发应用external_userid转换
|
|
291
|
+
* @see https://work.weixin.qq.com/api/doc/90001/90143/95195
|
|
292
|
+
* @param unionid 微信客户的unionid
|
|
293
|
+
* @returns
|
|
294
|
+
*/
|
|
295
|
+
toServiceExternalUserid(externalUserid) {
|
|
296
|
+
return this.httpPostJson('cgi-bin/externalcontact/to_service_external_userid', {
|
|
297
|
+
external_userid: externalUserid,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* 转换external_userid
|
|
302
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#%E8%BD%AC%E6%8D%A2external_userid
|
|
303
|
+
* @param externalUserIds
|
|
304
|
+
* @returns
|
|
305
|
+
*/
|
|
306
|
+
getNewExternalUserid(externalUserIds) {
|
|
307
|
+
return this.httpPostJson('cgi-bin/externalcontact/get_new_external_userid', {
|
|
308
|
+
external_userid_list: externalUserIds,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* 设置迁移完成
|
|
313
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#%E8%AE%BE%E7%BD%AE%E8%BF%81%E7%A7%BB%E5%AE%8C%E6%88%90
|
|
314
|
+
* @param corpid
|
|
315
|
+
* @returns
|
|
316
|
+
*/
|
|
317
|
+
finishExternalUseridMigration(corpid) {
|
|
318
|
+
return this.httpPostJson('cgi-bin/externalcontact/finish_external_userid_migration', {
|
|
319
|
+
corpid,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* unionid查询external_userid
|
|
324
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#4.2%20unionid%E6%9F%A5%E8%AF%A2external_userid
|
|
325
|
+
* @param unionid
|
|
326
|
+
* @param openid
|
|
327
|
+
* @param corpid
|
|
328
|
+
* @returns
|
|
329
|
+
*/
|
|
330
|
+
unionidToexternalUserid3rd(unionid, openid, corpid = '') {
|
|
331
|
+
return this.httpPostJson('cgi-bin/externalcontact/unionid_to_external_userid_3rd', {
|
|
332
|
+
unionid,
|
|
333
|
+
openid,
|
|
334
|
+
corpid,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* 客户群opengid转换
|
|
339
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/94822
|
|
340
|
+
* @param opengid
|
|
341
|
+
* @returns
|
|
342
|
+
*/
|
|
343
|
+
opengidToChatid(opengid) {
|
|
344
|
+
return this.httpPostJson('cgi-bin/externalcontact/opengid_to_chatid', {
|
|
345
|
+
opengid,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
126
348
|
}
|
|
127
349
|
exports.default = ExternalContactClient;
|
|
@@ -7,7 +7,7 @@ const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
|
7
7
|
const Utils_1 = require("../../Core/Utils");
|
|
8
8
|
class ContactWayClient extends BaseClient_1.default {
|
|
9
9
|
create(type, scene, config) {
|
|
10
|
-
let params = Utils_1.merge({
|
|
10
|
+
let params = (0, Utils_1.merge)({
|
|
11
11
|
type,
|
|
12
12
|
scene,
|
|
13
13
|
}, config);
|
|
@@ -19,7 +19,7 @@ class ContactWayClient extends BaseClient_1.default {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
update(configId, config) {
|
|
22
|
-
let params = Utils_1.merge({
|
|
22
|
+
let params = (0, Utils_1.merge)({
|
|
23
23
|
config_id: configId,
|
|
24
24
|
}, config);
|
|
25
25
|
return this.httpPostJson('cgi-bin/externalcontact/update_contact_way', params);
|
|
@@ -5,8 +5,53 @@ export default class MessageClient extends BaseClient {
|
|
|
5
5
|
protected imageMessage: object;
|
|
6
6
|
protected linkMessage: object;
|
|
7
7
|
protected miniprogramMessage: object;
|
|
8
|
+
/**
|
|
9
|
+
* 添加企业群发消息模板
|
|
10
|
+
* @param msg
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
8
13
|
submit(msg: object): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* 获取企业群发消息发送结果
|
|
16
|
+
* @param msgId
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
9
19
|
get(msgId: string): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* 获取群发记录列表
|
|
22
|
+
* @param chatType 群发任务的类型,默认为single,表示发送给客户,group表示发送给客户群
|
|
23
|
+
* @param startTime 群发任务记录开始时间
|
|
24
|
+
* @param endTime 群发任务记录结束时间
|
|
25
|
+
* @param creator 群发任务创建人企业账号id
|
|
26
|
+
* @param filterType 创建人类型。0:企业发表 1:个人发表 2:所有,包括个人创建以及企业创建,默认情况下为所有类型
|
|
27
|
+
* @param limit 返回的最大记录数,整型,最大值100,默认值50,超过最大值时取默认值
|
|
28
|
+
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
getGroupmsgListV2(chatType: string, startTime: number, endTime: number, creator?: string, filterType?: number, limit?: number, cursor?: string): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* 获取群发成员发送任务列表
|
|
34
|
+
* @param msgId 群发消息的id,通过获取群发记录列表接口返回
|
|
35
|
+
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
|
36
|
+
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
getGroupmsgTask(msgId: string, limit?: number, cursor?: string): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* 获取企业群发成员执行结果
|
|
42
|
+
* @param msgId 群发消息的id,通过获取群发记录列表接口返回
|
|
43
|
+
* @param userId 发送成员userid,通过获取群发成员发送任务列表接口返回
|
|
44
|
+
* @param limit 返回的最大记录数,整型,最大值1000,默认值500,超过最大值时取默认值
|
|
45
|
+
* @param cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
getGroupmsgSendResult(msgId: string, userId: string, limit?: number, cursor?: string): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* 发送新客户欢迎语
|
|
51
|
+
* @param welcomeCode
|
|
52
|
+
* @param msg
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
10
55
|
sendWelcome(welcomeCode: string, msg: object): Promise<any>;
|
|
11
56
|
protected formatMessage(data: object): object;
|
|
12
57
|
protected formatFields(data: object, defaults: object): object;
|