@wecom/wecom-openclaw-plugin 2026.3.25-beta.2 → 2026.3.25-beta.4

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.
@@ -1,641 +1,358 @@
1
- # 模板卡片类型 - 企业微信开发者文档
1
+ # 模板卡片类型 - JSON Schema 定义
2
2
 
3
- > 来源:https://developer.work.weixin.qq.com/document/path/101032
4
- > 最后更新:2026/02/06
3
+ > 来源:企业微信开发者文档 https://developer.work.weixin.qq.com/document/path/101032
4
+ > 格式:JSON Schema,所有字段名、类型、嵌套层级必须严格遵循
5
5
 
6
6
  ---
7
7
 
8
- ## 模版卡片类型
8
+ ## 公共结构体 Schema
9
9
 
10
- 该文档主要说明各种类型模板卡片 **TemplateCard结构体说明**。
10
+ 以下结构体在多种卡片类型中复用,**字段名必须完全一致**。
11
11
 
12
- > 其中,点击文本通知卡片以及图文通知卡片的"跳转指引"区域支持消息智能回复。
13
-
14
- ---
15
-
16
- ## 文本通知模版卡片 text_notice
17
-
18
- 完整文本通知模版卡片示例:
12
+ ### MainTitle
19
13
 
20
14
  ```json
21
15
  {
22
- "card_type": "text_notice",
23
- "source": {
24
- "icon_url": "https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0",
25
- "desc": "企业微信",
26
- "desc_color": 0
27
- },
28
- "action_menu": {
29
- "desc": "消息气泡副交互辅助文本说明",
30
- "action_list": [
31
- {
32
- "text": "接收推送",
33
- "key": "action_key1"
34
- },
35
- {
36
- "text": "不再推送",
37
- "key": "action_key2"
38
- }
39
- ]
40
- },
41
- "main_title": {
42
- "title": "欢迎使用企业微信",
43
- "desc": "您的好友正在邀请您加入企业微信"
44
- },
45
- "emphasis_content": {
46
- "title": "100",
47
- "desc": "数据含义"
48
- },
49
- "quote_area": {
50
- "type": 1,
51
- "url": "https://work.weixin.qq.com/?from=openApi",
52
- "appid": "APPID",
53
- "pagepath": "PAGEPATH",
54
- "title": "引用文本标题",
55
- "quote_text": "Jack:企业微信真的很好用~\nBalian:超级好的一款软件!"
56
- },
57
- "sub_title_text": "下载企业微信还能抢红包!",
58
- "horizontal_content_list": [
59
- {
60
- "keyname": "邀请人",
61
- "value": "张三"
62
- },
63
- {
64
- "keyname": "企微官网",
65
- "value": "点击访问",
66
- "type": 1,
67
- "url": "https://work.weixin.qq.com/?from=openApi"
68
- },
69
- {
70
- "keyname": "企微下载",
71
- "value": "企业微信.apk",
72
- "type": 1,
73
- "url": "https://work.weixin.qq.com/?from=openApi"
74
- }
75
- ],
76
- "jump_list": [
77
- {
78
- "type": 1,
79
- "url": "https://work.weixin.qq.com/?from=openApi",
80
- "title": "企业微信官网"
81
- },
82
- {
83
- "type": 2,
84
- "appid": "APPID",
85
- "pagepath": "PAGEPATH",
86
- "title": "跳转小程序"
87
- },
88
- {
89
- "type": 3,
90
- "title": "企业微信官网",
91
- "question": "如何登录企业微信官网"
92
- }
93
- ],
94
- "card_action": {
95
- "type": 1,
96
- "url": "https://work.weixin.qq.com/?from=openApi",
97
- "appid": "APPID",
98
- "pagepath": "PAGEPATH"
99
- },
100
- "task_id": "task_id"
16
+ "type": "object",
17
+ "properties": {
18
+ "title": { "type": "string", "description": "一级标题,建议不超过26字" },
19
+ "desc": { "type": "string", "description": "标题辅助信息,建议不超过30字" }
20
+ }
101
21
  }
102
22
  ```
103
23
 
104
- ### 请求参数
105
-
106
- | 参数 | 类型 | 必须 | 说明 |
107
- | --- | --- | --- | --- |
108
- | card_type | String | 是 | 模版卡片的模版类型,文本通知模版卡片的类型为 `text_notice` |
109
- | source | Object | 否 | 卡片来源样式信息,不需要来源样式可不填写。参考 **Source结构体说明** |
110
- | action_menu | Object | 否 | 卡片右上角更多操作按钮。参考 **ActionMenu结构体说明** |
111
- | main_title | Object | 否 | 模版卡片的主要内容,包括一级标题和标题辅助信息。参考 **MainTitle结构体说明** |
112
- | emphasis_content | Object | 否 | 关键数据样式,建议不与引用样式共用。参考 **EmphasisContent结构体说明** |
113
- | quote_area | Object | 否 | 引用文献样式,建议不与关键数据共用。参考 **QuoteArea结构体说明** |
114
- | sub_title_text | String | 否 | 二级普通文本,建议不超过112个字。**模版卡片主要内容的一级标题 main_title.title 和二级普通文本 sub_title_text 必须有一项填写** |
115
- | horizontal_content_list | Object[] | 否 | 二级标题+文本列表,列表长度不超过6。参考 **HorizontalContent结构体说明** |
116
- | jump_list | Object[] | 否 | 跳转指引样式的列表,列表长度不超过3。参考 **JumpAction结构体说明** |
117
- | card_action | Object | 是 | 整体卡片的点击跳转事件,text_notice 模版卡片中该字段为必填项。参考 **CardAction结构体说明** |
118
- | task_id | String | 否 | 任务id,当文本通知模版卡片有 action_menu 字段时该字段必填。同一个机器人任务id不能重复,只能由数字、字母和"_-@"组成,最长128字节。任务id只在发消息时有效,更新消息时无效。任务id将会在相应的回调事件中返回 |
119
-
120
- ---
121
-
122
- ## 图文展示模版卡片 news_notice
123
-
124
- 完整图文展示模版卡片示例:
24
+ ### Source
125
25
 
126
26
  ```json
127
27
  {
128
- "card_type": "news_notice",
129
- "source": {
130
- "icon_url": "https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0",
131
- "desc": "企业微信",
132
- "desc_color": 0
133
- },
134
- "action_menu": {
135
- "desc": "消息气泡副交互辅助文本说明",
136
- "action_list": [
137
- {
138
- "text": "接收推送",
139
- "key": "action_key1"
140
- },
141
- {
142
- "text": "不再推送",
143
- "key": "action_key2"
144
- }
145
- ]
146
- },
147
- "main_title": {
148
- "title": "欢迎使用企业微信",
149
- "desc": "您的好友正在邀请您加入企业微信"
150
- },
151
- "card_image": {
152
- "url": "https://wework.qpic.cn/wwpic/354393_4zpkKXd7SrGMvfg_1629280616/0",
153
- "aspect_ratio": 2.25
154
- },
155
- "image_text_area": {
156
- "type": 1,
157
- "url": "https://work.weixin.qq.com",
158
- "title": "欢迎使用企业微信",
159
- "desc": "您的好友正在邀请您加入企业微信",
160
- "image_url": "https://wework.qpic.cn/wwpic/354393_4zpkKXd7SrGMvfg_1629280616/0"
161
- },
162
- "quote_area": {
163
- "type": 1,
164
- "url": "https://work.weixin.qq.com/?from=openApi",
165
- "appid": "APPID",
166
- "pagepath": "PAGEPATH",
167
- "title": "引用文本标题",
168
- "quote_text": "Jack:企业微信真的很好用~\nBalian:超级好的一款软件!"
169
- },
170
- "vertical_content_list": [
171
- {
172
- "title": "惊喜红包等你来拿",
173
- "desc": "下载企业微信还能抢红包!"
174
- }
175
- ],
176
- "horizontal_content_list": [
177
- {
178
- "keyname": "邀请人",
179
- "value": "张三"
180
- },
181
- {
182
- "keyname": "企微官网",
183
- "value": "点击访问",
184
- "type": 1,
185
- "url": "https://work.weixin.qq.com/?from=openApi"
186
- },
187
- {
188
- "keyname": "企微下载",
189
- "value": "企业微信.apk",
190
- "type": 1,
191
- "url": "https://work.weixin.qq.com/?from=openApi"
192
- }
193
- ],
194
- "jump_list": [
195
- {
196
- "type": 1,
197
- "url": "https://work.weixin.qq.com/?from=openApi",
198
- "title": "企业微信官网"
199
- },
200
- {
201
- "type": 2,
202
- "appid": "APPID",
203
- "pagepath": "PAGEPATH",
204
- "title": "跳转小程序"
205
- },
206
- {
207
- "type": 3,
208
- "title": "企业微信官网",
209
- "question": "如何登录企业微信官网"
210
- }
211
- ],
212
- "card_action": {
213
- "type": 1,
214
- "url": "https://work.weixin.qq.com/?from=openApi",
215
- "appid": "APPID",
216
- "pagepath": "PAGEPATH"
217
- },
218
- "task_id": "task_id"
28
+ "type": "object",
29
+ "properties": {
30
+ "icon_url": { "type": "string", "description": "来源图片URL" },
31
+ "desc": { "type": "string", "description": "来源描述,建议不超过13字" },
32
+ "desc_color": { "type": "integer", "enum": [0, 1, 2, 3], "description": "来源文字颜色,只能是0(灰)、1(黑)、2(红)、3(绿)" }
33
+ }
219
34
  }
220
35
  ```
221
36
 
222
- ### 请求参数
223
-
224
- | 参数 | 类型 | 必须 | 说明 |
225
- | --- | --- | --- | --- |
226
- | card_type | String | 是 | 模版卡片的模版类型,图文展示模版卡片的类型为 `news_notice` |
227
- | source | Object | 否 | 卡片来源样式信息。参考 **Source结构体说明** |
228
- | action_menu | Object | 否 | 卡片右上角更多操作按钮。参考 **ActionMenu结构体说明** |
229
- | main_title | Object | 是 | 模版卡片的主要内容。参考 **MainTitle结构体说明** |
230
- | card_image | Object | 否 | 图片样式,news_notice 类型的卡片,card_image 和 image_text_area 两者必填一个。参考 **CardImage结构体说明** |
231
- | image_text_area | Object | 否 | 左图右文样式。参考 **ImageTextArea结构体说明** |
232
- | quote_area | Object | 否 | 引用文献样式。参考 **QuoteArea结构体说明** |
233
- | vertical_content_list | Object[] | 否 | 卡片二级垂直内容,列表长度不超过4。参考 **VerticalContent结构体说明** |
234
- | horizontal_content_list | Object[] | 否 | 二级标题+文本列表,列表长度不超过6。参考 **HorizontalContent结构体说明** |
235
- | jump_list | Object[] | 否 | 跳转指引样式的列表,列表长度不超过3。参考 **JumpAction结构体说明** |
236
- | card_action | Object | 是 | 整体卡片的点击跳转事件,news_notice 模版卡片中该字段为必填项。参考 **CardAction结构体说明** |
237
- | task_id | String | 否 | 任务id,当图文展示模版卡片有 action_menu 字段时该字段必填。同一个机器人任务id不能重复,只能由数字、字母和"_-@"组成,最长128字节 |
238
-
239
- ---
240
-
241
- ## 按钮交互模版卡片 button_interaction
242
-
243
- 完整按钮交互模版卡片示例:
37
+ ### CardAction
244
38
 
245
39
  ```json
246
40
  {
247
- "card_type": "button_interaction",
248
- "source": {
249
- "icon_url": "https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0",
250
- "desc": "企业微信",
251
- "desc_color": 0
252
- },
253
- "action_menu": {
254
- "desc": "消息气泡副交互辅助文本说明",
255
- "action_list": [
256
- {
257
- "text": "接收推送",
258
- "key": "action_key1"
259
- },
260
- {
261
- "text": "不再推送",
262
- "key": "action_key2"
263
- }
264
- ]
265
- },
266
- "main_title": {
267
- "title": "欢迎使用企业微信",
268
- "desc": "您的好友正在邀请您加入企业微信"
269
- },
270
- "quote_area": {
271
- "type": 1,
272
- "url": "https://work.weixin.qq.com/?from=openApi",
273
- "appid": "APPID",
274
- "pagepath": "PAGEPATH",
275
- "title": "引用文本标题",
276
- "quote_text": "Jack:企业微信真的很好用~\nBalian:超级好的一款软件!"
277
- },
278
- "sub_title_text": "下载企业微信还能抢红包!",
279
- "horizontal_content_list": [
280
- {
281
- "keyname": "邀请人",
282
- "value": "张三"
283
- },
284
- {
285
- "keyname": "企微官网",
286
- "value": "点击访问",
287
- "type": 1,
288
- "url": "https://work.weixin.qq.com/?from=openApi"
289
- },
290
- {
291
- "keyname": "企微下载",
292
- "value": "企业微信.apk",
293
- "type": 1,
294
- "url": "https://work.weixin.qq.com/?from=openApi"
295
- }
296
- ],
297
- "button_selection": {
298
- "question_key": "button_selection_key1",
299
- "title": "你的身份",
300
- "disable": false,
301
- "option_list": [
302
- {
303
- "id": "button_selection_id1",
304
- "text": "企业负责人"
305
- },
306
- {
307
- "id": "button_selection_id2",
308
- "text": "企业用户"
309
- }
310
- ],
311
- "selected_id": "button_selection_id1"
312
- },
313
- "button_list": [
314
- {
315
- "text": "按钮1",
316
- "style": 4,
317
- "key": "BUTTONKEYONE"
318
- },
319
- {
320
- "text": "按钮2",
321
- "style": 1,
322
- "key": "BUTTONKEYTWO"
323
- }
324
- ],
325
- "card_action": {
326
- "type": 1,
327
- "url": "https://work.weixin.qq.com/?from=openApi",
328
- "appid": "APPID",
329
- "pagepath": "PAGEPATH"
330
- },
331
- "task_id": "task_id"
41
+ "type": "object",
42
+ "required": ["type"],
43
+ "properties": {
44
+ "type": { "type": "integer", "enum": [1, 2], "description": "1=跳转url 2=打开小程序(严格只能是1或2)" },
45
+ "url": { "type": "string", "description": "跳转url,type=1时必填" },
46
+ "appid": { "type": "string", "description": "小程序appid,type=2时必填" },
47
+ "pagepath": { "type": "string", "description": "小程序pagepath" }
48
+ }
332
49
  }
333
50
  ```
334
51
 
335
- ### 请求参数
336
-
337
- | 参数 | 类型 | 必须 | 说明 |
338
- | --- | --- | --- | --- |
339
- | card_type | String | 是 | 模版卡片的模版类型,按钮交互模版卡片的类型为 `button_interaction`。当机器人设置了回调URL时,才能下发按钮交互模版卡片 |
340
- | source | Object | 否 | 卡片来源样式信息。参考 **Source结构体说明** |
341
- | action_menu | Object | 否 | 卡片右上角更多操作按钮。参考 **ActionMenu结构体说明** |
342
- | main_title | Object | 是 | 模版卡片的主要内容。参考 **MainTitle结构体说明** |
343
- | quote_area | Object | 否 | 引用文献样式。参考 **QuoteArea结构体说明** |
344
- | sub_title_text | String | 否 | 二级普通文本,建议不超过112个字 |
345
- | horizontal_content_list | Object[] | 否 | 二级标题+文本列表,列表长度不超过6。参考 **HorizontalContent结构体说明** |
346
- | button_selection | Object | 否 | 下拉式的选择器。参考 **SelectionItem结构体说明** |
347
- | button_list | Object[] | 是 | 按钮列表,列表长度不超过6。参考 **Button结构体说明** |
348
- | card_action | Object | 否 | 整体卡片的点击跳转事件。参考 **CardAction结构体说明** |
349
- | task_id | String | 是 | 任务id,同一个机器人任务id不能重复,只能由数字、字母和"_-@"组成,最长128字节。任务id只在发消息时有效,更新消息时无效 |
350
-
351
- ---
352
-
353
- ## 投票选择模版卡片 vote_interaction
354
-
355
- 完整投票选择模版卡片示例:
52
+ ### EmphasisContent
356
53
 
357
54
  ```json
358
55
  {
359
- "card_type": "vote_interaction",
360
- "source": {
361
- "icon_url": "https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0",
362
- "desc": "企业微信"
363
- },
364
- "main_title": {
365
- "title": "欢迎使用企业微信",
366
- "desc": "您的好友正在邀请您加入企业微信"
367
- },
368
- "checkbox": {
369
- "question_key": "question_key",
370
- "option_list": [
371
- {
372
- "id": "id_one",
373
- "text": "选择题选项1"
374
- },
375
- {
376
- "id": "id_two",
377
- "text": "选择题选项2",
378
- "is_checked": true
379
- }
380
- ],
381
- "disable": false,
382
- "mode": 1
383
- },
384
- "submit_button": {
385
- "text": "提交",
386
- "key": "submit_key"
387
- },
388
- "task_id": "task_id"
56
+ "type": "object",
57
+ "properties": {
58
+ "title": { "type": "string", "description": "关键数据内容,建议不超过10字" },
59
+ "desc": { "type": "string", "description": "关键数据描述,建议不超过15字" }
60
+ }
389
61
  }
390
62
  ```
391
63
 
392
- ### 请求参数
64
+ ### SubmitButton
393
65
 
394
- | 参数 | 类型 | 必须 | 说明 |
395
- | --- | --- | --- | --- |
396
- | card_type | String | 是 | 模版卡片的模版类型,投票选择模版卡片的类型为 `vote_interaction`。当机器人设置了回调URL时,才能下发投票选择模版卡片 |
397
- | source | Object | 否 | 卡片来源样式信息。参考 **Source结构体说明** |
398
- | main_title | Object | 是 | 模版卡片的主要内容。参考 **MainTitle结构体说明** |
399
- | checkbox | Object | 是 | 选择题样式。参考 **CheckBox结构体说明** |
400
- | submit_button | Object | 是 | 提交按钮样式。参考 **SubmitButton结构体说明** |
401
- | task_id | String | 是 | 任务id,同一个机器人任务id不能重复,只能由数字、字母和"_-@"组成,最长128字节 |
66
+ ```json
67
+ {
68
+ "type": "object",
69
+ "required": ["text", "key"],
70
+ "properties": {
71
+ "text": { "type": "string", "description": "按钮文案,建议不超过10字" },
72
+ "key": { "type": "string", "description": "提交按钮的key,用于回调事件" }
73
+ }
74
+ }
75
+ ```
402
76
 
403
- ---
77
+ ### Button
404
78
 
405
- ## 多项选择模版卡片 multiple_interaction
79
+ ```json
80
+ {
81
+ "type": "object",
82
+ "required": ["text", "key"],
83
+ "properties": {
84
+ "text": { "type": "string", "description": "按钮文案,建议不超过10字" },
85
+ "style": { "type": "integer", "enum": [1, 2, 3, 4], "description": "按钮样式,只能是1、2、3、4,默认1" },
86
+ "key": { "type": "string", "description": "按钮key,用于回调事件" }
87
+ }
88
+ }
89
+ ```
406
90
 
407
- 完整多项选择模版卡片示例:
91
+ ### Checkbox(投票选择题)
408
92
 
409
93
  ```json
410
94
  {
411
- "card_type": "multiple_interaction",
412
- "source": {
413
- "icon_url": "https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0",
414
- "desc": "企业微信"
415
- },
416
- "main_title": {
417
- "title": "欢迎使用企业微信",
418
- "desc": "您的好友正在邀请您加入企业微信"
419
- },
420
- "select_list": [
421
- {
422
- "question_key": "question_key_one",
423
- "title": "选择标签1",
424
- "disable": false,
425
- "selected_id": "id_one",
426
- "option_list": [
427
- {
428
- "id": "id_one",
429
- "text": "选择器选项1"
430
- },
431
- {
432
- "id": "id_two",
433
- "text": "选择器选项2"
434
- }
435
- ]
436
- },
437
- {
438
- "question_key": "question_key_two",
439
- "title": "选择标签2",
440
- "selected_id": "id_three",
441
- "option_list": [
442
- {
443
- "id": "id_three",
444
- "text": "选择器选项3"
445
- },
446
- {
447
- "id": "id_four",
448
- "text": "选择器选项4"
449
- }
450
- ]
95
+ "type": "object",
96
+ "required": ["question_key", "option_list"],
97
+ "properties": {
98
+ "question_key": { "type": "string", "description": "选择题key,用于回调事件" },
99
+ "mode": { "type": "integer", "enum": [0, 1], "description": "0=单选 1=多选(严格只能是0或1,不允许2或其他值),默认0" },
100
+ "option_list": {
101
+ "type": "array",
102
+ "minItems": 1,
103
+ "maxItems": 20,
104
+ "items": {
105
+ "type": "object",
106
+ "required": ["id", "text"],
107
+ "properties": {
108
+ "id": { "type": "string", "description": "选项id,不可重复" },
109
+ "text": { "type": "string", "description": "选项文案,建议不超过11字" },
110
+ "is_checked": { "type": "boolean", "description": "是否默认选中" }
451
111
  }
452
- ],
453
- "submit_button": {
454
- "text": "提交",
455
- "key": "submit_key"
456
- },
457
- "task_id": "task_id"
112
+ }
113
+ }
114
+ }
458
115
  }
459
116
  ```
460
117
 
461
- ### 请求参数
462
-
463
- | 参数 | 类型 | 必须 | 说明 |
464
- | --- | --- | --- | --- |
465
- | card_type | String | 是 | 模版卡片的模版类型,多项选择模版卡片的类型为 `multiple_interaction`。当机器人设置了回调URL时,才能下发多项选择模版卡片 |
466
- | source | Object | 否 | 卡片来源样式信息。参考 **Source结构体说明** |
467
- | main_title | Object | 是 | 模版卡片的主要内容。参考 **MainTitle结构体说明** |
468
- | select_list | Object[] | 是 | 下拉式的选择器列表,multiple_interaction 类型的卡片该字段不可为空,一个消息最多支持3个选择器。参考 **SelectionItem结构体说明** |
469
- | submit_button | Object | 是 | 提交按钮样式。参考 **SubmitButton结构体说明** |
470
- | task_id | String | 否 | 任务id,同一个机器人任务id不能重复,只能由数字、字母和"_-@"组成,最长128字节 |
471
-
472
- ---
473
-
474
- ## 结构体说明
475
-
476
- ### Source结构体
477
-
478
- 卡片来源样式信息
479
-
480
- | 参数 | 类型 | 必须 | 说明 |
481
- | --- | --- | --- | --- |
482
- | icon_url | String | 否 | 来源图片的url |
483
- | desc | String | 否 | 来源图片的描述,建议不超过13个字 |
484
- | desc_color | Int | 否 | 来源文字的颜色,目前支持:0(默认) 灰色,1 黑色,2 红色,3 绿色 |
118
+ ### SelectionItem(下拉选择器)
485
119
 
486
- ### ActionMenu结构体
487
-
488
- 卡片右上角更多操作按钮
489
-
490
- | 参数 | 类型 | 必须 | 说明 |
491
- | --- | --- | --- | --- |
492
- | desc | String | 是 | 更多操作界面的描述 |
493
- | action_list | Array | 是 | 操作列表,列表长度取值范围为 [1, 3] |
494
- | action_list.text | String | 是 | 操作的描述文案 |
495
- | action_list.key | String | 是 | 操作key值,用户点击后,会产生回调事件将本参数作为EventKey返回,最长支持1024字节,不可重复 |
496
-
497
- ### MainTitle结构体
498
-
499
- 模版卡片的主要内容,包括一级标题和标题辅助信息
500
-
501
- | 参数 | 类型 | 必须 | 说明 |
502
- | --- | --- | --- | --- |
503
- | title | String | 否 | 一级标题,建议不超过26个字。**模版卡片主要内容的一级标题 main_title.title 和二级普通文本 sub_title_text 必须有一项填写** |
504
- | desc | String | 否 | 标题辅助信息,建议不超过30个字 |
505
-
506
- ### EmphasisContent结构体
507
-
508
- 关键数据样式
509
-
510
- | 参数 | 类型 | 必须 | 说明 |
511
- | --- | --- | --- | --- |
512
- | title | String | 否 | 关键数据样式的数据内容,建议不超过10个字 |
513
- | desc | String | 否 | 关键数据样式的数据描述内容,建议不超过15个字 |
514
-
515
- ### QuoteArea结构体
516
-
517
- 引用文献样式
518
-
519
- | 参数 | 类型 | 必须 | 说明 |
520
- | --- | --- | --- | --- |
521
- | type | Int | 否 | 引用文献样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序 |
522
- | url | String | 否 | 点击跳转的url,type是1时必填 |
523
- | appid | String | 否 | 点击跳转的小程序的appid,必须是与当前应用关联的小程序,type是2时必填 |
524
- | pagepath | String | 否 | 点击跳转的小程序的pagepath,type是2时选填 |
525
- | title | String | 否 | 引用文献样式的标题 |
526
- | quote_text | String | 否 | 引用文献样式的引用文案 |
527
-
528
- ### HorizontalContent结构体
529
-
530
- 二级标题+文本列表
531
-
532
- | 参数 | 类型 | 必须 | 说明 |
533
- | --- | --- | --- | --- |
534
- | type | Int | 否 | 链接类型,0或不填代表是普通文本,1 代表跳转url,3 代表点击跳转成员详情 |
535
- | keyname | String | 是 | 二级标题,建议不超过5个字 |
536
- | value | String | 否 | 二级文本,建议不超过26个字 |
537
- | url | String | 否 | 链接跳转的url,type是1时必填 |
538
- | userid | String | 否 | 成员详情的userid,type是3时必填 |
539
-
540
- ### JumpAction结构体
541
-
542
- 跳转指引样式的列表
120
+ ```json
121
+ {
122
+ "type": "object",
123
+ "required": ["question_key", "option_list"],
124
+ "properties": {
125
+ "question_key": { "type": "string", "description": "选择器key,用于回调事件,不可重复" },
126
+ "title": { "type": "string", "description": "选择器标题,建议不超过13字" },
127
+ "selected_id": { "type": "string", "description": "默认选定的option id" },
128
+ "option_list": {
129
+ "type": "array",
130
+ "minItems": 1,
131
+ "maxItems": 10,
132
+ "items": {
133
+ "type": "object",
134
+ "required": ["id", "text"],
135
+ "properties": {
136
+ "id": { "type": "string", "description": "选项id,不可重复" },
137
+ "text": { "type": "string", "description": "选项文案,建议不超过10字" }
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ ```
543
144
 
544
- | 参数 | 类型 | 必须 | 说明 |
545
- | --- | --- | --- | --- |
546
- | type | Int | 否 | 跳转链接类型,0或不填代表不是链接,1 代表跳转url,2 代表跳转小程序,3 代表触发消息智能回复 |
547
- | question | String | 否 | 智能问答问题,最长不超过200个字节。若type为3,必填 |
548
- | title | String | 是 | 跳转链接样式的文案内容,建议不超过13个字 |
549
- | url | String | 否 | 跳转链接的url,type是1时必填 |
550
- | appid | String | 否 | 跳转链接的小程序的appid,type是2时必填 |
551
- | pagepath | String | 否 | 跳转链接的小程序的pagepath,type是2时选填 |
145
+ ### HorizontalContent
552
146
 
553
- ### CardAction结构体
147
+ ```json
148
+ {
149
+ "type": "object",
150
+ "required": ["keyname"],
151
+ "properties": {
152
+ "type": { "type": "integer", "enum": [0, 1, 3], "description": "只能是0(普通文本)、1(跳转url)、3(成员详情),注意没有2" },
153
+ "keyname": { "type": "string", "description": "二级标题,建议不超过5字" },
154
+ "value": { "type": "string", "description": "二级文本,建议不超过26字" },
155
+ "url": { "type": "string", "description": "跳转url,type=1时必填" },
156
+ "userid": { "type": "string", "description": "成员userid,type=3时必填" }
157
+ }
158
+ }
159
+ ```
554
160
 
555
- 整体卡片的点击跳转事件
161
+ ### JumpAction
556
162
 
557
- | 参数 | 类型 | 必须 | 说明 |
558
- | --- | --- | --- | --- |
559
- | type | Int | 是 | 卡片跳转类型,0或不填代表不是链接,1 代表跳转url,2 代表打开小程序。text_notice 和 news_notice 模版卡片中该字段取值范围为[1,2] |
560
- | url | String | 否 | 跳转事件的url,type是1时必填 |
561
- | appid | String | 否 | 跳转事件的小程序的appid,type是2时必填 |
562
- | pagepath | String | 否 | 跳转事件的小程序的pagepath,type是2时选填 |
163
+ ```json
164
+ {
165
+ "type": "object",
166
+ "required": ["title"],
167
+ "properties": {
168
+ "type": { "type": "integer", "enum": [0, 1, 2, 3], "description": "只能是0(无链接)、1(url)、2(小程序)、3(智能回复)" },
169
+ "title": { "type": "string", "description": "文案内容,建议不超过13字" },
170
+ "url": { "type": "string", "description": "跳转url,type=1时必填" },
171
+ "appid": { "type": "string", "description": "小程序appid,type=2时必填" },
172
+ "pagepath": { "type": "string", "description": "小程序pagepath" },
173
+ "question": { "type": "string", "description": "智能问答问题,type=3时必填" }
174
+ }
175
+ }
176
+ ```
563
177
 
564
- ### VerticalContent结构体
178
+ ### QuoteArea
565
179
 
566
- 卡片二级垂直内容
180
+ ```json
181
+ {
182
+ "type": "object",
183
+ "properties": {
184
+ "type": { "type": "integer", "enum": [0, 1, 2], "description": "只能是0(无点击)、1(url)、2(小程序)" },
185
+ "url": { "type": "string" },
186
+ "title": { "type": "string", "description": "引用标题" },
187
+ "quote_text": { "type": "string", "description": "引用文案" }
188
+ }
189
+ }
190
+ ```
567
191
 
568
- | 参数 | 类型 | 必须 | 说明 |
569
- | --- | --- | --- | --- |
570
- | title | String | 是 | 卡片二级标题,建议不超过26个字 |
571
- | desc | String | 否 | 二级普通文本,建议不超过112个字 |
192
+ ### CardImage
572
193
 
573
- ### CardImage结构体
194
+ ```json
195
+ {
196
+ "type": "object",
197
+ "required": ["url"],
198
+ "properties": {
199
+ "url": { "type": "string", "description": "图片url" },
200
+ "aspect_ratio": { "type": "number", "description": "宽高比,1.3~2.25,默认1.3" }
201
+ }
202
+ }
203
+ ```
574
204
 
575
- 图片样式
205
+ ---
576
206
 
577
- | 参数 | 类型 | 必须 | 说明 |
578
- | --- | --- | --- | --- |
579
- | url | String | 是 | 图片的url |
580
- | aspect_ratio | Float | 否 | 图片的宽高比,宽高比要小于2.25,大于1.3,不填该参数默认1.3 |
207
+ ## 1. text_notice Schema
581
208
 
582
- ### ImageTextArea结构体
209
+ ```json
210
+ {
211
+ "type": "object",
212
+ "required": ["card_type", "card_action", "task_id"],
213
+ "properties": {
214
+ "card_type": { "const": "text_notice" },
215
+ "source": { "$ref": "#Source" },
216
+ "main_title": { "$ref": "#MainTitle", "description": "main_title.title 和 sub_title_text 至少填一个" },
217
+ "emphasis_content": { "$ref": "#EmphasisContent" },
218
+ "sub_title_text": { "type": "string", "description": "二级文本,建议不超过112字" },
219
+ "horizontal_content_list": { "type": "array", "maxItems": 6, "items": { "$ref": "#HorizontalContent" } },
220
+ "jump_list": { "type": "array", "maxItems": 3, "items": { "$ref": "#JumpAction" } },
221
+ "card_action": { "$ref": "#CardAction", "description": "必填" },
222
+ "task_id": { "type": "string", "description": "必填,格式:task_{描述}_{时间戳}" }
223
+ }
224
+ }
225
+ ```
583
226
 
584
- 左图右文样式
227
+ ---
585
228
 
586
- | 参数 | 类型 | 必须 | 说明 |
587
- | --- | --- | --- | --- |
588
- | type | Int | 否 | 左图右文样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序 |
589
- | url | String | 否 | 点击跳转的url,type是1时必填 |
590
- | appid | String | 否 | 点击跳转的小程序的appid,必须是与当前应用关联的小程序,type是2时必填 |
591
- | pagepath | String | 否 | 点击跳转的小程序的pagepath,type是2时选填 |
592
- | title | String | 否 | 左图右文样式的标题 |
593
- | desc | String | 否 | 左图右文样式的描述 |
594
- | image_url | String | 是 | 左图右文样式的图片url |
229
+ ## 2. news_notice Schema
595
230
 
596
- ### SubmitButton结构体
231
+ ```json
232
+ {
233
+ "type": "object",
234
+ "required": ["card_type", "main_title", "card_action", "task_id"],
235
+ "properties": {
236
+ "card_type": { "const": "news_notice" },
237
+ "source": { "$ref": "#Source" },
238
+ "main_title": { "$ref": "#MainTitle", "description": "必填" },
239
+ "card_image": { "$ref": "#CardImage", "description": "card_image 和 image_text_area 至少填一个" },
240
+ "vertical_content_list": { "type": "array", "maxItems": 4, "items": { "type": "object", "required": ["title"], "properties": { "title": { "type": "string" }, "desc": { "type": "string" } } } },
241
+ "horizontal_content_list": { "type": "array", "maxItems": 6, "items": { "$ref": "#HorizontalContent" } },
242
+ "jump_list": { "type": "array", "maxItems": 3, "items": { "$ref": "#JumpAction" } },
243
+ "card_action": { "$ref": "#CardAction", "description": "必填" },
244
+ "task_id": { "type": "string", "description": "必填" }
245
+ }
246
+ }
247
+ ```
597
248
 
598
- 提交按钮样式
249
+ ---
599
250
 
600
- | 参数 | 类型 | 必须 | 说明 |
601
- | --- | --- | --- | --- |
602
- | text | String | 是 | 按钮文案,建议不超过10个字 |
603
- | key | String | 是 | 提交按钮的key,会产生回调事件将本参数作为EventKey返回,最长支持1024字节 |
251
+ ## 3. button_interaction Schema
604
252
 
605
- ### SelectionItem结构体
253
+ ```json
254
+ {
255
+ "type": "object",
256
+ "required": ["card_type", "main_title", "button_list", "task_id"],
257
+ "properties": {
258
+ "card_type": { "const": "button_interaction" },
259
+ "source": { "$ref": "#Source" },
260
+ "main_title": { "$ref": "#MainTitle", "description": "必填" },
261
+ "sub_title_text": { "type": "string", "description": "二级文本" },
262
+ "horizontal_content_list": { "type": "array", "maxItems": 6, "items": { "$ref": "#HorizontalContent" } },
263
+ "button_selection": {
264
+ "$ref": "#SelectionItem",
265
+ "description": "可选的下拉选择器,与按钮配合使用"
266
+ },
267
+ "button_list": {
268
+ "type": "array",
269
+ "minItems": 1,
270
+ "maxItems": 6,
271
+ "items": { "$ref": "#Button" },
272
+ "description": "必填,按钮列表"
273
+ },
274
+ "task_id": { "type": "string", "description": "必填" }
275
+ }
276
+ }
277
+ ```
606
278
 
607
- 下拉式的选择器列表
279
+ ---
608
280
 
609
- | 参数 | 类型 | 必须 | 说明 |
610
- | --- | --- | --- | --- |
611
- | question_key | String | 是 | 下拉式的选择器题目的key,用户提交选项后,会产生回调事件,最长支持1024字节,不可重复 |
612
- | title | String | 否 | 选择器的标题,建议不超过13个字 |
613
- | disable | Bool | 否 | 下拉式的选择器是否不可选,false为可选,true为不可选。仅在更新模版卡片时该字段有效 |
614
- | selected_id | String | 否 | 默认选定的id,不填或错填默认第一个 |
615
- | option_list | Object[] | 是 | 选项列表,下拉选项不超过10个,最少1个 |
616
- | option_list.id | String | 是 | 选项的id,最长支持128字节,不可重复 |
617
- | option_list.text | String | 是 | 选项的文案,建议不超过10个字 |
281
+ ## 4. vote_interaction Schema(简化格式,代码自动转换为 API 格式)
618
282
 
619
- ### Button结构体
283
+ > **不要使用** `checkbox`、`question_key`、`option_list` 等 API 原始字段名。使用以下简化字段,代码会自动组装。
620
284
 
621
- 按钮列表
285
+ ```json
286
+ {
287
+ "type": "object",
288
+ "required": ["card_type", "title", "options", "task_id"],
289
+ "properties": {
290
+ "card_type": { "const": "vote_interaction" },
291
+ "title": { "type": "string", "description": "投票标题" },
292
+ "description": { "type": "string", "description": "标题描述,可选" },
293
+ "options": {
294
+ "type": "array",
295
+ "minItems": 1,
296
+ "maxItems": 20,
297
+ "items": {
298
+ "type": "object",
299
+ "required": ["id", "text"],
300
+ "properties": {
301
+ "id": { "type": "string", "description": "选项id,不可重复" },
302
+ "text": { "type": "string", "description": "选项文案" }
303
+ }
304
+ },
305
+ "description": "投票选项列表"
306
+ },
307
+ "mode": { "type": "integer", "enum": [0, 1], "description": "0=单选 1=多选(严格只能是0或1),默认0" },
308
+ "submit_text": { "type": "string", "description": "提交按钮文案,可选,默认\"提交\"" },
309
+ "task_id": { "type": "string", "description": "必填,格式:task_{描述}_{时间戳}" }
310
+ }
311
+ }
312
+ ```
622
313
 
623
- | 参数 | 类型 | 必须 | 说明 |
624
- | --- | --- | --- | --- |
625
- | text | String | 是 | 按钮文案,建议不超过10个字 |
626
- | style | Int | 否 | 按钮样式,目前可填1~4,不填或错填默认1 |
627
- | key | String | 是 | 按钮key值,用户点击后,会产生回调事件将本参数作为event_key返回,最长支持1024字节,不可重复 |
314
+ ---
628
315
 
629
- ### Checkbox结构体
316
+ ## 5. multiple_interaction Schema(简化格式,代码自动转换为 API 格式)
630
317
 
631
- 选择题样式
318
+ > **不要使用** `select_list`、`question_key`、`option_list` 等 API 原始字段名。使用以下简化字段,代码会自动组装。
632
319
 
633
- | 参数 | 类型 | 必须 | 说明 |
634
- | --- | --- | --- | --- |
635
- | question_key | String | 是 | 选择题key值,用户提交选项后,会产生回调事件,最长支持1024字节 |
636
- | disable | Bool | 否 | 投票选择框的是否不可选,false为可选,true为不可选。仅在更新模版卡片时该字段有效 |
637
- | mode | Int | 否 | 选择题模式,单选:0,多选:1,不填默认0 |
638
- | option_list | Object[] | 是 | 选项list,选项个数不超过20个,最少1个 |
639
- | option_list.id | String | 是 | 选项id,最长支持128字节,不可重复 |
640
- | option_list.text | String | 是 | 选项文案描述,建议不超过11个字 |
641
- | option_list.is_checked | Bool | 否 | 该选项是否要默认选中 |
320
+ ```json
321
+ {
322
+ "type": "object",
323
+ "required": ["card_type", "title", "selectors", "task_id"],
324
+ "properties": {
325
+ "card_type": { "const": "multiple_interaction" },
326
+ "title": { "type": "string", "description": "卡片标题" },
327
+ "description": { "type": "string", "description": "标题描述,可选" },
328
+ "selectors": {
329
+ "type": "array",
330
+ "minItems": 1,
331
+ "maxItems": 3,
332
+ "items": {
333
+ "type": "object",
334
+ "required": ["title", "options"],
335
+ "properties": {
336
+ "title": { "type": "string", "description": "此选择器的标题" },
337
+ "options": {
338
+ "type": "array",
339
+ "minItems": 1,
340
+ "maxItems": 10,
341
+ "items": {
342
+ "type": "object",
343
+ "required": ["id", "text"],
344
+ "properties": {
345
+ "id": { "type": "string", "description": "选项id,不可重复" },
346
+ "text": { "type": "string", "description": "选项文案" }
347
+ }
348
+ }
349
+ }
350
+ }
351
+ },
352
+ "description": "下拉选择器列表,每个选择器包含标题和选项"
353
+ },
354
+ "submit_text": { "type": "string", "description": "提交按钮文案,可选,默认\"提交\"" },
355
+ "task_id": { "type": "string", "description": "必填,格式:task_{描述}_{时间戳}" }
356
+ }
357
+ }
358
+ ```