Skip to content

消息卡片总体结构

消息卡片由 header、elements 和 config 组成,卡片相关限制:

  • 卡片组件数:每个卡片元素数不得超过 20 个。
  • 卡片内容阈值:每个卡片内容不得超过 5000 个字符。
卡片结构是否必须类型说明
configobject卡片配置
∟ operator_allowarray是否允许右键操作
null:全部允许, -1:全部禁止
∟ todo_switchstring添加卡片待办状态,需要在更新卡片时手动更改该配置为 off
on:开启待办,off:关闭待办
∟ filter_keystring添加卡片筛选状态,需要在开发者后台配置筛选项
∟ update_singlebool是否独享,true: 开启独享,false: 开启共享
∟ nonsupport_clientobject消息卡片不支持展示的客户端
linkobject配置整个卡片跳转链接
headerobject卡片标题,包括标题和副标题
elementsobject卡片内容

代码示例

{
    "config": {
    "operator_allow": [-1], // null:全部允许, -1:全部禁止
    "todo_switch": "on", // on:开启待办,off:关闭待办
    "filter_key": "key", // 添加卡片筛选状态,需要在开发者后台配置筛选项
    "update_single": true, // 是否独享,true: 开启独享,false: 开启共享
    "nonsupport_client": {
        "client_type": ["pc"], //  三个枚举: "pc", "ios", "android"   代表不支持的客户端
        "describe": "[收到一条授权登录消息,请前往移动端操作]"   // 不支持的客户端文本描述
        }
     },
     "link": {
        "url": "https://xz.wps.cn/",
        "android_url": "https://xz.wps.cn/",
        "ios_url": "https://xz.wps.cn/",
        "pc_url": "https://xz.wps.cn/"
     },
    "header": {
        "title": {
            "tag": "text",
            "content": {
                "type": "plainText",
                "text": "标题"
            }
        },
        "subtitle": {
            "tag": "text",
            "content": {
                "type": "plainText",
                "text": "副标题"
            }
        }
    },
    "elements": [
        {
            //组件内容
        }
    ]
}

卡片内容

目前支持的卡片组件如表格所示:

模块分类组件说明
文本模块单列文本(tag=text)、双列文本(tag=div)
图文模块图片(tag=img)、轮播图(tag=carousel)、视频(tag=video)、文本+中图(tag=picText)、文本+小图(tag=note)
分割线模块分割线(tag=hr)
交互模块按钮(tag=button)、列表选择器(tag=selection)、日期选择器(tag=datePicker)、输入框(tag=input)交互模块必须包含在 tag=action 下