@jiexiaoyin/wecom-api 0.0.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/README.md +228 -0
- package/config.example.json +7 -0
- package/config.js +76 -0
- package/docs/approval-templates.example.json +11 -0
- package/docs/nginx-mirror.md +193 -0
- package/openclaw.plugin.json +15 -0
- package/package.json +34 -0
- package/plugin.cjs +172 -0
- package/plugin.ts +136 -0
- package/skills/wecom-api/SKILL.md +40 -0
- package/skills/wecom-api/index.js +288 -0
- package/skills/wecom-api/openclaw.plugin.json +10 -0
- package/src/callback-helper.js +198 -0
- package/src/config.cjs +286 -0
- package/src/core/permission.js +479 -0
- package/src/crypto.js +130 -0
- package/src/index.js +199 -0
- package/src/modules/addressbook/index.js +413 -0
- package/src/modules/addressbook_cache/index.js +365 -0
- package/src/modules/advanced/index.js +159 -0
- package/src/modules/app/index.js +102 -0
- package/src/modules/approval/index.js +146 -0
- package/src/modules/auth/index.js +103 -0
- package/src/modules/callback/index.js +1180 -0
- package/src/modules/chain/index.js +193 -0
- package/src/modules/checkin/index.js +142 -0
- package/src/modules/checkin_rules/index.js +251 -0
- package/src/modules/contact/index.js +481 -0
- package/src/modules/contact_stats/index.js +349 -0
- package/src/modules/custom/index.js +140 -0
- package/src/modules/customer/index.js +51 -0
- package/src/modules/disk/index.js +245 -0
- package/src/modules/document/index.js +282 -0
- package/src/modules/hr/index.js +93 -0
- package/src/modules/intelligence/index.js +346 -0
- package/src/modules/kf/index.js +74 -0
- package/src/modules/live/index.js +122 -0
- package/src/modules/media/index.js +183 -0
- package/src/modules/meeting/index.js +665 -0
- package/src/modules/message/index.js +402 -0
- package/src/modules/messenger/index.js +208 -0
- package/src/modules/moments/index.js +161 -0
- package/src/modules/msgaudit/index.js +24 -0
- package/src/modules/notify/index.js +81 -0
- package/src/modules/oceanengine/index.js +199 -0
- package/src/modules/openchat/index.js +197 -0
- package/src/modules/phone/index.js +45 -0
- package/src/modules/room/index.js +178 -0
- package/src/modules/schedule/index.js +246 -0
- package/src/modules/school/index.js +199 -0
- package/src/modules/security/index.js +223 -0
- package/src/modules/sensitive/index.js +170 -0
- package/src/modules/thirdparty/index.js +145 -0
- package/src/sdk/index.js +269 -0
- package/src/utils/callback-helper.js +198 -0
- package/test/callback-crypto.test.js +55 -0
- package/test/crypto.test.js +85 -0
- package/test/permission.test.js +115 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 客户朋友圈模块
|
|
3
|
+
* API 章节:十三 - 客户朋友圈
|
|
4
|
+
* 包含:发表朋友圈、停止发表、获取记录等
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const WeComSDK = require('../../sdk');
|
|
8
|
+
|
|
9
|
+
class Moments extends WeComSDK {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ========== 朋友圈内容管理 ==========
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 企业发表内容到客户的朋友圈
|
|
18
|
+
* @param {string} userId 成员 ID
|
|
19
|
+
* @param {object} content 朋友圈内容
|
|
20
|
+
*/
|
|
21
|
+
async createMoment(userId, content) {
|
|
22
|
+
const { text, imageIds, videoId, link, location } = content;
|
|
23
|
+
return this.post('/externalcontact/add_moment_task', {
|
|
24
|
+
userid: userId,
|
|
25
|
+
moment_type: 1,
|
|
26
|
+
moment_content: {
|
|
27
|
+
text,
|
|
28
|
+
image: imageIds || [],
|
|
29
|
+
video: videoId,
|
|
30
|
+
link: link,
|
|
31
|
+
location: location
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 获取客户朋友圈全部的发表记录
|
|
38
|
+
* @param {string} userId 成员 ID
|
|
39
|
+
* @param {number} startTime 开始时间戳
|
|
40
|
+
* @param {number} endTime 结束时间戳
|
|
41
|
+
* @param {number} cursor 分页游标
|
|
42
|
+
* @param {number} size 每页数量
|
|
43
|
+
*/
|
|
44
|
+
async getMomentList(userId, startTime, endTime, cursor = '', size = 100) {
|
|
45
|
+
return this.post('/externalcontact/get_moment_list', {
|
|
46
|
+
userid: userId,
|
|
47
|
+
start_time: startTime,
|
|
48
|
+
end_time: endTime,
|
|
49
|
+
cursor,
|
|
50
|
+
limit: size
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 获取客户朋友圈发表结果
|
|
56
|
+
* @param {string} momentId 朋友圈 ID
|
|
57
|
+
* @param {string} userId 成员 ID
|
|
58
|
+
*/
|
|
59
|
+
async getMomentTaskResult(momentId, userId) {
|
|
60
|
+
return this.post('/externalcontact/get_moment_task_result', {
|
|
61
|
+
moment_id: momentId,
|
|
62
|
+
userid: userId
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 获取朋友圈互动数据
|
|
68
|
+
* @param {string} momentId 朋友圈 ID
|
|
69
|
+
* @param {string} userId 成员 ID
|
|
70
|
+
*/
|
|
71
|
+
async getMomentComments(momentId, userId) {
|
|
72
|
+
return this.post('/externalcontact/get_moment_comments', {
|
|
73
|
+
moment_id: momentId,
|
|
74
|
+
userid: userId
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 删除朋友圈
|
|
80
|
+
* @param {string} momentId 朋友圈 ID
|
|
81
|
+
* @param {string} userId 成员 ID
|
|
82
|
+
*/
|
|
83
|
+
async deleteMoment(momentId, userId) {
|
|
84
|
+
return this.post('/externalcontact/del_moment', {
|
|
85
|
+
moment_id: momentId,
|
|
86
|
+
userid: userId
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ========== 朋友圈规则管理 ==========
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 获取朋友圈规则组列表
|
|
94
|
+
*/
|
|
95
|
+
async getMomentRuleList() {
|
|
96
|
+
return this.post('/externalcontact/get_moment_rule_list', {});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 获取朋友圈规则组详情
|
|
101
|
+
* @param {string} ruleId 规则组 ID
|
|
102
|
+
*/
|
|
103
|
+
async getMomentRuleDetail(ruleId) {
|
|
104
|
+
return this.post('/externalcontact/get_moment_rule', { rule_id: ruleId });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 创建朋友圈规则组
|
|
109
|
+
* @param {object} rule 规则配置
|
|
110
|
+
*/
|
|
111
|
+
async createMomentRule(rule) {
|
|
112
|
+
return this.post('/externalcontact/add_moment_rule', rule);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 更新朋友圈规则组
|
|
117
|
+
* @param {string} ruleId 规则组 ID
|
|
118
|
+
* @param {object} rule 规则配置
|
|
119
|
+
*/
|
|
120
|
+
async updateMomentRule(ruleId, rule) {
|
|
121
|
+
return this.post('/externalcontact/update_moment_rule', {
|
|
122
|
+
rule_id: ruleId,
|
|
123
|
+
...rule
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 删除朋友圈规则组
|
|
129
|
+
* @param {string} ruleId 规则组 ID
|
|
130
|
+
*/
|
|
131
|
+
async deleteMomentRule(ruleId) {
|
|
132
|
+
return this.post('/externalcontact/del_moment_rule', { rule_id: ruleId });
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ========== 朋友圈素材管理 ==========
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 获取朋友圈素材列表
|
|
139
|
+
* @param {string} type 素材类型: image, video
|
|
140
|
+
* @param {number} offset 偏移量
|
|
141
|
+
* @param {number} size 每页数量
|
|
142
|
+
*/
|
|
143
|
+
async getMomentMediaList(type = 'image', offset = 0, size = 100) {
|
|
144
|
+
return this.post('/externalcontact/get_moment_media_list', {
|
|
145
|
+
type,
|
|
146
|
+
offset,
|
|
147
|
+
limit: size
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 上传朋友圈素材
|
|
153
|
+
* @param {string} filePath 文件路径
|
|
154
|
+
* @param {string} type 素材类型: image, video
|
|
155
|
+
*/
|
|
156
|
+
async uploadMomentMedia(filePath, type = 'image') {
|
|
157
|
+
return this.uploadFile(filePath, 'media', { type });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
module.exports = Moments;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const WeComSDK = require("../../sdk");
|
|
2
|
+
|
|
3
|
+
class Msgaudit extends WeComSDK {
|
|
4
|
+
/** 获取会话内容存档开启成员列表 */
|
|
5
|
+
async getPermitUserList() {
|
|
6
|
+
return this.post("/msgaudit/get_permit_user_list", {});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** 获取会话内容存档 */
|
|
10
|
+
async getChatData(chatIdList, seq, limit) {
|
|
11
|
+
return this.post("/msgaudit/chatrecord/get", {
|
|
12
|
+
chat_id_list: chatIdList,
|
|
13
|
+
seq: seq !== undefined ? seq : 0,
|
|
14
|
+
limit: limit || 100
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** 获取客户同意进行聊天内容存档的情况 */
|
|
19
|
+
async checkSingleAgree(userids) {
|
|
20
|
+
return this.post("/msgaudit/check_single_agree", { userid_list: userids });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = Msgaudit;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 紧急通知模块
|
|
3
|
+
* API 章节:二十七 - 紧急通知应用
|
|
4
|
+
* 包含:发起语音电话、获取接听状态
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const WeComSDK = require('../../sdk');
|
|
8
|
+
|
|
9
|
+
class Notify extends WeComSDK {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 发起语音电话
|
|
16
|
+
* @param {string} userId 成员 ID
|
|
17
|
+
* @param {string[]} toUsers 被通知成员列表
|
|
18
|
+
* @param {string} prompt 提示音类型: greeting-欢迎提示音, notice-到期提醒
|
|
19
|
+
*/
|
|
20
|
+
async sendVoiceCall(userId, toUsers, prompt = 'notice') {
|
|
21
|
+
return this.post('/ instantservice/voicenotify', {
|
|
22
|
+
userid: userId,
|
|
23
|
+
to_user: toUsers,
|
|
24
|
+
prompt
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 批量发起语音电话
|
|
30
|
+
* @param {string} userId 成员 ID
|
|
31
|
+
* @param {string[]} toUsers 被通知成员列表
|
|
32
|
+
* @param {string} prompt 提示音类型
|
|
33
|
+
*/
|
|
34
|
+
async batchSendVoiceCall(userId, toUsers, prompt = 'notice') {
|
|
35
|
+
return this.sendVoiceCall(userId, toUsers, prompt);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 获取语音通知状态
|
|
40
|
+
* @param {string} notifyId 通知 ID
|
|
41
|
+
*/
|
|
42
|
+
async getVoiceNotifyStatus(notifyId) {
|
|
43
|
+
return this.post('/ instantservice/voiceNotify/status', { notify_id: notifyId });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ========== 企业提醒通知 ==========
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 发送企业提醒
|
|
50
|
+
* @param {string} userId 成员 ID
|
|
51
|
+
* @param {string} content 提醒内容
|
|
52
|
+
* @param {string[]} toUsers 通知成员列表
|
|
53
|
+
*/
|
|
54
|
+
async sendCorpReminder(userId, content, toUsers) {
|
|
55
|
+
return this.post('/ instantservice/corp_reminder', {
|
|
56
|
+
userid: userId,
|
|
57
|
+
content,
|
|
58
|
+
to_users: toUsers
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ========== 工作通知提醒 ==========
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 发送工作通知提醒
|
|
66
|
+
* @param {string} userId 成员 ID
|
|
67
|
+
* @param {string} content 提醒内容
|
|
68
|
+
* @param {string[]} toUsers 通知成员列表
|
|
69
|
+
* @param {number} agentId 应用 ID
|
|
70
|
+
*/
|
|
71
|
+
async sendWorkNoticeReminder(userId, content, toUsers, agentId) {
|
|
72
|
+
return this.post('/ instantservice/worknotice_reminder', {
|
|
73
|
+
userid: userId,
|
|
74
|
+
content,
|
|
75
|
+
to_users: toUsers,
|
|
76
|
+
agentid: agentId
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = Notify;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获客助手模块
|
|
3
|
+
* API 章节:十三 - 获客助手
|
|
4
|
+
* 包含:获客链接管理、额度管理、广告优化等
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const WeComSDK = require('../../sdk');
|
|
8
|
+
|
|
9
|
+
class OceanEngine extends WeComSDK {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ========== 获客链接管理 ==========
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 创建获客链接
|
|
18
|
+
* @param {string} name 链接名称
|
|
19
|
+
* @param {string} intro 链接简介
|
|
20
|
+
* @param {string} userId 成员 ID
|
|
21
|
+
* @param {string} type 链接类型: 1-联系我 2-加入群聊
|
|
22
|
+
* @param {string} contentId 联系我或群聊 ID
|
|
23
|
+
*/
|
|
24
|
+
async createAcquisitionLink(name, intro, userId, type = 1, contentId) {
|
|
25
|
+
return this.post('/externalcontact/acquisition/link/add', {
|
|
26
|
+
name,
|
|
27
|
+
intro,
|
|
28
|
+
user_id: userId,
|
|
29
|
+
type,
|
|
30
|
+
content_id: contentId
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 获取获客链接列表
|
|
36
|
+
* @param {number} offset 偏移量
|
|
37
|
+
* @param {number} size 每页数量
|
|
38
|
+
*/
|
|
39
|
+
getAcquisitionLinkList(offset = 0, size = 100) {
|
|
40
|
+
return this.post('/externalcontact/acquisition/link/list', {
|
|
41
|
+
offset,
|
|
42
|
+
limit: size
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 获取获客链接详情
|
|
48
|
+
* @param {string} linkId 链接 ID
|
|
49
|
+
*/
|
|
50
|
+
getAcquisitionLinkDetail(linkId) {
|
|
51
|
+
return this.post('/externalcontact/acquisition/link/get', {
|
|
52
|
+
link_id: linkId
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 更新获客链接
|
|
58
|
+
* @param {string} linkId 链接 ID
|
|
59
|
+
* @param {object} params 更新参数
|
|
60
|
+
*/
|
|
61
|
+
updateAcquisitionLink(linkId, { name, intro, state }) {
|
|
62
|
+
return this.post('/externalcontact/acquisition/link/update', {
|
|
63
|
+
link_id: linkId,
|
|
64
|
+
name,
|
|
65
|
+
intro,
|
|
66
|
+
state
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 删除获客链接
|
|
72
|
+
* @param {string} linkId 链接 ID
|
|
73
|
+
*/
|
|
74
|
+
deleteAcquisitionLink(linkId) {
|
|
75
|
+
return this.post('/externalcontact/acquisition/link/del', {
|
|
76
|
+
link_id: linkId
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ========== 获客助手额度管理 ==========
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 获取成员收客链接收客总数
|
|
84
|
+
* @param {string} userId 成员 ID
|
|
85
|
+
* @param {string} linkId 链接 ID
|
|
86
|
+
* @param {number} startTime 开始时间戳
|
|
87
|
+
* @param {number} endTime 结束时间戳
|
|
88
|
+
*/
|
|
89
|
+
async getLinkCustomerCnt(userId, linkId, startTime, endTime) {
|
|
90
|
+
return this.post('/externalcontact/acquisition/link/get_customer_cnt', {
|
|
91
|
+
user_id: userId,
|
|
92
|
+
link_id: linkId,
|
|
93
|
+
start_time: startTime,
|
|
94
|
+
end_time: endTime
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 获取企业获客链接总收客数
|
|
100
|
+
* @param {number} startTime 开始时间戳
|
|
101
|
+
* @param {number} endTime 结束时间戳
|
|
102
|
+
*/
|
|
103
|
+
async getCorpCustomerCnt(startTime, endTime) {
|
|
104
|
+
return this.post('/externalcontact/acquisition/get_customer_cnt', {
|
|
105
|
+
start_time: startTime,
|
|
106
|
+
end_time: endTime
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 获取成员获客统计
|
|
112
|
+
* @param {string} userId 成员 ID
|
|
113
|
+
* @param {number} startTime 开始时间戳
|
|
114
|
+
* @param {number} endTime 结束时间戳
|
|
115
|
+
*/
|
|
116
|
+
async getUserAcquisitionStat(userId, startTime, endTime) {
|
|
117
|
+
return this.post('/externalcontact/acquisition/user/stat', {
|
|
118
|
+
user_id: userId,
|
|
119
|
+
start_time: startTime,
|
|
120
|
+
end_time: endTime
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 获取获客链接统计
|
|
126
|
+
* @param {string} linkId 链接 ID
|
|
127
|
+
* @param {number} startTime 开始时间戳
|
|
128
|
+
* @param {number} endTime 结束时间戳
|
|
129
|
+
*/
|
|
130
|
+
async getLinkStat(linkId, startTime, endTime) {
|
|
131
|
+
return this.post('/externalcontact/acquisition/link/stat', {
|
|
132
|
+
link_id: linkId,
|
|
133
|
+
start_time: startTime,
|
|
134
|
+
end_time: endTime
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ========== 获客助手事件 ==========
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 获取由获客链接添加的客户信息
|
|
142
|
+
* @param {string} linkId 链接 ID
|
|
143
|
+
* @param {string} userId 成员 ID
|
|
144
|
+
* @param {string} cursor 分页游标
|
|
145
|
+
*/
|
|
146
|
+
async getLinkCustomers(linkId, userId, cursor = '') {
|
|
147
|
+
return this.post('/externalcontact/acquisition/link/get_customer', {
|
|
148
|
+
link_id: linkId,
|
|
149
|
+
user_id: userId,
|
|
150
|
+
cursor
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ========== 广告优化 ==========
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 提升广告有效率
|
|
158
|
+
* @param {string} userId 成员 ID
|
|
159
|
+
* @param {string} externalUserId 外部客户 ID
|
|
160
|
+
*/
|
|
161
|
+
async improveAdEffect(userId, externalUserId) {
|
|
162
|
+
return this.post('/externalcontact/acquisition/ad/improve', {
|
|
163
|
+
user_id: userId,
|
|
164
|
+
external_userid: externalUserId
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 获取广告获客分析
|
|
170
|
+
* @param {number} startTime 开始时间戳
|
|
171
|
+
* @param {number} endTime 结束时间戳
|
|
172
|
+
* @param {string} userId 成员 ID(可选)
|
|
173
|
+
*/
|
|
174
|
+
async getAdAnalysis(startTime, endTime, userId = '') {
|
|
175
|
+
return this.post('/externalcontact/acquisition/ad/analysis', {
|
|
176
|
+
start_time: startTime,
|
|
177
|
+
end_time: endTime,
|
|
178
|
+
user_id: userId
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ========== 成员收客详情 ==========
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* 获取成员多次收消息详情
|
|
186
|
+
* @param {string} userId 成员 ID
|
|
187
|
+
* @param {string} cursor 分页游标
|
|
188
|
+
* @param {number} size 每页数量
|
|
189
|
+
*/
|
|
190
|
+
async getUserMultiReceiveStat(userId, cursor = '', size = 100) {
|
|
191
|
+
return this.post('/externalcontact/acquisition/user/get_multi_recv_stat', {
|
|
192
|
+
user_id: userId,
|
|
193
|
+
cursor,
|
|
194
|
+
limit: size
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
module.exports = OceanEngine;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 智能表格群聊模块
|
|
3
|
+
* API 章节:八 - 智能表格自动化创建的群聊
|
|
4
|
+
* 包含:获取群聊列表、群聊详情、修改群聊
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const WeComSDK = require('../../sdk');
|
|
8
|
+
|
|
9
|
+
class OpenChat extends WeComSDK {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ========== 群聊管理 ==========
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 获取群聊列表
|
|
18
|
+
* @param {string} cursor 分页游标
|
|
19
|
+
* @param {number} size 每页数量
|
|
20
|
+
*/
|
|
21
|
+
async getChatList(cursor = '', size = 100) {
|
|
22
|
+
return this.post('/openchat/list', { cursor, limit: size });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 获取群聊详情
|
|
27
|
+
* @param {string} openChatId 群聊 ID
|
|
28
|
+
*/
|
|
29
|
+
async getChatDetail(openChatId) {
|
|
30
|
+
return this.post('/openchat/get', { open_chatid: openChatId });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 修改群聊(智能表格)
|
|
35
|
+
* @param {string} openChatId 群聊 ID
|
|
36
|
+
* @param {string} name 群名称
|
|
37
|
+
* @param {string} owner 群主
|
|
38
|
+
* @param {string} ownerType 群主类型: userid, open_userid
|
|
39
|
+
*/
|
|
40
|
+
async updateChat(openChatId, { name, owner, ownerType }) {
|
|
41
|
+
return this.post('/openchat/update', {
|
|
42
|
+
open_chatid: openChatId,
|
|
43
|
+
name,
|
|
44
|
+
owner,
|
|
45
|
+
owner_type: ownerType
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 解散群聊
|
|
51
|
+
* @param {string} openChatId 群聊 ID
|
|
52
|
+
*/
|
|
53
|
+
async dismissChat(openChatId) {
|
|
54
|
+
return this.post('/openchat/dismiss', { open_chatid: openChatId });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ========== 群成员管理 ==========
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 获取群成员列表
|
|
61
|
+
* @param {string} openChatId 群聊 ID
|
|
62
|
+
* @param {string} cursor 分页游标
|
|
63
|
+
* @param {number} size 每页数量
|
|
64
|
+
*/
|
|
65
|
+
async getMemberList(openChatId, cursor = '', size = 100) {
|
|
66
|
+
return this.post('/openchat/member/list', {
|
|
67
|
+
open_chatid: openChatId,
|
|
68
|
+
cursor,
|
|
69
|
+
limit: size
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 添加群成员
|
|
75
|
+
* @param {string} openChatId 群聊 ID
|
|
76
|
+
* @param {string[]} userIds 成员 ID 列表
|
|
77
|
+
*/
|
|
78
|
+
async addMembers(openChatId, userIds) {
|
|
79
|
+
return this.post('/openchat/member/add', {
|
|
80
|
+
open_chatid: openChatId,
|
|
81
|
+
user_ids: userIds
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 移除群成员
|
|
87
|
+
* @param {string} openChatId 群聊 ID
|
|
88
|
+
* @param {string[]} userIds 成员 ID 列表
|
|
89
|
+
*/
|
|
90
|
+
async removeMembers(openChatId, userIds) {
|
|
91
|
+
return this.post('/openchat/member/del', {
|
|
92
|
+
open_chatid: openChatId,
|
|
93
|
+
user_ids: userIds
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ========== 群管理员管理 ==========
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 设置群管理员
|
|
101
|
+
* @param {string} openChatId 群聊 ID
|
|
102
|
+
* @param {string} userId 成员 ID
|
|
103
|
+
*/
|
|
104
|
+
async setAdmin(openChatId, userId) {
|
|
105
|
+
return this.post('/openchat/set_admin', {
|
|
106
|
+
open_chatid: openChatId,
|
|
107
|
+
userid: userId
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 取消群管理员
|
|
113
|
+
* @param {string} openChatId 群聊 ID
|
|
114
|
+
* @param {string} userId 成员 ID
|
|
115
|
+
*/
|
|
116
|
+
async removeAdmin(openChatId, userId) {
|
|
117
|
+
return this.post('/openchat/del_admin', {
|
|
118
|
+
open_chatid: openChatId,
|
|
119
|
+
userid: userId
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ========== 群公告管理 ==========
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 设置群公告
|
|
127
|
+
* @param {string} openChatId 群聊 ID
|
|
128
|
+
* @param {string} content 公告内容
|
|
129
|
+
*/
|
|
130
|
+
async setAnnouncement(openChatId, content) {
|
|
131
|
+
return this.post('/openchat/set_announcement', {
|
|
132
|
+
open_chatid: openChatId,
|
|
133
|
+
content
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 获取群公告
|
|
139
|
+
* @param {string} openChatId 群聊 ID
|
|
140
|
+
*/
|
|
141
|
+
async getAnnouncement(openChatId) {
|
|
142
|
+
return this.post('/openchat/get_announcement', { open_chatid: openChatId });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ========== 群标签管理 ==========
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 设置群标签
|
|
149
|
+
* @param {string} openChatId 群聊 ID
|
|
150
|
+
* @param {string[]} tagIds 标签 ID 列表
|
|
151
|
+
*/
|
|
152
|
+
async setTags(openChatId, tagIds) {
|
|
153
|
+
return this.post('/openchat/set_tag', {
|
|
154
|
+
open_chatid: openChatId,
|
|
155
|
+
tag_ids: tagIds
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 移除群标签
|
|
161
|
+
* @param {string} openChatId 群聊 ID
|
|
162
|
+
* @param {string[]} tagIds 标签 ID 列表
|
|
163
|
+
*/
|
|
164
|
+
async removeTags(openChatId, tagIds) {
|
|
165
|
+
return this.post('/openchat/del_tag', {
|
|
166
|
+
open_chatid: openChatId,
|
|
167
|
+
tag_ids: tagIds
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ========== 群发消息 ==========
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 发送消息到群聊
|
|
175
|
+
* @param {string} openChatId 群聊 ID
|
|
176
|
+
* @param {object} content 消息内容
|
|
177
|
+
* @param {string} msgType 消息类型
|
|
178
|
+
*/
|
|
179
|
+
async sendMessage(openChatId, content, msgType = 'text') {
|
|
180
|
+
return this.post('/openchat/send', {
|
|
181
|
+
open_chatid: openChatId,
|
|
182
|
+
msgtype: msgType,
|
|
183
|
+
[msgType]: content
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 发送模板卡片消息
|
|
189
|
+
* @param {string} openChatId 群聊 ID
|
|
190
|
+
* @param {object} cardData 卡片数据
|
|
191
|
+
*/
|
|
192
|
+
async sendTemplateCard(openChatId, cardData) {
|
|
193
|
+
return this.sendMessage(openChatId, cardData, 'template_card');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
module.exports = OpenChat;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 公费电话模块
|
|
3
|
+
* API 章节:二十 - 公费电话
|
|
4
|
+
* 包含:拨打记录
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const WeComSDK = require('../../sdk');
|
|
8
|
+
|
|
9
|
+
class Phone extends WeComSDK {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super(config);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 获取公费电话拨打记录
|
|
16
|
+
* @param {number} startTime 开始时间戳
|
|
17
|
+
* @param {number} endTime 结束时间戳
|
|
18
|
+
* @param {string} userId 成员 ID(可选)
|
|
19
|
+
* @param {number} offset 偏移量
|
|
20
|
+
* @param {number} size 每页数量
|
|
21
|
+
*/
|
|
22
|
+
async getDialRecord(startTime, endTime, userId = '', offset = 0, size = 100) {
|
|
23
|
+
return this.post('/Dial/get_dial_record', {
|
|
24
|
+
start_time: startTime,
|
|
25
|
+
end_time: endTime,
|
|
26
|
+
userid: userId,
|
|
27
|
+
offset,
|
|
28
|
+
limit: size
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 获取公费电话分钟数使用情况
|
|
34
|
+
* @param {number} startTime 开始时间戳
|
|
35
|
+
* @param {number} endTime 结束时间戳
|
|
36
|
+
*/
|
|
37
|
+
async getUsageStat(startTime, endTime) {
|
|
38
|
+
return this.post('/Dial/get_usage_stat', {
|
|
39
|
+
start_time: startTime,
|
|
40
|
+
end_time: endTime
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = Phone;
|