跳转至

消息数据格式

注:有度会在URL中添加token和file_id两个属性。

跳转URL示例

https://youdu.im?token=$token&file_id=$file_id

转出消息数据格式

说明: 有度会将会话消息数据打成一个压缩包对外提供,用户可以通过file_id下载对应的压缩包

压缩包目录结构

-- chat.json
-- file
    -- 6f6ba6109b942adef7f6f82f1a351853-15217.png
    -- 606ff10580e72f974c10c161f623b798-14243.txt
    -- .......
  • chat.json:文本文件,内容为Json格式的会话消息内容
  • file: 目录,内容为文件或者图片

chat.json内容示例

{
    "ChatMsgList": [
        {
            "SessionId": "{B80349F7-F68C-44EB-A0E0-7EF2BA5087AB}",
            "Sender": "cs1 (cs1)",
            "Content": "eyJtc2dUeXBlIjowLCJ0ZXh0IjpbeyJ0eHQiOiIxMjMiLCJlbSI6IiIsImltZyI6eyJpZCI6IiIsIm5hbWUiOiIiLCJ3aWR0aCI6MCwiaGVpZ2h0IjowLCJzaXplIjowLCJpc0dpZiI6MH19XSwiTmFtZSI6IiIsIlNpemUiOjAsIklkIjoiIn0=",
            "MsgId": 1597048327,
            "SendTime": 1597048336541
        },
        {
            "SessionId": "{B80349F7-F68C-44EB-A0E0-7EF2BA5087AB}",
            "Sender": "cs1 (cs1)",
            "Content": "eyJtc2dUeXBlIjowLCJ0ZXh0IjpbeyJ0eHQiOiJhc2YiLCJlbSI6IiIsImltZyI6eyJpZCI6IiIsIm5hbWUiOiIiLCJ3aWR0aCI6MCwiaGVpZ2h0IjowLCJzaXplIjowLCJpc0dpZiI6MH19XSwiTmFtZSI6IiIsIlNpemUiOjAsIklkIjoiIn0=",
            "MsgId": 1597048328,
            "SendTime": 1597048338186
        },
        {
            "SessionId": "{B80349F7-F68C-44EB-A0E0-7EF2BA5087AB}",
            "Sender": "cs1 (cs1)",
            "Content": "eyJtc2dUeXBlIjoxLCJ0ZXh0IjpbeyJ0eHQiOiIiLCJlbSI6IiIsImltZyI6eyJpZCI6IjZmNmJhNjEwOWI5NDJhZGVmN2Y2ZjgyZjFhMzUxODUzLTE1MjE3IiwibmFtZSI6Ins5MDcxZDU4Ny1lNTkyLTRjY2QtOGU2ZC1jZjVkYzRhMGEzY2F9LnBuZyIsIndpZHRoIjo0ODIsImhlaWdodCI6MjI1LCJzaXplIjoxNTIxNywiaXNHaWYiOjB9fV0sIk5hbWUiOiIiLCJTaXplIjowLCJJZCI6IiJ9",
            "MsgId": 1597048329,
            "SendTime": 1597048341639
        },
        {
            "SessionId": "{B80349F7-F68C-44EB-A0E0-7EF2BA5087AB}",
            "Sender": "cs1 (cs1)",
            "Content": "eyJtc2dUeXBlIjozLCJ0ZXh0IjpudWxsLCJOYW1lIjoiZW1vamkudHh0IiwiU2l6ZSI6MTQyNDMsIklkIjoiNjA2ZmYxMDU4MGU3MmY5NzRjMTBjMTYxZjYyM2I3OTgtMTQyNDMifQ==",
            "MsgId": 1597048330,
            "SendTime": 1597048352739
        }
    ],
    "CustomAttr": {
        "date_time": "2020-08-11 17:08:39",
        "forwarder": "cs1 (cs1)"
    }
}

Content内容为base64编码的json格式内容,包含3种类型

  • 文字/emoji
  • 图文混排
  • 文件

文字消息content内容解码示例:

{
    "msgType": 0,
    "text": [
        {
            "txt": "文字消息"
        }
    ]
}

图文混排content解码内容示例:

{
    "msgType": 1,
    "text": [
        {
            "txt": "图文混排消息",
            "em": "",
            "img": {
                "id": "",
                "name": "",
                "width": 0,
                "height": 0,
                "size": 0,
                "isGif": 0
            }
        },
        {
            "txt": "",
            "em": "[疑问]",
            "img": {
                "id": "",
                "name": "",
                "width": 0,
                "height": 0,
                "size": 0,
                "isGif": 0
            }
        },
        {
            "txt": "",
            "em": "",
            "img": {
                "id": "78314ed2150e3be9ce7fb73f3271ad14-14734",
                "name": "{b7416e55-c02e-4f2d-8279-605303682a6a}.png",
                "width": 379,
                "height": 153,
                "size": 14734,
                "isGif": 0
            }
        }
    ],
    "name": "",
    "size": 0,
    "id": ""
}

文件content内容解码示例:

{
    "msgType": 3,
    "name": "导出excel.docx",
    "size": 227810,
    "id": "1002b9074607dae281f0b205bc674b20-227810"
}

参数说明

参数 说明
chatMsgList 会话消息列表对象
sessionId 会话id
Sender 消息发送者
Content 消息内容
SendTime 消息发送时间
MsgId 消息id,64位整型
msgType 消息类型。
text 图片/图文内容数组对象
img 图片对象
em emoji内容
file 文件对象
name 图片或者文件的名称
id 图片或者文件的id
size 图片或者文件的字节
customAttr 自定义属性对象
forwarder 转出者
dateTime 转出时间