dingtalk-mcp 1.0.12 → 1.0.14

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.
@@ -0,0 +1,76 @@
1
+ server:
2
+ name: dingtalk-checkin
3
+ description: 钉钉签到
4
+ tools:
5
+ - name: getDepartmentCheckinRecords
6
+ description: 获取部门用户签到记录,以部门维度获取员工签到记录进行统计分析
7
+ requestTemplate:
8
+ method: GET
9
+ url: https://oapi.dingtalk.com/checkin/record
10
+ headers: []
11
+ args:
12
+ - name: department_id
13
+ type: string
14
+ required: true
15
+ position: query
16
+ description: 部门ID,1表示根部门,可通过获取部门列表接口获取dept_id参数值
17
+ - name: start_time
18
+ type: number
19
+ required: true
20
+ position: query
21
+ description: 开始时间,Unix时间戳,单位毫秒
22
+ - name: end_time
23
+ type: number
24
+ required: true
25
+ position: query
26
+ description: 结束时间,Unix时间戳,单位毫秒。开始时间和结束时间的间隔不能大于45天
27
+ - name: offset
28
+ type: number
29
+ required: false
30
+ position: query
31
+ description: 支持分页查询,与size参数同时设置时才生效,此参数代表偏移量,从0开始,默认为0
32
+ - name: size
33
+ type: number
34
+ required: false
35
+ position: query
36
+ description: 支持分页查询,与offset参数同时设置时才生效,此参数代表分页大小,最大100,默认为100
37
+ - name: order
38
+ type: string
39
+ required: false
40
+ position: query
41
+ description: 排序方式,asc为正序,desc为倒序,默认为asc
42
+
43
+ - name: getUserCheckinRecords
44
+ description: 获取指定用户的签到记录,可获取指定人员的签到记录进行统计分析
45
+ requestTemplate:
46
+ method: POST
47
+ url: https://oapi.dingtalk.com/topapi/checkin/record/get
48
+ headers:
49
+ - key: Content-Type
50
+ value: application/json
51
+ args:
52
+ - name: userid_list
53
+ type: string
54
+ required: true
55
+ position: body
56
+ description: 需要查询的用户列表,最大列表长度为10,多个用户用逗号分隔
57
+ - name: start_time
58
+ type: number
59
+ required: true
60
+ position: body
61
+ description: 开始时间,Unix时间戳,单位毫秒
62
+ - name: end_time
63
+ type: number
64
+ required: true
65
+ position: body
66
+ description: 截止时间,单位毫秒。如果是取1个人的数据,时间范围最大10天;如果是取多个人的数据,时间范围最大1天
67
+ - name: cursor
68
+ type: number
69
+ required: true
70
+ position: body
71
+ description: 分页查询的游标,最开始可以传0
72
+ - name: size
73
+ type: number
74
+ required: true
75
+ position: body
76
+ description: 分页查询的每页大小,最大100
@@ -95,4 +95,21 @@ tools:
95
95
  value: application/json
96
96
  security:
97
97
  id: DingTalkAuth
98
- responseTemplate: { }
98
+ responseTemplate: { }
99
+ - name: getDepartmentUsersByDepId
100
+ description: 获取指定部门下的所有成员的userId。
101
+ args:
102
+ - name: dept_id
103
+ description: 部门ID
104
+ type: number
105
+ required: true
106
+ position: body
107
+ requestTemplate:
108
+ url: https://oapi.dingtalk.com/topapi/user/listid
109
+ method: POST
110
+ headers:
111
+ - key: Content-Type
112
+ value: application/json
113
+ security:
114
+ id: DingTalkAuth
115
+ responseTemplate: { }
@@ -0,0 +1,95 @@
1
+ server:
2
+ name: dingtalk-department
3
+ description: 钉钉部门管理
4
+ tools:
5
+ - name: getDepartmentDetail
6
+ description: 获取指定部门的详细信息,包括部门名称、父部门、管理员、权限设置等完整信息
7
+ requestTemplate:
8
+ method: POST
9
+ url: https://oapi.dingtalk.com/topapi/v2/department/get
10
+ args:
11
+ - name: dept_id
12
+ type: number
13
+ required: true
14
+ position: body
15
+ description: 部门ID,根部门ID为1
16
+ - name: language
17
+ type: string
18
+ required: false
19
+ position: body
20
+ description: 通讯录语言,zh_CN(中文)或en_US(英文),默认zh_CN
21
+
22
+ - name: searchDepartment
23
+ description: 根据部门名称搜索部门ID,支持部门名称或拼音搜索
24
+ requestTemplate:
25
+ method: POST
26
+ url: https://api.dingtalk.com/v1.0/contact/departments/search
27
+ args:
28
+ - name: queryWord
29
+ type: string
30
+ required: true
31
+ position: body
32
+ description: 部门名称或者部门名称拼音
33
+ - name: offset
34
+ type: number
35
+ required: false
36
+ position: body
37
+ description: 分页页码,默认0
38
+ - name: size
39
+ type: number
40
+ required: false
41
+ position: body
42
+ description: 分页大小,默认10,最大100
43
+
44
+ - name: listSubDepartments
45
+ description: 获取指定部门的下一级子部门基础信息列表
46
+ requestTemplate:
47
+ method: POST
48
+ url: https://oapi.dingtalk.com/topapi/v2/department/listsub
49
+ args:
50
+ - name: dept_id
51
+ type: number
52
+ required: false
53
+ position: body
54
+ description: 父部门ID,不传则获取根部门的子部门,根部门ID为1
55
+ - name: language
56
+ type: string
57
+ required: false
58
+ position: body
59
+ description: 通讯录语言,zh_CN(中文)或en_US(英文),默认zh_CN
60
+
61
+ - name: listSubDepartmentIds
62
+ description: 获取指定部门下的所有直属子部门ID列表
63
+ requestTemplate:
64
+ method: POST
65
+ url: https://oapi.dingtalk.com/topapi/v2/department/listsubid
66
+ args:
67
+ - name: dept_id
68
+ type: number
69
+ required: true
70
+ position: body
71
+ description: 父部门ID,根部门传1
72
+
73
+ - name: getDepartmentParents
74
+ description: 获取指定部门的所有父部门ID列表,从当前部门到根部门的完整路径
75
+ requestTemplate:
76
+ method: POST
77
+ url: https://oapi.dingtalk.com/topapi/v2/department/listparentbydept
78
+ args:
79
+ - name: dept_id
80
+ type: number
81
+ required: true
82
+ position: body
83
+ description: 要查询的部门ID
84
+
85
+ - name: getUserDepartmentParents
86
+ description: 获取指定用户所属的所有父级部门路径,返回用户所有部门归属的层级结构
87
+ requestTemplate:
88
+ method: POST
89
+ url: https://oapi.dingtalk.com/topapi/v2/department/listparentbyuser
90
+ args:
91
+ - name: userid
92
+ type: string
93
+ required: true
94
+ position: body
95
+ description: 要查询的用户的userid
@@ -0,0 +1,174 @@
1
+ server:
2
+ name: dingtalk-honor
3
+ version: 1.0.0
4
+ description: DingTalk Honor Management MCP Server - 钉钉企业文化荣誉管理服务
5
+
6
+ tools:
7
+ # 1. 给员工颁发荣誉
8
+ - name: mcp_dingtalk-honor_grantHonor
9
+ description: |
10
+ 给组织内的员工颁发荣誉,支持单人或多人批量颁发。
11
+ 颁发后员工会收到荣誉推送消息,可以选择佩戴荣誉挂件。
12
+ 注意:同一个颁发人不允许并发执行,需要串行调用。
13
+ requestTemplate:
14
+ method: POST
15
+ url: "https://api.dingtalk.com/v1.0/orgCulture/honors/{honorId}/grant"
16
+ args:
17
+ - name: honorId
18
+ type: string
19
+ description: "荣誉ID,可通过查询企业荣誉列表接口获取"
20
+ position: path
21
+ required: true
22
+ - name: senderUserId
23
+ type: string
24
+ description: "发送人userId。注意:同一个发送人给多个员工颁发荣誉时,请分别按顺序执行,不允许并发执行"
25
+ position: body
26
+ required: true
27
+ - name: grantReason
28
+ type: string
29
+ description: "颁奖词,最多50个字符"
30
+ position: body
31
+ required: true
32
+ - name: granterName
33
+ type: string
34
+ description: "颁奖人名字,最多15个字符"
35
+ position: body
36
+ required: true
37
+ - name: receiverUserIds
38
+ type: array
39
+ description: "接收人userId列表,最多10个"
40
+ position: body
41
+ required: true
42
+ items:
43
+ type: string
44
+ - name: expirationTime
45
+ type: number
46
+ description: "荣誉有效期到期时间戳(毫秒)。不传代表永久有效。有效期时间范围要求1~366天后"
47
+ position: body
48
+ required: false
49
+ - name: noticeSingle
50
+ type: boolean
51
+ description: "是否发送单聊通知。true:发送,false:不发送"
52
+ position: body
53
+ required: false
54
+ - name: noticeAnnouncer
55
+ type: boolean
56
+ description: "是否使用官宣号通知获奖人。true:通知,false:不通知"
57
+ position: body
58
+ required: false
59
+ - name: openConversationIds
60
+ type: array
61
+ description: "接收荣誉消息的群openConversationId列表,最多5个。注意:发送人必须是群成员"
62
+ position: body
63
+ required: false
64
+ items:
65
+ type: string
66
+
67
+ # 2. 查询当前企业下可颁发的荣誉列表
68
+ - name: mcp_dingtalk-honor_queryOrgHonors
69
+ description: |
70
+ 查询当前企业下可颁发的荣誉列表,包括荣誉ID、名称、描述、图标等信息。
71
+ 支持分页查询,可用于展示荣誉选择列表。
72
+ requestTemplate:
73
+ method: GET
74
+ url: "https://api.dingtalk.com/v1.0/orgCulture/organizations/honors?nextToken=String&maxResults=Integer"
75
+ args:
76
+ - name: nextToken
77
+ type: string
78
+ description: "分页游标。首次调用传0,非首次调用传上次返回的nextToken值"
79
+ position: query
80
+ required: true
81
+ - name: maxResults
82
+ type: number
83
+ description: "每页最大条目数,默认值20,最大值100"
84
+ position: query
85
+ required: false
86
+
87
+ # 3. 查询员工已获得的组织荣誉
88
+ - name: mcp_dingtalk-honor_queryUserHonors
89
+ description: |
90
+ 查询某个员工获得的组织荣誉记录,包括荣誉ID、名称、授予时间、发放人等信息。
91
+ 可用于展示员工的荣誉墙或荣誉历史。
92
+ requestTemplate:
93
+ method: GET
94
+ url: "https://api.dingtalk.com/v1.0/orgCulture/honors/users/{userId}?nextToken=String&maxResults=Integer"
95
+ args:
96
+ - name: userId
97
+ type: string
98
+ description: "要查询的员工userId"
99
+ position: path
100
+ required: true
101
+ - name: nextToken
102
+ type: string
103
+ description: "分页游标。首次查询传0,非首次查询传上次返回的nextToken"
104
+ position: query
105
+ required: true
106
+ - name: maxResults
107
+ type: number
108
+ description: "每页返回的最大条目数,默认20,最大100"
109
+ position: query
110
+ required: false
111
+
112
+ # 4. 创建荣誉勋章模板
113
+ - name: mcp_dingtalk-honor_createOrgHonor
114
+ description: |
115
+ 创建企业荣誉勋章模板。创建后会流入钉钉后台审核,一般5个工作日内审核完毕。
116
+ 注意事项:
117
+ 1. 需要主管理员或子管理员权限
118
+ 2. 企业每周的审核次数有限制(标准版每周10次/专业版每周20次)
119
+ 3. 不允许并发调用,如需批量创建请串行执行
120
+ 4. 图片需要先调用上传媒体文件接口获取media_id
121
+ requestTemplate:
122
+ method: POST
123
+ url: "https://api.dingtalk.com/v1.0/orgCulture/honors/templates"
124
+ args:
125
+ - name: userId
126
+ type: string
127
+ description: "创建荣誉勋章模板的管理员userId,需要主管理员或子管理员角色"
128
+ position: body
129
+ required: true
130
+ - name: medalName
131
+ type: string
132
+ description: "荣誉勋章名称,最大长度10字符,不支持表情图标"
133
+ position: body
134
+ required: true
135
+ - name: medalDesc
136
+ type: string
137
+ description: "荣誉勋章描述,最大长度30字符,不支持表情图标"
138
+ position: body
139
+ required: true
140
+ - name: medalMediaId
141
+ type: string
142
+ description: "荣誉勋章图片的media_id(900x900,不超过1M,PNG格式)"
143
+ position: body
144
+ required: true
145
+ - name: avatarFrameMediaId
146
+ type: string
147
+ description: "头像挂件图片的media_id(240x240,不超过1M,PNG格式)"
148
+ position: body
149
+ required: true
150
+ - name: defaultBgColor
151
+ type: string
152
+ description: "背景颜色,可选值:#FFFBB4, #FFE7BC, #FFDAF4, #DAF6A8, #E4D7FF, #BFDFFF, #B9F2D6"
153
+ position: body
154
+ required: true
155
+
156
+ # 5. 撤销员工获得的荣誉勋章
157
+ - name: mcp_dingtalk-honor_recallHonor
158
+ description: |
159
+ 撤销员工已获得的荣誉勋章。
160
+ 撤销后员工将无法继续佩戴该荣誉。
161
+ requestTemplate:
162
+ method: POST
163
+ url: "https://api.dingtalk.com/v1.0/orgCulture/honors/{honorId}/recall"
164
+ args:
165
+ - name: honorId
166
+ type: string
167
+ description: "要撤销的荣誉勋章ID,可通过查询员工已获得的组织荣誉接口获取"
168
+ position: path
169
+ required: true
170
+ - name: userId
171
+ type: string
172
+ description: "要撤销荣誉的员工userId"
173
+ position: body
174
+ required: true
@@ -0,0 +1,85 @@
1
+ server:
2
+ name: dingtalk-notice
3
+ version: 1.0.0
4
+ description: DingTalk Work Notice MCP Server - 钉钉工作通知
5
+
6
+ tools:
7
+ # 发送工作通知消息
8
+ - name: sendNotice
9
+ description: 发送工作通知消息,支持3种消息类型:text、link、markdown
10
+ requestTemplate:
11
+ method: POST
12
+ url: https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2
13
+ args:
14
+ - name: userid_list
15
+ type: string
16
+ required: false
17
+ position: body
18
+ description: 接收人用户ID列表,用逗号分隔,最多5000人
19
+ - name: dept_id_list
20
+ type: string
21
+ required: false
22
+ position: body
23
+ description: 接收部门ID列表,用逗号分隔(可选)
24
+ - name: to_all_user
25
+ type: boolean
26
+ required: false
27
+ position: body
28
+ description: 是否发送给全员(可选,默认false)
29
+ - name: msg
30
+ type: object
31
+ required: true
32
+ position: body
33
+ description: 消息内容,支持text、link、markdown三种类型
34
+
35
+ # 获取工作通知消息的发送结果
36
+ - name: getSendResult
37
+ description: 获取工作通知消息的发送结果,查询消息发送状态和统计信息
38
+ requestTemplate:
39
+ method: POST
40
+ url: https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult
41
+ args:
42
+ - name: task_id
43
+ type: number
44
+ required: true
45
+ position: body
46
+ description: 发送任务ID(发送消息时返回的task_id)
47
+
48
+ # 获取工作通知消息的发送进度
49
+ - name: getSendProgress
50
+ description: 获取工作通知消息的发送进度,实时查询消息发送进度
51
+ requestTemplate:
52
+ method: POST
53
+ url: https://oapi.dingtalk.com/topapi/message/corpconversation/getsendprogress
54
+ args:
55
+ - name: task_id
56
+ type: number
57
+ required: true
58
+ position: body
59
+ description: 发送任务ID(发送消息时返回的task_id)
60
+
61
+ # 撤回工作通知消息
62
+ - name: recallNotice
63
+ description: 撤回已发送的工作通知消息,消息撤回后接收人将无法看到该消息
64
+ requestTemplate:
65
+ method: POST
66
+ url: https://oapi.dingtalk.com/topapi/message/corpconversation/recall
67
+ args:
68
+ - name: msg_task_id
69
+ type: number
70
+ required: true
71
+ position: body
72
+ description: 要撤回的消息任务ID
73
+
74
+ # 获取消息模板(内置功能)
75
+ - name: getMessageTemplates
76
+ description: 获取所有支持的消息类型模板和示例,帮助用户快速了解消息格式
77
+ requestTemplate:
78
+ method: LOCAL
79
+ url: local://templates
80
+ args:
81
+ - name: msgtype
82
+ type: string
83
+ required: false
84
+ position: query
85
+ description: 指定消息类型(text、link、markdown),不指定则返回所有类型
@@ -0,0 +1,109 @@
1
+ server:
2
+ name: dingtalk-servicewindow
3
+ version: 1.0.0
4
+ description: 钉钉服务窗
5
+ securitySchemes:
6
+ - id: DingTalkAuth
7
+ type: apiKey
8
+ in: header
9
+ name: x-acs-dingtalk-access-token
10
+
11
+ # 注意:当前版本的工具定义在代码中,此配置文件为预留扩展
12
+ tools:
13
+ - name: buildServiceWindowMessage
14
+ description: "构建服务窗消息体,支持文本、链接、markdown、卡片等多种类型"
15
+ requestTemplate:
16
+ method: POST
17
+ url: "internal://message-builder"
18
+
19
+ - name: sendServiceWindowMessage
20
+ description: "发送服务窗单人消息"
21
+ requestTemplate:
22
+ method: POST
23
+ url: "https://api.dingtalk.com/v1.0/crm/officialAccounts/oToMessages/send"
24
+ security:
25
+ id: DingTalkAuth
26
+
27
+ - name: batchSendServiceWindowMessage
28
+ description: "批量发送服务窗消息"
29
+ requestTemplate:
30
+ method: POST
31
+ url: "https://api.dingtalk.com/v1.0/crm/officialAccounts/oToMessages/batchSend"
32
+ security:
33
+ id: DingTalkAuth
34
+
35
+ - name: getServiceWindowFollower
36
+ description: "获取关注服务窗的单个用户信息"
37
+ requestTemplate:
38
+ method: GET
39
+ url: "https://api.dingtalk.com/v1.0/link/followers/infos"
40
+ security:
41
+ id: DingTalkAuth
42
+
43
+ - name: listServiceWindowFollowers
44
+ description: "分页获取关注服务窗的用户列表"
45
+ requestTemplate:
46
+ method: GET
47
+ url: "https://api.dingtalk.com/v1.0/link/followers"
48
+ security:
49
+ id: DingTalkAuth
50
+
51
+ - name: getUserFollowStatus
52
+ description: "获取用户的服务窗关注状态"
53
+ requestTemplate:
54
+ method: GET
55
+ url: "https://api.dingtalk.com/v1.0/link/followers/status"
56
+ security:
57
+ id: DingTalkAuth
58
+
59
+ - name: listServiceWindows
60
+ description: "获取企业下的服务窗列表"
61
+ requestTemplate:
62
+ method: GET
63
+ url: "https://api.dingtalk.com/v1.0/link/accounts"
64
+ security:
65
+ id: DingTalkAuth
66
+
67
+ # 消息类型定义
68
+ messageTypes:
69
+ text:
70
+ description: "纯文本消息"
71
+ maxLength: 500
72
+
73
+ link:
74
+ description: "链接消息"
75
+ fields:
76
+ title:
77
+ maxLength: 128
78
+ required: true
79
+ text:
80
+ maxLength: 500
81
+ required: true
82
+ messageUrl:
83
+ pattern: "^https?://.+"
84
+ required: true
85
+ picUrl:
86
+ required: true
87
+
88
+ markdown:
89
+ description: "Markdown格式消息"
90
+ fields:
91
+ title:
92
+ maxLength: 30
93
+ required: true
94
+ text:
95
+ maxLength: 500
96
+ required: true
97
+
98
+ actionCard:
99
+ description: "卡片消息"
100
+ fields:
101
+ title:
102
+ maxLength: 30
103
+ required: true
104
+ markdown:
105
+ maxLength: 1000
106
+ required: true
107
+ cardType:
108
+ enum: ["single", "independent"]
109
+ required: true
@@ -386,7 +386,7 @@ export class DingTalkMCPServer {
386
386
  'Content-Type': 'application/json'
387
387
  };
388
388
  // 只有对新版API (api.dingtalk.com) 才添加token到header
389
- if (tool.requestTemplate.url && !tool.requestTemplate.url.includes('oapi.dingtalk.com') && tool.requestTemplate.security && this.accessToken) {
389
+ if (tool.requestTemplate.url && !tool.requestTemplate.url.includes('oapi.dingtalk.com') && this.accessToken) {
390
390
  headers['x-acs-dingtalk-access-token'] = this.accessToken;
391
391
  }
392
392
  if (tool.requestTemplate.headers) {
package/dist/cli.js CHANGED
@@ -1,20 +1,67 @@
1
1
  #!/usr/bin/env node
2
2
  import { DingTalkMCPServer } from './DingTalkMCPServer.js';
3
3
  async function main() {
4
+ // 检查环境变量
5
+ const appId = process.env.DINGTALK_Client_ID;
6
+ const appSecret = process.env.DINGTALK_Client_Secret;
7
+ const accessToken = process.env.DINGTALK_ACCESS_TOKEN;
8
+ process.env.ACTIVE_PROFILES = 'dingtalk-contacts,dingtalk-department'
9
+ // 如果既没有AppKey/Secret也没有AccessToken,显示帮助信息
10
+ if (!accessToken && (!appId || !appSecret)) {
11
+ console.error('🔧 DingTalk MCP Server 配置指南');
12
+ console.error('');
13
+ console.error('📋 需要设置以下环境变量之一:');
14
+ console.error('');
15
+ console.error('方式1 - 使用AppKey/Secret(推荐):');
16
+ console.error(' DINGTALK_Client_ID=your_app_key');
17
+ console.error(' DINGTALK_Client_Secret=your_app_secret');
18
+ console.error('');
19
+ console.error('方式2 - 直接使用AccessToken(测试用):');
20
+ console.error(' DINGTALK_ACCESS_TOKEN=your_access_token');
21
+ console.error('');
22
+ console.error('🌐 获取应用信息:');
23
+ console.error(' 访问:https://open-dev.dingtalk.com/');
24
+ console.error(' 创建企业内部应用或服务窗应用');
25
+ console.error('');
26
+ console.error('📝 示例配置文件(.env):');
27
+ console.error(' DINGTALK_Client_ID=dingXXXXXXXX');
28
+ console.error(' DINGTALK_Client_Secret=XXXXXXXXXXXXX');
29
+ console.error('');
30
+ console.error('🚀 启动命令:');
31
+ console.error(' npx dingtalk-mcp');
32
+ console.error('');
33
+ process.exit(1);
34
+ }
4
35
  try {
5
- // process.env.DEBUG = true;
6
- // process.env.ACTIVE_PROFILES = "ALL";
7
- // process.env.ROBOT_CODE = "234234"
8
36
  const server = new DingTalkMCPServer();
37
+ console.error('🎯 DingTalk MCP Server 启动中...');
38
+ console.error('🔗 连接方式:stdio transport');
9
39
  await server.run();
40
+ console.error('🎯 DingTalk MCP Server 启动成功.');
10
41
  }
11
42
  catch (error) {
12
- console.error('Failed to start DingTalk MCP server:', error);
43
+ console.error(' 服务器启动失败:', error);
44
+ console.error('');
45
+ console.error('🔍 常见问题排查:');
46
+ console.error(' 1. 检查网络连接');
47
+ console.error(' 2. 验证AppKey/Secret是否正确');
48
+ console.error(' 3. 确认应用权限是否充足');
49
+ console.error(' 4. 查看详细错误信息');
50
+ console.error('');
13
51
  process.exit(1);
14
52
  }
15
53
  }
54
+ // 处理未捕获的异常
55
+ process.on('uncaughtException', (error) => {
56
+ console.error('❌ 未捕获的异常:', error);
57
+ process.exit(1);
58
+ });
59
+ process.on('unhandledRejection', (reason, promise) => {
60
+ console.error('❌ 未处理的Promise拒绝:', reason);
61
+ process.exit(1);
62
+ });
16
63
  main().catch(error => {
17
- console.error('Unexpected error:', error);
64
+ console.error(' 启动过程中发生错误:', error);
18
65
  process.exit(1);
19
66
  });
20
67
  //# sourceMappingURL=cli.js.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * API Client - 抽象DingTalk API调用
3
+ * 负责构建请求、发送API调用和处理响应
4
+ */
5
+ import { type AxiosResponse } from 'axios';
6
+ import type { DingTalkApiResponse } from '../types.js';
7
+ import type { ProcessedMessage } from './messageProcessor.js';
8
+ export interface ApiClientOptions {
9
+ baseURL?: string;
10
+ timeout?: number;
11
+ retries?: number;
12
+ }
13
+ export declare class ApiClient {
14
+ private readonly baseURL;
15
+ private readonly timeout;
16
+ private readonly retries;
17
+ constructor(options?: ApiClientOptions);
18
+ /**
19
+ * 发送单人消息
20
+ */
21
+ sendMessage(accessToken: string, message: ProcessedMessage, params: {
22
+ userId?: string;
23
+ unionId?: string;
24
+ bizId?: string;
25
+ accountId?: string;
26
+ }): Promise<AxiosResponse<DingTalkApiResponse>>;
27
+ /**
28
+ * 批量发送消息
29
+ */
30
+ batchSendMessage(accessToken: string, message: ProcessedMessage, params: {
31
+ userIdList?: string[];
32
+ sendToAll?: boolean;
33
+ bizRequestId?: string;
34
+ bizId?: string;
35
+ accountId?: string;
36
+ }): Promise<AxiosResponse<DingTalkApiResponse>>;
37
+ /**
38
+ * 通用请求方法
39
+ */
40
+ private makeRequest;
41
+ /**
42
+ * 获取access_token
43
+ */
44
+ getAccessToken(appId: string, appSecret: string): Promise<{
45
+ access_token: string;
46
+ expires_in: number;
47
+ }>;
48
+ }
49
+ //# sourceMappingURL=apiClient.d.ts.map