• OkayAPI Docs
  • Login
  • Try for free



YesApi 接口文档

6101 发送私信接口

接口路径(新):http://api.okayapi.com/api/App/Market_ChatMessage/Send

接口路径(旧):http://api.okayapi.com/?s=App.Market_ChatMessage.Send

接口描述: 发送私信,非好友也可以发送。使用前请先安装私信插件

API Params

ParameterTypeRequiredDefaultNoteDescription
HTTP_APPKEYStringRequiredMIN: 32Common Put Your APPKEY
other_uuidStringRequiredMIN: 32;MAX: 32接收私信的会员uuid
chat_message_typeEnumRequiredtextRange: text/html/image/link/custom私信消息类型,text普通文本,html富文本,image图片,link链接,custom自定义。注意,不同私信类型,需要提供的chat_message_data参数不同。
chat_message_dataArrayJSON FormatRequired私信消息数据,JSON格式。不同消息类型,参数格式不同。分别是:
  • text普通文本:{"content":"(必须)文本消息内容"};
  • html富文本:{"content":"(必须)HTML消息内容"};
  • image图片:{"url":"必须)图片链接"};
  • link链接:{"url":"(必须)链接"};
  • custom自定义:{"xxx":"自定义结构"}。
此外,全部消息类型均支持emoji表情(例如:我 ❤ ⚽ ),且支持更多自定义扩展字段。

API Usage Demo

API Response

KEYTypeDescription
err_codeInt操作码,0表示成功,1不能发送给自己,2发送失败,9表示插件未安装
err_msgString错误提示信息,err_code非0时参考此提示信息

YesApi 接口文档

6102 群发私信接口

接口路径(新):http://api.okayapi.com/api/App/Market_ChatMessage/MultiSend

接口路径(旧):http://api.okayapi.com/?s=App.Market_ChatMessage.MultiSend

接口描述: 给多个会员批量群发私信,非好友也可以发送。使用前请先安装私信插件

API Params

ParameterTypeRequiredDefaultNoteDescription
HTTP_APPKEYStringRequiredMIN: 32Common Put Your APPKEY
other_uuidArraySeperated with ,RequiredMIN: 1;MAX: 200接收私信的会员uuid,多个uuid用英文逗号分割
chat_message_typeEnumRequiredtextRange: text/html/image/link/custom私信消息类型,text普通文本,html富文本,image图片,link链接,custom自定义。注意,不同私信类型,需要提供的chat_message_data参数不同。
chat_message_dataArrayJSON FormatRequired私信消息数据,JSON格式。不同消息类型,参数格式不同。分别是:
  • text普通文本:{"content":"(必须)文本消息内容"};
  • html富文本:{"content":"(必须)HTML消息内容"};
  • image图片:{"url":"必须)图片链接"};
  • link链接:{"url":"(必须)链接"};
  • custom自定义:{"xxx":"自定义结构"}。
此外,全部消息类型均支持emoji表情(例如:我 ❤ ⚽ ),且支持更多自定义扩展字段。

API Usage Demo

API Response

KEYTypeDescription
err_codeInt操作码,0表示成功,1不能发送给自己,2发送失败,9表示插件未安装
err_msgString错误提示信息,err_code非0时参考此提示信息
detailArray批量发送结果详情
detail[].other_uuidString接收私信的会员ID
detail[].chat_message_idInt消息ID

YesApi 接口文档

6103 获取单人会话消息列表

接口路径(新):http://api.okayapi.com/api/App/Market_ChatMessage/TakeMessageList

接口路径(旧):http://api.okayapi.com/?s=App.Market_ChatMessage.TakeMessageList

接口描述: 获取与某一位会员的单人会话消息列表。使用前请先安装私信插件

API Params

ParameterTypeRequiredDefaultNoteDescription
HTTP_APPKEYStringRequiredMIN: 32Common Put Your APPKEY
other_uuidStringRequiredMIN: 32;MAX: 32私信对话的会员uuid
last_idStringOptaion0MIN: 0上一次的消息ID,通过传递前面的私信消息ID以保证消息的连贯性。
directionEnumOptaiondownRange: up/down获取私信消息的方向,up表示向上滑动,即取前面的旧消息;down表示向下滑动,即获取最新的消息。
perpageIntOptaion20MIN: 1;MAX: 100分页数量

API Usage Demo

API Response

KEYTypeDescription
err_codeInt操作码,0表示成功,1不能和自己聊天,9表示插件未安装
err_msgString错误提示信息,err_code非0时参考此提示信息
listArray消息列表
list[].idInt
list[].chat_message_to_uuidString当前会话的会员uuid
list[].chat_message_dataObject消息数据结构体
list[].chat_message_typeString消息类型
list[].chat_message_is_readInt是否已读,0未读1已读
list[].chat_message_ioString消息方向,in表示自己发出的,out表示收到的
list[].add_timeString消息发送时间
unread_numInt未读消息数量

YesApi 接口文档

6104 标记消息为已读

接口路径(新):http://api.okayapi.com/api/App/Market_ChatMessage/MarkAsReaded

接口路径(旧):http://api.okayapi.com/?s=App.Market_ChatMessage.MarkAsReaded

接口描述: 可以针对单人会话,把当前会话的全部消息或指定某一条消息置为已读。使用前请先安装私信插件

API Params

ParameterTypeRequiredDefaultNoteDescription
HTTP_APPKEYStringRequiredMIN: 32Common Put Your APPKEY
other_uuidStringRequiredMIN: 32;MAX: 32私信对话的会员uuid
chat_message_idIntOptaion0MIN: 0会话消息ID,为0时表示把当前会话全部消息标记为已读,不为0时单条标记为已读。

API Usage Demo

API Response

KEYTypeDescription
err_codeInt操作码,0表示成功,9表示插件未安装
err_msgString错误提示信息,err_code非0时参考此提示信息
readed_numInt本次已标记为已读的数量

YesApi 接口文档

6105 获取全部会话列表

接口路径(新):http://api.okayapi.com/api/App/Market_ChatMessage/GetAllChatList

接口路径(旧):http://api.okayapi.com/?s=App.Market_ChatMessage.GetAllChatList

接口描述: 获取和全部人的私信会话列表。使用前请先安装私信插件

API Params

ParameterTypeRequiredDefaultNoteDescription
HTTP_APPKEYStringRequiredMIN: 32Common Put Your APPKEY
pageIntOptaion1MIN: 1;MAX: 100第几页
perpageIntOptaion20MIN: 1;MAX: 100分页数量

API Usage Demo

HTTP
请求(需要登录态):
{OKAYAPI_API_HOST}/?s=App.Market_ChatMessage.GetAllChatList&app_key={你的app_key}&sign={动态签名}

返回:
{
    "ret": 200,
    "data": {
        "err_code": 0,
        "err_msg": "",
        "list": [
        {
            "chat_message_to_uuid": "8AEA2AF1951C0376EC668A74B8CAA64A",
            "chat_message_data": {
                "content": "I ❤ ⚽ "
            },
            "chat_message_type": "text",
            "chat_message_is_read": 1,
            "chat_message_io": "out",
            "add_time": "2019-08-11 17:12:02",
            "user": {
                "username": "AB君",
                "ext_info": {
                    "yesapi_avatar": "",
                    "nickname": "",
                    "age": "18"
                }
            }
        },
        {
            "chat_message_to_uuid": "5B1CA086F3E9E86F83354191AFB41E9E",
            "chat_message_data": {
                "content": "I love 小白接口!"
            },
            "chat_message_type": "text",
            "chat_message_is_read": 1,
            "chat_message_io": "out",
            "add_time": "2019-08-11 17:12:02",
            "user": {
                "username": "dogstar",
                "ext_info": {
                    "yesapi_avatar": "",
                    "nickname": "",
                    "age": "18"
                }
            }
        }
        ],
            "total": 2
    },
    "msg": "小白开放接口:App.Market_ChatMessage.GetAllChatList"
}

API Response

KEYTypeDescription
err_codeInt操作码,0表示成功,9表示插件未安装
err_msgString错误提示信息,err_code非0时参考此提示信息
listArray私信聊天列表
list[].chat_message_to_uuidString当前会话的会员uuid
list[].chat_message_typeString消息类型
list[].chat_message_ioString消息方向,in表示自己发出的,out表示收到的
list[].add_timeString消息发送时间
list[].chat_message_dataObject消息数据结构体
list[].chat_message_is_readInt是否已读,0未读1已读
list[].userObject用户信息
list[].user.usernameString用户账号名
list[].user.ext_infoObject用户扩展信息
totalInt私信聊天人数

YesApi 接口文档

6106 获取全部未读的新消息数量

接口路径(新):http://api.okayapi.com/api/App/Market_ChatMessage/GetAllUnreadNum

接口路径(旧):http://api.okayapi.com/?s=App.Market_ChatMessage.GetAllUnreadNum

接口描述: 获取和全部人的未读的新消息数量。使用前请先安装私信插件

API Params

ParameterTypeRequiredDefaultNoteDescription
HTTP_APPKEYStringRequiredMIN: 32Common Put Your APPKEY

API Usage Demo

API Response

KEYTypeDescription
err_codeInt操作码,0表示成功,9表示插件未安装
err_msgString错误提示信息,err_code非0时参考此提示信息

Power by OkayAPI.com Contact us (WA: okayapi OR Email: chanzonghuang@gmail.com).
Timezone: America/New_York Apr/10/2026 22:24:58