node-easywechat 2.8.1 → 2.8.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/dist/Work/Agent/WorkbenchClient.d.ts +24 -0
- package/dist/Work/Agent/WorkbenchClient.js +39 -0
- package/dist/Work/Application.d.ts +8 -0
- package/dist/Work/Application.js +20 -0
- package/dist/Work/CorpGroup/CorpGroupClient.d.ts +34 -0
- package/dist/Work/CorpGroup/CorpGroupClient.js +42 -0
- package/dist/Work/ExternalContact/Client.d.ts +11 -0
- package/dist/Work/ExternalContact/Client.js +16 -0
- package/dist/Work/ExternalContact/ContactWayClient.d.ts +37 -0
- package/dist/Work/ExternalContact/ContactWayClient.js +49 -0
- package/dist/Work/ExternalContact/MomentClient.d.ts +56 -3
- package/dist/Work/ExternalContact/MomentClient.js +62 -3
- package/dist/Work/ExternalContact/StatisticsClient.d.ts +24 -0
- package/dist/Work/ExternalContact/StatisticsClient.js +35 -0
- package/dist/Work/Kf/KfAccountClient.d.ts +41 -0
- package/dist/Work/Kf/KfAccountClient.js +71 -0
- package/dist/Work/Kf/KfMessageClient.d.ts +44 -0
- package/dist/Work/Kf/KfMessageClient.js +73 -0
- package/dist/Work/Kf/KfServicerClient.d.ts +26 -0
- package/dist/Work/Kf/KfServicerClient.js +47 -0
- 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 +3 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class WorkbenchClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 设置应用在工作台展示的模版
|
|
5
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/92535#设置应用在工作台展示的模版
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
setWorkbenchTemplate(params: object): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取应用在工作台展示的模版
|
|
12
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/92535#获取应用在工作台展示的模版
|
|
13
|
+
* @param agentId
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
getWorkbenchTemplate(agentId: number): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* 设置应用在用户工作台展示的数据
|
|
19
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/92535#设置应用在用户工作台展示的数据
|
|
20
|
+
* @param params
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
setWorkbenchData(params: object): Promise<any>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
+
class WorkbenchClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 设置应用在工作台展示的模版
|
|
10
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/92535#设置应用在工作台展示的模版
|
|
11
|
+
* @param params
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
setWorkbenchTemplate(params) {
|
|
15
|
+
return this.httpPostJson('cgi-bin/agent/set_workbench_template', params);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 获取应用在工作台展示的模版
|
|
19
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/92535#获取应用在工作台展示的模版
|
|
20
|
+
* @param agentId
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
getWorkbenchTemplate(agentId) {
|
|
24
|
+
let params = {
|
|
25
|
+
agentid: agentId,
|
|
26
|
+
};
|
|
27
|
+
return this.httpPostJson('cgi-bin/agent/get_workbench_template', params);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 设置应用在用户工作台展示的数据
|
|
31
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/92535#设置应用在用户工作台展示的数据
|
|
32
|
+
* @param params
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
setWorkbenchData(params) {
|
|
36
|
+
return this.httpPostJson('cgi-bin/agent/set_workbench_data', params);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = WorkbenchClient;
|
|
@@ -4,6 +4,7 @@ import WorkBase from './Base/WorkBase';
|
|
|
4
4
|
import OAClient from './OA/OAClient';
|
|
5
5
|
import AccessToken from './Auth/AccessToken';
|
|
6
6
|
import AgentClient from './Agent/AgentClient';
|
|
7
|
+
import WorkbenchClient from './Agent/WorkbenchClient';
|
|
7
8
|
import CalendarClient from './Calendar/CalendarClient';
|
|
8
9
|
import ChatClient from './Chat/ChatClient';
|
|
9
10
|
import DepartmentClient from './Department/DepartmentClient';
|
|
@@ -11,6 +12,9 @@ import GroupRobotClient from './GroupRobot/GroupRobotClient';
|
|
|
11
12
|
import GroupRobotMessenger from './GroupRobot/Messenger';
|
|
12
13
|
import InvoiceClient from './Invoice/InvoiceClient';
|
|
13
14
|
import JssdkClient from './Jssdk/JssdkClient';
|
|
15
|
+
import KfAccountClient from './Kf/KfAccountClient';
|
|
16
|
+
import KfMessageClient from './Kf/KfMessageClient';
|
|
17
|
+
import KfServicerClient from './Kf/KfServicerClient';
|
|
14
18
|
import LiveClient from './Live/LiveClient';
|
|
15
19
|
import MediaClient from './Media/MediaClient';
|
|
16
20
|
import MenuClient from './Menu/MenuClient';
|
|
@@ -36,6 +40,7 @@ export default class Work extends BaseApplication {
|
|
|
36
40
|
oa: OAClient;
|
|
37
41
|
access_token: AccessToken;
|
|
38
42
|
agent: AgentClient;
|
|
43
|
+
agent_workbench: WorkbenchClient;
|
|
39
44
|
base: WorkBase;
|
|
40
45
|
calendar: CalendarClient;
|
|
41
46
|
chat: ChatClient;
|
|
@@ -52,6 +57,9 @@ export default class Work extends BaseApplication {
|
|
|
52
57
|
group_robot_messenger: GroupRobotMessenger;
|
|
53
58
|
invoice: InvoiceClient;
|
|
54
59
|
jssdk: JssdkClient;
|
|
60
|
+
kf_account: KfAccountClient;
|
|
61
|
+
kf_message: KfMessageClient;
|
|
62
|
+
kf_servicer: KfServicerClient;
|
|
55
63
|
live: LiveClient;
|
|
56
64
|
media: MediaClient;
|
|
57
65
|
menu: MenuClient;
|
package/dist/Work/Application.js
CHANGED
|
@@ -17,6 +17,7 @@ const WorkBase_1 = __importDefault(require("./Base/WorkBase"));
|
|
|
17
17
|
const OAClient_1 = __importDefault(require("./OA/OAClient"));
|
|
18
18
|
const AccessToken_1 = __importDefault(require("./Auth/AccessToken"));
|
|
19
19
|
const AgentClient_1 = __importDefault(require("./Agent/AgentClient"));
|
|
20
|
+
const WorkbenchClient_1 = __importDefault(require("./Agent/WorkbenchClient"));
|
|
20
21
|
const CalendarClient_1 = __importDefault(require("./Calendar/CalendarClient"));
|
|
21
22
|
const ChatClient_1 = __importDefault(require("./Chat/ChatClient"));
|
|
22
23
|
const DepartmentClient_1 = __importDefault(require("./Department/DepartmentClient"));
|
|
@@ -24,6 +25,9 @@ const GroupRobotClient_1 = __importDefault(require("./GroupRobot/GroupRobotClien
|
|
|
24
25
|
const Messenger_1 = __importDefault(require("./GroupRobot/Messenger"));
|
|
25
26
|
const InvoiceClient_1 = __importDefault(require("./Invoice/InvoiceClient"));
|
|
26
27
|
const JssdkClient_1 = __importDefault(require("./Jssdk/JssdkClient"));
|
|
28
|
+
const KfAccountClient_1 = __importDefault(require("./Kf/KfAccountClient"));
|
|
29
|
+
const KfMessageClient_1 = __importDefault(require("./Kf/KfMessageClient"));
|
|
30
|
+
const KfServicerClient_1 = __importDefault(require("./Kf/KfServicerClient"));
|
|
27
31
|
const LiveClient_1 = __importDefault(require("./Live/LiveClient"));
|
|
28
32
|
const MediaClient_1 = __importDefault(require("./Media/MediaClient"));
|
|
29
33
|
const MenuClient_1 = __importDefault(require("./Menu/MenuClient"));
|
|
@@ -56,6 +60,7 @@ class Work extends BaseApplication_1.default {
|
|
|
56
60
|
this.oa = null;
|
|
57
61
|
this.access_token = null;
|
|
58
62
|
this.agent = null;
|
|
63
|
+
this.agent_workbench = null;
|
|
59
64
|
this.base = null;
|
|
60
65
|
this.calendar = null;
|
|
61
66
|
this.chat = null;
|
|
@@ -72,6 +77,9 @@ class Work extends BaseApplication_1.default {
|
|
|
72
77
|
this.group_robot_messenger = null;
|
|
73
78
|
this.invoice = null;
|
|
74
79
|
this.jssdk = null;
|
|
80
|
+
this.kf_account = null;
|
|
81
|
+
this.kf_message = null;
|
|
82
|
+
this.kf_servicer = null;
|
|
75
83
|
this.live = null;
|
|
76
84
|
this.media = null;
|
|
77
85
|
this.menu = null;
|
|
@@ -101,6 +109,9 @@ class Work extends BaseApplication_1.default {
|
|
|
101
109
|
this.offsetSet('agent', function (app) {
|
|
102
110
|
return new AgentClient_1.default(app);
|
|
103
111
|
});
|
|
112
|
+
this.offsetSet('agent_workbench', function (app) {
|
|
113
|
+
return new WorkbenchClient_1.default(app);
|
|
114
|
+
});
|
|
104
115
|
this.offsetSet('calendar', function (app) {
|
|
105
116
|
return new CalendarClient_1.default(app);
|
|
106
117
|
});
|
|
@@ -146,6 +157,15 @@ class Work extends BaseApplication_1.default {
|
|
|
146
157
|
this.offsetSet('jssdk', function (app) {
|
|
147
158
|
return new JssdkClient_1.default(app);
|
|
148
159
|
});
|
|
160
|
+
this.offsetSet('kf_account', function (app) {
|
|
161
|
+
return new KfAccountClient_1.default(app);
|
|
162
|
+
});
|
|
163
|
+
this.offsetSet('kf_message', function (app) {
|
|
164
|
+
return new KfMessageClient_1.default(app);
|
|
165
|
+
});
|
|
166
|
+
this.offsetSet('kf_servicer', function (app) {
|
|
167
|
+
return new KfServicerClient_1.default(app);
|
|
168
|
+
});
|
|
149
169
|
this.offsetSet('live', function (app) {
|
|
150
170
|
return new LiveClient_1.default(app);
|
|
151
171
|
});
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import BaseClient from '../../Core/BaseClient';
|
|
2
2
|
export default class CorpGroupClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取应用共享信息
|
|
5
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93403
|
|
6
|
+
* @param agentId
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
3
9
|
getAppShareInfo(agentId: number): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取下级企业的access_token
|
|
12
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93359
|
|
13
|
+
* @param corpId
|
|
14
|
+
* @param agentId
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
4
17
|
getToken(corpId: string, agentId: number): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* 获取下级企业的小程序session
|
|
20
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93355
|
|
21
|
+
* @param userId
|
|
22
|
+
* @param sessionKey
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
5
25
|
getMiniProgramTransferSession(userId: string, sessionKey: number): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* 将明文corpid转换为第三方应用获取的corpid(仅限第三方服务商,转换已获授权企业的corpid)
|
|
28
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#1.4%20corpid%E8%BD%AC%E6%8D%A2
|
|
29
|
+
* @param corpId
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
getOpenCorpid(corpId: string): Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* 将自建应用获取的userid转换为第三方应用获取的userid(仅代开发自建应用或第三方应用可调用)
|
|
35
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#2.4%20userid%E7%9A%84%E8%BD%AC%E6%8D%A2
|
|
36
|
+
* @param useridList
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
batchUseridToOpenUserid(useridList: string[]): Promise<any>;
|
|
6
40
|
}
|
|
@@ -5,22 +5,64 @@ 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 CorpGroupClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取应用共享信息
|
|
10
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93403
|
|
11
|
+
* @param agentId
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
8
14
|
getAppShareInfo(agentId) {
|
|
9
15
|
return this.httpPostJson('cgi-bin/corpgroup/corp/list_app_share_info', {
|
|
10
16
|
agentid: agentId,
|
|
11
17
|
});
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* 获取下级企业的access_token
|
|
21
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93359
|
|
22
|
+
* @param corpId
|
|
23
|
+
* @param agentId
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
13
26
|
getToken(corpId, agentId) {
|
|
14
27
|
return this.httpPostJson('cgi-bin/corpgroup/corp/gettoken', {
|
|
15
28
|
corpid: corpId,
|
|
16
29
|
agentid: agentId,
|
|
17
30
|
});
|
|
18
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* 获取下级企业的小程序session
|
|
34
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93355
|
|
35
|
+
* @param userId
|
|
36
|
+
* @param sessionKey
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
19
39
|
getMiniProgramTransferSession(userId, sessionKey) {
|
|
20
40
|
return this.httpPostJson('cgi-bin/miniprogram/transfer_session', {
|
|
21
41
|
userid: userId,
|
|
22
42
|
session_key: sessionKey,
|
|
23
43
|
});
|
|
24
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* 将明文corpid转换为第三方应用获取的corpid(仅限第三方服务商,转换已获授权企业的corpid)
|
|
47
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#1.4%20corpid%E8%BD%AC%E6%8D%A2
|
|
48
|
+
* @param corpId
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
getOpenCorpid(corpId) {
|
|
52
|
+
return this.httpPostJson('cgi-bin/corp/to_open_corpid', {
|
|
53
|
+
corpid: corpId,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 将自建应用获取的userid转换为第三方应用获取的userid(仅代开发自建应用或第三方应用可调用)
|
|
58
|
+
* @see https://open.work.weixin.qq.com/api/doc/90001/90143/95327#2.4%20userid%E7%9A%84%E8%BD%AC%E6%8D%A2
|
|
59
|
+
* @param useridList
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
batchUseridToOpenUserid(useridList) {
|
|
63
|
+
return this.httpPostJson('cgi-bin/batch/userid_to_openuserid', {
|
|
64
|
+
userid_list: useridList,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
25
67
|
}
|
|
26
68
|
exports.default = CorpGroupClient;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import BaseClient from '../../Core/BaseClient';
|
|
3
|
+
import Stream from 'stream';
|
|
2
4
|
export default class ExternalContactClient extends BaseClient {
|
|
3
5
|
/**
|
|
4
6
|
* 获取配置了客户联系功能的成员列表
|
|
@@ -208,4 +210,13 @@ export default class ExternalContactClient extends BaseClient {
|
|
|
208
210
|
* @returns
|
|
209
211
|
*/
|
|
210
212
|
opengidToChatid(opengid: string): Promise<any>;
|
|
213
|
+
/**
|
|
214
|
+
* 上传附件资源
|
|
215
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/95098
|
|
216
|
+
* @param path
|
|
217
|
+
* @param mediaType
|
|
218
|
+
* @param attachmentType
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
221
|
+
uploadAttachment(path: string | Stream.Readable, mediaType: string, attachmentType: string): Promise<any>;
|
|
211
222
|
}
|
|
@@ -345,5 +345,21 @@ class ExternalContactClient extends BaseClient_1.default {
|
|
|
345
345
|
opengid,
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* 上传附件资源
|
|
350
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/95098
|
|
351
|
+
* @param path
|
|
352
|
+
* @param mediaType
|
|
353
|
+
* @param attachmentType
|
|
354
|
+
* @returns
|
|
355
|
+
*/
|
|
356
|
+
uploadAttachment(path, mediaType, attachmentType) {
|
|
357
|
+
return this.httpUpload('cgi-bin/media/upload_attachment', {
|
|
358
|
+
media: path
|
|
359
|
+
}, {}, {
|
|
360
|
+
media_type: mediaType,
|
|
361
|
+
attachment_type: attachmentType,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
348
364
|
}
|
|
349
365
|
exports.default = ExternalContactClient;
|
|
@@ -1,7 +1,44 @@
|
|
|
1
1
|
import BaseClient from '../../Core/BaseClient';
|
|
2
2
|
export default class ContactWayClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 配置客户联系「联系我」方式
|
|
5
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E9%85%8D%E7%BD%AE%E5%AE%A2%E6%88%B7%E8%81%94%E7%B3%BB%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
6
|
+
* @param type
|
|
7
|
+
* @param scene
|
|
8
|
+
* @param config
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
3
11
|
create(type: number, scene: number, config: object): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* 获取企业已配置的「联系我」方式
|
|
14
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
15
|
+
* @param configId
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
4
18
|
get(configId: string): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* 更新企业已配置的「联系我」方式
|
|
21
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E6%9B%B4%E6%96%B0%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
22
|
+
* @param configId
|
|
23
|
+
* @param config
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
5
26
|
update(configId: string, config: object): Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* 删除企业已配置的「联系我」方式
|
|
29
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E5%88%A0%E9%99%A4%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
30
|
+
* @param configId
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
6
33
|
delete(configId: string): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* 获取企业已配置的「联系我」列表
|
|
36
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E5%88%97%E8%A1%A8
|
|
37
|
+
* @param cursor
|
|
38
|
+
* @param limit
|
|
39
|
+
* @param startTime
|
|
40
|
+
* @param endTime
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
list(cursor?: string, limit?: number, startTime?: number, endTime?: number): Promise<any>;
|
|
7
44
|
}
|
|
@@ -6,6 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
7
|
const Utils_1 = require("../../Core/Utils");
|
|
8
8
|
class ContactWayClient extends BaseClient_1.default {
|
|
9
|
+
/**
|
|
10
|
+
* 配置客户联系「联系我」方式
|
|
11
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E9%85%8D%E7%BD%AE%E5%AE%A2%E6%88%B7%E8%81%94%E7%B3%BB%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
12
|
+
* @param type
|
|
13
|
+
* @param scene
|
|
14
|
+
* @param config
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
9
17
|
create(type, scene, config) {
|
|
10
18
|
let params = (0, Utils_1.merge)({
|
|
11
19
|
type,
|
|
@@ -13,21 +21,62 @@ class ContactWayClient extends BaseClient_1.default {
|
|
|
13
21
|
}, config);
|
|
14
22
|
return this.httpPostJson('cgi-bin/externalcontact/add_contact_way', params);
|
|
15
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* 获取企业已配置的「联系我」方式
|
|
26
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
27
|
+
* @param configId
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
16
30
|
get(configId) {
|
|
17
31
|
return this.httpGet('cgi-bin/externalcontact/get_contact_way', {
|
|
18
32
|
config_id: configId,
|
|
19
33
|
});
|
|
20
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* 更新企业已配置的「联系我」方式
|
|
37
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E6%9B%B4%E6%96%B0%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
38
|
+
* @param configId
|
|
39
|
+
* @param config
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
21
42
|
update(configId, config) {
|
|
22
43
|
let params = (0, Utils_1.merge)({
|
|
23
44
|
config_id: configId,
|
|
24
45
|
}, config);
|
|
25
46
|
return this.httpPostJson('cgi-bin/externalcontact/update_contact_way', params);
|
|
26
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 删除企业已配置的「联系我」方式
|
|
50
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E5%88%A0%E9%99%A4%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E6%96%B9%E5%BC%8F
|
|
51
|
+
* @param configId
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
27
54
|
delete(configId) {
|
|
28
55
|
return this.httpGet('cgi-bin/externalcontact/del_contact_way', {
|
|
29
56
|
config_id: configId,
|
|
30
57
|
});
|
|
31
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* 获取企业已配置的「联系我」列表
|
|
61
|
+
* @see https://developer.work.weixin.qq.com/document/path/92572#%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E5%B7%B2%E9%85%8D%E7%BD%AE%E7%9A%84%E3%80%8C%E8%81%94%E7%B3%BB%E6%88%91%E3%80%8D%E5%88%97%E8%A1%A8
|
|
62
|
+
* @param cursor
|
|
63
|
+
* @param limit
|
|
64
|
+
* @param startTime
|
|
65
|
+
* @param endTime
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
list(cursor = '', limit = 100, startTime = null, endTime = null) {
|
|
69
|
+
let params = {
|
|
70
|
+
cursor,
|
|
71
|
+
limit,
|
|
72
|
+
};
|
|
73
|
+
if (startTime) {
|
|
74
|
+
params['start_time'] = startTime;
|
|
75
|
+
}
|
|
76
|
+
if (endTime) {
|
|
77
|
+
params['end_time'] = endTime;
|
|
78
|
+
}
|
|
79
|
+
return this.httpPostJson('cgi-bin/externalcontact/list_contact_way', params);
|
|
80
|
+
}
|
|
32
81
|
}
|
|
33
82
|
exports.default = ContactWayClient;
|
|
@@ -1,8 +1,61 @@
|
|
|
1
1
|
import BaseClient from '../../Core/BaseClient';
|
|
2
2
|
export default class MomentClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 创建发表任务
|
|
5
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/95094#%E5%88%9B%E5%BB%BA%E5%8F%91%E8%A1%A8%E4%BB%BB%E5%8A%A1
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
createTask(params: object): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取任务创建结果
|
|
12
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/95094#%E8%8E%B7%E5%8F%96%E4%BB%BB%E5%8A%A1%E5%88%9B%E5%BB%BA%E7%BB%93%E6%9E%9C
|
|
13
|
+
* @param jobId
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
getTask(jobId: string): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* 获取企业全部的发表列表
|
|
19
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取企业全部的发表列表
|
|
20
|
+
* @param params
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
3
23
|
list(params: object): Promise<any>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
24
|
+
/**
|
|
25
|
+
* 获取客户朋友圈企业发表的列表
|
|
26
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈企业发表的列表
|
|
27
|
+
* @param momentId
|
|
28
|
+
* @param cursor
|
|
29
|
+
* @param limit
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
getTasks(momentId: string, cursor?: string, limit?: number): Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* 获取客户朋友圈发表时选择的可见范围
|
|
35
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈发表时选择的可见范围
|
|
36
|
+
* @param momentId
|
|
37
|
+
* @param userId
|
|
38
|
+
* @param cursor
|
|
39
|
+
* @param limit
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
getCustomers(momentId: string, userId: string, cursor?: string, limit?: number): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* 获取客户朋友圈发表后的可见客户列表
|
|
45
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈发表后的可见客户列表
|
|
46
|
+
* @param momentId
|
|
47
|
+
* @param userId
|
|
48
|
+
* @param cursor
|
|
49
|
+
* @param limit
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
getSendResult(momentId: string, userId: string, cursor?: string, limit?: number): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* 获取客户朋友圈的互动数据
|
|
55
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈的互动数据
|
|
56
|
+
* @param momentId
|
|
57
|
+
* @param userId
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
7
60
|
getComments(momentId: string, userId: string): Promise<any>;
|
|
8
61
|
}
|
|
@@ -5,10 +5,44 @@ 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 MomentClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 创建发表任务
|
|
10
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/95094#%E5%88%9B%E5%BB%BA%E5%8F%91%E8%A1%A8%E4%BB%BB%E5%8A%A1
|
|
11
|
+
* @param params
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
createTask(params) {
|
|
15
|
+
return this.httpPostJson('cgi-bin/externalcontact/add_moment_task', params);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 获取任务创建结果
|
|
19
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/95094#%E8%8E%B7%E5%8F%96%E4%BB%BB%E5%8A%A1%E5%88%9B%E5%BB%BA%E7%BB%93%E6%9E%9C
|
|
20
|
+
* @param jobId
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
getTask(jobId) {
|
|
24
|
+
return this.httpGet('cgi-bin/externalcontact/get_moment_task_result', {
|
|
25
|
+
jobid: jobId,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 获取企业全部的发表列表
|
|
30
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取企业全部的发表列表
|
|
31
|
+
* @param params
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
8
34
|
list(params) {
|
|
9
35
|
return this.httpPostJson('cgi-bin/externalcontact/get_moment_list', params);
|
|
10
36
|
}
|
|
11
|
-
|
|
37
|
+
/**
|
|
38
|
+
* 获取客户朋友圈企业发表的列表
|
|
39
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈企业发表的列表
|
|
40
|
+
* @param momentId
|
|
41
|
+
* @param cursor
|
|
42
|
+
* @param limit
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
getTasks(momentId, cursor = '', limit = 500) {
|
|
12
46
|
let params = {
|
|
13
47
|
moment_id: momentId,
|
|
14
48
|
cursor,
|
|
@@ -16,7 +50,16 @@ class MomentClient extends BaseClient_1.default {
|
|
|
16
50
|
};
|
|
17
51
|
return this.httpPostJson('cgi-bin/externalcontact/get_moment_task', params);
|
|
18
52
|
}
|
|
19
|
-
|
|
53
|
+
/**
|
|
54
|
+
* 获取客户朋友圈发表时选择的可见范围
|
|
55
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈发表时选择的可见范围
|
|
56
|
+
* @param momentId
|
|
57
|
+
* @param userId
|
|
58
|
+
* @param cursor
|
|
59
|
+
* @param limit
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
getCustomers(momentId, userId, cursor = '', limit = 500) {
|
|
20
63
|
let params = {
|
|
21
64
|
moment_id: momentId,
|
|
22
65
|
userid: userId,
|
|
@@ -25,7 +68,16 @@ class MomentClient extends BaseClient_1.default {
|
|
|
25
68
|
};
|
|
26
69
|
return this.httpPostJson('cgi-bin/externalcontact/get_moment_customer_list', params);
|
|
27
70
|
}
|
|
28
|
-
|
|
71
|
+
/**
|
|
72
|
+
* 获取客户朋友圈发表后的可见客户列表
|
|
73
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈发表后的可见客户列表
|
|
74
|
+
* @param momentId
|
|
75
|
+
* @param userId
|
|
76
|
+
* @param cursor
|
|
77
|
+
* @param limit
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
getSendResult(momentId, userId, cursor = '', limit = 3000) {
|
|
29
81
|
let params = {
|
|
30
82
|
moment_id: momentId,
|
|
31
83
|
userid: userId,
|
|
@@ -34,6 +86,13 @@ class MomentClient extends BaseClient_1.default {
|
|
|
34
86
|
};
|
|
35
87
|
return this.httpPostJson('cgi-bin/externalcontact/get_moment_send_result', params);
|
|
36
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* 获取客户朋友圈的互动数据
|
|
91
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/93333#获取客户朋友圈的互动数据
|
|
92
|
+
* @param momentId
|
|
93
|
+
* @param userId
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
37
96
|
getComments(momentId, userId) {
|
|
38
97
|
let params = {
|
|
39
98
|
moment_id: momentId,
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
import BaseClient from '../../Core/BaseClient';
|
|
2
2
|
export default class StatisticsClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取「联系客户统计」数据
|
|
5
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92132
|
|
6
|
+
* @param userIds
|
|
7
|
+
* @param from
|
|
8
|
+
* @param to
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
3
11
|
userBehavior(userIds: string[], from: string, to: string): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* 获取「群聊数据统计」数据(按群主聚合的方式)
|
|
14
|
+
* @see https://developer.work.weixin.qq.com/document/path/92133#%E6%8C%89%E7%BE%A4%E4%B8%BB%E8%81%9A%E5%90%88%E7%9A%84%E6%96%B9%E5%BC%8F
|
|
15
|
+
* @param params
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
groupChatStatistic(params: object): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取「群聊数据统计」数据(按自然日聚合的方式)
|
|
21
|
+
* @see https://developer.work.weixin.qq.com/document/path/92133#%E6%8C%89%E8%87%AA%E7%84%B6%E6%97%A5%E8%81%9A%E5%90%88%E7%9A%84%E6%96%B9%E5%BC%8F
|
|
22
|
+
* @param dayBeginTime
|
|
23
|
+
* @param dayEndTime
|
|
24
|
+
* @param userIds
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
groupChatStatisticGroupByDay(dayBeginTime: number, dayEndTime: number, userIds: string[]): Promise<any>;
|
|
4
28
|
}
|
|
@@ -5,6 +5,14 @@ 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 StatisticsClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取「联系客户统计」数据
|
|
10
|
+
* @see https://work.weixin.qq.com/api/doc/90000/90135/92132
|
|
11
|
+
* @param userIds
|
|
12
|
+
* @param from
|
|
13
|
+
* @param to
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
8
16
|
userBehavior(userIds, from, to) {
|
|
9
17
|
let params = {
|
|
10
18
|
userid: userIds,
|
|
@@ -13,5 +21,32 @@ class StatisticsClient extends BaseClient_1.default {
|
|
|
13
21
|
};
|
|
14
22
|
return this.httpPostJson('cgi-bin/externalcontact/get_user_behavior_data', params);
|
|
15
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* 获取「群聊数据统计」数据(按群主聚合的方式)
|
|
26
|
+
* @see https://developer.work.weixin.qq.com/document/path/92133#%E6%8C%89%E7%BE%A4%E4%B8%BB%E8%81%9A%E5%90%88%E7%9A%84%E6%96%B9%E5%BC%8F
|
|
27
|
+
* @param params
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
groupChatStatistic(params) {
|
|
31
|
+
return this.httpPostJson('cgi-bin/externalcontact/groupchat/statistic', params);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 获取「群聊数据统计」数据(按自然日聚合的方式)
|
|
35
|
+
* @see https://developer.work.weixin.qq.com/document/path/92133#%E6%8C%89%E8%87%AA%E7%84%B6%E6%97%A5%E8%81%9A%E5%90%88%E7%9A%84%E6%96%B9%E5%BC%8F
|
|
36
|
+
* @param dayBeginTime
|
|
37
|
+
* @param dayEndTime
|
|
38
|
+
* @param userIds
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
groupChatStatisticGroupByDay(dayBeginTime, dayEndTime, userIds) {
|
|
42
|
+
let params = {
|
|
43
|
+
day_begin_time: dayBeginTime,
|
|
44
|
+
day_end_time: dayEndTime,
|
|
45
|
+
owner_filter: {
|
|
46
|
+
userid_list: userIds,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
return this.httpPostJson('cgi-bin/externalcontact/groupchat/statistic_group_by_day', params);
|
|
50
|
+
}
|
|
16
51
|
}
|
|
17
52
|
exports.default = StatisticsClient;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class KfAccountClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 添加客服帐号
|
|
5
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94662
|
|
6
|
+
* @param name
|
|
7
|
+
* @param mediaId
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
add(name: string, mediaId: string): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* 修改客服帐号
|
|
13
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94664
|
|
14
|
+
* @param openKfId
|
|
15
|
+
* @param name
|
|
16
|
+
* @param mediaId
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
update(openKfId: string, name: string, mediaId: string): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* 删除客服帐号
|
|
22
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94663
|
|
23
|
+
* @param openKfId
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
del(openKfId: string): Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* 获取客服帐号列表
|
|
29
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94661
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
list(): Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* 获取客服帐号链接
|
|
35
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94665
|
|
36
|
+
* @param openKfId
|
|
37
|
+
* @param scene
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
getAccountLink(openKfId: string, scene: string): Promise<any>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
+
class KfAccountClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 添加客服帐号
|
|
10
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94662
|
|
11
|
+
* @param name
|
|
12
|
+
* @param mediaId
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
add(name, mediaId) {
|
|
16
|
+
let params = {
|
|
17
|
+
name,
|
|
18
|
+
media_id: mediaId,
|
|
19
|
+
};
|
|
20
|
+
return this.httpPostJson('cgi-bin/kf/account/add', params);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 修改客服帐号
|
|
24
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94664
|
|
25
|
+
* @param openKfId
|
|
26
|
+
* @param name
|
|
27
|
+
* @param mediaId
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
update(openKfId, name, mediaId) {
|
|
31
|
+
let params = {
|
|
32
|
+
open_kfid: openKfId,
|
|
33
|
+
name,
|
|
34
|
+
media_id: mediaId,
|
|
35
|
+
};
|
|
36
|
+
return this.httpPostJson('cgi-bin/kf/account/update', params);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 删除客服帐号
|
|
40
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94663
|
|
41
|
+
* @param openKfId
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
del(openKfId) {
|
|
45
|
+
return this.httpPostJson('cgi-bin/kf/account/del', {
|
|
46
|
+
open_kfid: openKfId,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 获取客服帐号列表
|
|
51
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94661
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
list() {
|
|
55
|
+
return this.httpGet('cgi-bin/kf/account/list');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 获取客服帐号链接
|
|
59
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94665
|
|
60
|
+
* @param openKfId
|
|
61
|
+
* @param scene
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
getAccountLink(openKfId, scene) {
|
|
65
|
+
return this.httpPostJson('cgi-bin/kf/add_contact_way', {
|
|
66
|
+
open_kfid: openKfId,
|
|
67
|
+
scene,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.default = KfAccountClient;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class KfMessageClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取会话状态
|
|
5
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94669
|
|
6
|
+
* @param openKfId
|
|
7
|
+
* @param externalUserId
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
state(openKfId: string, externalUserId: string): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* 变更会话状态
|
|
13
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94669
|
|
14
|
+
* @param openKfId
|
|
15
|
+
* @param externalUserId
|
|
16
|
+
* @param serviceState
|
|
17
|
+
* @param serviceUserId
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
del(openKfId: string, externalUserId: string, serviceState: number, serviceUserId: string): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* 读取消息
|
|
23
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94670
|
|
24
|
+
* @param cursor
|
|
25
|
+
* @param token
|
|
26
|
+
* @param limit
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
sync(cursor: string, token: string, limit: number): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* 发送消息
|
|
32
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94677
|
|
33
|
+
* @param params
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
send(params: object): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* 发送事件响应消息
|
|
39
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94677
|
|
40
|
+
* @param params
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
event(params: object): Promise<any>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
+
class KfMessageClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取会话状态
|
|
10
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94669
|
|
11
|
+
* @param openKfId
|
|
12
|
+
* @param externalUserId
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
state(openKfId, externalUserId) {
|
|
16
|
+
let params = {
|
|
17
|
+
open_kfid: openKfId,
|
|
18
|
+
external_userid: externalUserId,
|
|
19
|
+
};
|
|
20
|
+
return this.httpPostJson('cgi-bin/kf/service_state/get', params);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 变更会话状态
|
|
24
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94669
|
|
25
|
+
* @param openKfId
|
|
26
|
+
* @param externalUserId
|
|
27
|
+
* @param serviceState
|
|
28
|
+
* @param serviceUserId
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
del(openKfId, externalUserId, serviceState, serviceUserId) {
|
|
32
|
+
return this.httpPostJson('cgi-bin/kf/service_state/trans', {
|
|
33
|
+
open_kfid: openKfId,
|
|
34
|
+
external_userid: externalUserId,
|
|
35
|
+
service_state: serviceState,
|
|
36
|
+
servicer_userid: serviceUserId,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 读取消息
|
|
41
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94670
|
|
42
|
+
* @param cursor
|
|
43
|
+
* @param token
|
|
44
|
+
* @param limit
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
sync(cursor, token, limit) {
|
|
48
|
+
return this.httpPostJson('cgi-bin/kf/sync_msg', {
|
|
49
|
+
cursor,
|
|
50
|
+
token,
|
|
51
|
+
limit,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 发送消息
|
|
56
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94677
|
|
57
|
+
* @param params
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
send(params) {
|
|
61
|
+
return this.httpPostJson('cgi-bin/kf/send_msg', params);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 发送事件响应消息
|
|
65
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94677
|
|
66
|
+
* @param params
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
event(params) {
|
|
70
|
+
return this.httpPostJson('cgi-bin/kf/send_msg_on_event', params);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.default = KfMessageClient;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class KfServicerClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 添加接待人员
|
|
5
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94646
|
|
6
|
+
* @param openKfId
|
|
7
|
+
* @param userIds
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
add(openKfId: string, userIds: string[]): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* 删除接待人员
|
|
13
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94647
|
|
14
|
+
* @param openKfId
|
|
15
|
+
* @param userIds
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
del(openKfId: string, userIds: string[]): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取接待人员列表
|
|
21
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94645
|
|
22
|
+
* @param openKfId
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
list(openKfId: string): Promise<any>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
+
class KfServicerClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 添加接待人员
|
|
10
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94646
|
|
11
|
+
* @param openKfId
|
|
12
|
+
* @param userIds
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
add(openKfId, userIds) {
|
|
16
|
+
let params = {
|
|
17
|
+
open_kfid: openKfId,
|
|
18
|
+
media_id: userIds,
|
|
19
|
+
};
|
|
20
|
+
return this.httpPostJson('cgi-bin/kf/servicer/add', params);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 删除接待人员
|
|
24
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94647
|
|
25
|
+
* @param openKfId
|
|
26
|
+
* @param userIds
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
del(openKfId, userIds) {
|
|
30
|
+
return this.httpPostJson('cgi-bin/kf/servicer/del', {
|
|
31
|
+
open_kfid: openKfId,
|
|
32
|
+
userid_list: userIds,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 获取接待人员列表
|
|
37
|
+
* @see https://open.work.weixin.qq.com/api/doc/90000/90135/94645
|
|
38
|
+
* @param openKfId
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
list(openKfId) {
|
|
42
|
+
return this.httpGet('cgi-bin/kf/servicer/list', {
|
|
43
|
+
open_kfid: openKfId,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = KfServicerClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"data":{"errcode":0,"errmsg":"ok","access_token":"moke-token","expires_in":7200},"lifeTime":
|
|
1
|
+
{"data":{"errcode":0,"errmsg":"ok","access_token":"moke-token","expires_in":7200},"lifeTime":1642010223}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"data":{"errcode":0,"errmsg":"ok"},"lifeTime":
|
|
1
|
+
{"data":{"errcode":0,"errmsg":"ok"},"lifeTime":1642010223}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-easywechat",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "EasyWechat SDK for Node.js (NOT OFFICIAL)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"typescript": "^4.5.4"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"axios": "^0.
|
|
30
|
+
"axios": "^0.24.0",
|
|
31
31
|
"form-data": "^4.0.0",
|
|
32
|
-
"node-socialite": "^1.2.
|
|
32
|
+
"node-socialite": "^1.2.5",
|
|
33
33
|
"qs": "^6.10.2",
|
|
34
34
|
"raw-body": "^2.4.2",
|
|
35
35
|
"xml2js": "^0.4.23"
|