微信个人号开发API-VideosApi.com-微信机器人开发
  1. 开发说明
  • 开发说明
    • 对接须知
    • 对接步骤
    • 消息回调
    • 消息回调接口说明
    • 接入Api相关问答
  • 项目案例(部分)
    • 视频号智能化
    • 客户管理系统/SCRM
    • 群活码
    • 个性业务开发案例
  • 开发API
    • 登录模块
      • (步骤1)获取登录二维码
        POST
      • (步骤2)执行登录
        POST
      • 弹框登录
        POST
      • 退出
        POST
      • 检查是否在线
        POST
      • 异常断线重连
        POST
    • 联系人相关接口
      • 获取通讯录列表(包含群聊)
      • 获取通讯录列表(包含群聊)缓存
      • 搜索好友
      • 添加好友/同意好友
      • 删除好友
      • 获取群/好友简要信息
      • 获取群/好友详细信息
      • 设置好友仅聊天
      • 检测好友关系
      • 设置好友备注
      • 获取手机通讯录
      • 上传手机通讯录
      • 同步企微好友
      • 获取企微好友详情
    • 群管理接口
      • 创建微信群
      • 修改群名称
      • 修改群备注
      • 修改我在群内的昵称
      • 邀请/添加 进群
      • 删除群成员
      • 退出群聊
      • 获取群信息
      • 获取群成员列表
      • 获取群成员详情
      • 设置群公告
      • 获取群公告
      • 同意进群
      • 添加群成员为好友
      • 获取群二维码
      • 群保存到通讯录
      • 管理员操作
      • 聊天置顶
      • 设置消息免打扰
      • 扫码进群
      • 确认进群申请
    • 消息模块
      • 下载
        • 下载图片
        • 下载语音
        • 下载视频
        • 下载emoji
        • cdn下载
      • 发送文字消息
      • 发送文件消息
      • 发送图片消息
      • 发送语音消息
      • 发送视频消息
      • 发送链接消息
      • 发送名片消息
      • 发送emoji消息
      • 发送appmsg消息
      • 发送小程序消息
      • 转发文件
      • 转发图片
      • 转发视频
      • 转发链接
      • 转发小程序
      • 撤回消息
    • 朋友圈模块
      • 点赞/取消点赞
      • 删除朋友圈
      • 设置朋友圈可见范围
      • 是否允许陌生人查看朋友圈
      • 设置某条朋友圈为隐私/公开
      • 下载朋友圈视频
      • 发送文字朋友圈
      • 发送图片朋友圈
      • 发送视频朋友圈
      • 发送链接朋友圈
      • 上传朋友圈图片
      • 上传朋友圈视频
      • 转发朋友圈
      • 自己的朋友圈列表
      • 联系人的朋友圈列表
      • 某条朋友圈详情
      • 评论/删除评论
    • 标签模块
      • 添加标签
      • 删除标签
      • 标签列表
      • 修改好友标签
    • 个人模块
      • 获取个人资料
      • 获取自己的二维码
      • 获取设备记录
      • 隐私设置
      • 修改个人信息
      • 修改头像
    • 收藏夹模块
      • 同步收藏夹
      • 获取收藏夹内容
      • 删除收藏夹
    • 视频号模块
      • 搜索视频号
      • 获取视频号信息
      • 创建视频号
      • 发私信文本消息
      • 发私信图片消息
      • 获取私信人详情
      • 获取私信SessionId
      • 扫码登录视频号助手
      • 视频-直接发布视频
      • 关注/取消关注
      • 获取用户主页
      • 获取自己赞和收藏
      • 视频-分享给好友
      • 视频-分享到朋友圈
      • 视频-评论列表
      • 视频-点赞
      • 视频-小红心
      • 视频-评论
      • 修改视频号资料
      • 视频-浏览
      • 关注列表
      • 获取消息列表
      • 我的二维码
      • 扫码关注
      • 扫码获取视频详情
      • 扫码点小红心
      • 扫码大拇指
      • 扫码浏览
      • 扫码评论
      • 同步私信消息(临时停用)
      • 视频-直接发布视频
      • 视频-CDN上传视频(1)
      • 视频-CDN异步上传视频
      • 视频-CDN异步查询
      • 视频-CDN发布视频(2)
  1. 开发说明

消息回调接口说明

微信在线为什么没有消息推送?
当回调消息未能通过 HTTP POST/JSON 方式成功推送至接收方时,请考虑使用 Apifox 向接收地址发送一条测试消息。如果仍然未能接收到消息,请检查接收地址的可用性。反之,若能成功接收测试消息,请联系客服,我们将协助您进行进一步的问题排查。
如何判断是否是自己发送的消息?
可通过消息发送人($.Data.FromUserName.string)与所属微信($.Wxid)是否一致进行判断。
如何判断群内发送的消息?
可通过消息发送人($.Data.FromUserName.string)为@chatroom结尾判断。
如何判断群内消息是谁发的?
"Content":{"string":"wxid_*uv2q*vsj*0522:\n这个是消息内容,可能是文本、图片或者视频 "}。
可通过Content内string第一段内容判断

文本消息#

 {
     "TypeName": "AddMsg",    回调消息类型
     "Appid": "wx_*_**_***",  设备appid
     "Wxid": "wxid_******",  归属微信的wxid
     "Data":
     {
         "MsgId": ******,   消息ID
         "FromUserName":
         {
             "string": "wxid_******"  消息发送人的wxid
         },
         "ToUserName":
         {
             "string": "wxid_******"  消息接收人的wxid
         },
         "MsgType": 1,   回调消息类型 1是文本消息
         "Content":
         {
             "string": "******" # 消息内容
         },
         "Status": 3,
         "ImgStatus": 1,
         "ImgBuf":
         {
             "iLen": 0
         },
         "CreateTime": ******,  消息发送时间
         "MsgSource": "******",  
         "PushContent": "苏生-技术支持 : ******",  消息通知内容 
         "NewMsgId": ******,  消息ID
         "MsgSeq": ******
     }
 }

图片消息#

{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"   消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 3,   回调消息类型 3是图片消息
        "Content":
        {
            "string": "******"   图片的cdn信息(XML),可用此字段做转发图片
        },
        "Status": 3,
        "ImgStatus": 2,
        "ImgBuf":
        {
            "iLen": 2146,
            "buffer": "/9j/******/4QBM..." # 缩略图的base64
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [图片]",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

语音消息#

{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"   消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 34,   回调消息类型,34是语音消息
        "Content":
        {
            "string": "******"   语音消息的下载信息,可用于下载语音文件
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 3600,
            "buffer": "AiMhU0lMS19WMxMApzi9JA+qToPB..."  语音文件的base64,并非所有语音消息都有本字段
        },
        "CreateTime": ******,   消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [语音]",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

视频消息#

{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"   消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 43,  回调消息类型,43是视频消息
        "Content":
        {
            "string": "******"  视频消息的cdn信息,可用此字段做转发视频
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [视频]",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

emoji表情#

{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 47,  回调消息类型,47是emoji消息
        "Content":
        {
            "string": "******"  可解析xml中的md5用与发送emoji消息
        },
        "Status": 3,
        "ImgStatus": 2,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [动画表情]",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

公众号链接#

判断链接消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.type=5,按此逻辑会匹配到两种消息,链接消息及邀请进群的通知,可依据xml msg.appmsg.title做区分
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        }, 
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 49,
        "Content":
        {
            "string": "******" 可用此字段做转发链接
        },
        "Status": 3,
        "ImgStatus": 2,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [链接]尔滨,又有好消息!",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

文件消息(发送文件的通知)#

注意:收到本条消息仅代表对方在向你发送文件,并不可以用本条做转发及下载
判断此类消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.type=74
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 49,
        "Content":
        {
            "string": "******"
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [文件]hhh.xlsx",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

文件消息(文件发送完成)#

注意:收到本条消息表示对方给你的文件发送完成,可用本条消息做转发及下载
判断此类消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.type=6
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 49,
        "Content":
        {
            "string": ""
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [文件]hhh.xlsx",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

名片消息#

 {
     "TypeName": "AddMsg",   回调消息类型
     "Appid": "wx_*_**_***",  设备appid
     "Wxid": "wxid_******",  归属微信的wxid
     "Data":
     {
         "MsgId": ******,    消息ID
         "FromUserName":
         {
             "string": "wxid_******"    消息发送人的wxid
         },
         "ToUserName":
         {
             "string": "wxid_******"  消息接收人的wxid
         },
         "MsgType": 42,  回调消息类型,42是名片消息
         "Content":
         {
             "string": "******"  名片中微信号的基本信息,可用于添加好友
         },
         "Status": 3,
         "ImgStatus": 1,
         "ImgBuf":
         {
             "iLen": 0
         },
         "CreateTime": ******,  消息发送时间
         "MsgSource": "******",
         "PushContent": "苏生-技术支持 : [名片]Ashley",   消息通知内容
         "NewMsgId": ******,   消息ID
         "MsgSeq": ******
     }
 }

好友添加请求通知#

{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 37,  回调消息类型,37是好友添加请求通知
        "Content":
        {
            "string": "******"  请求添加好友微信号的基本信息,可用于添加好友
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

好友通过验证及好友资料变更的通知消息#

{
    "Appid": "wx_*_**_***",
    "TypeName": "ModContacts",
    "Data":
    {
        "UserName":
        {
            "string": "wxid_******"
        },
        "NickName":
        {
            "string": "******-******"
        },
        "PyInitial":
        {
            "string": "******"
        },
        "QuanPin":
        {
            "string": "******"
        },
        "Sex": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "BitMask": ******,
        "BitVal": 3,
        "ImgFlag": 1,
        "Remark":
        {},
        "RemarkPyinitial":
        {},
        "RemarkQuanPin":
        {},
        "ContactType": 0,
        "RoomInfoCount": 0,
        "DomainList": [
        {}],
        "ChatRoomNotify": 0,
        "AddContactScene": 0,
        "Province": "Jiangsu",
        "City": "Nanjing",
        "Signature": "......",
        "PersonalCard": 0,
        "HasWeiXinHdHeadImg": 1,
        "VerifyFlag": 0,
        "Level": 6,
        "Source": 14,
        "WeiboFlag": 0,
        "AlbumStyle": 0,
        "AlbumFlag": 3,
        "SnsUserInfo":
        {
            "SnsFlag": 1,
            "SnsBgimgId": "******",
            "SnsBgobjectId": ******,
            "SnsFlagEx": ******
        },
        "Country": "CN",
        "BigHeadImgUrl": "******",
        "SmallHeadImgUrl": "******",
        "CustomizedInfo":
        {
            "BrandFlag": 0
        },
        "EncryptUserName": "******r",
        "AdditionalContactList":
        {
            "LinkedinContactItem":
            {}
        },
        "ChatroomMaxCount": 0,
        "DeleteFlag": 0,
        "Description": "\b\u0000\u0018\u0000\"\u0000(\u00008\u0000",
        "ChatroomStatus": 0,
        "Extflag": 0,
        "ChatRoomBusinessType": 0
    }
}

小程序消息#

判断此类消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.type=33/36
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        { 
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 49,
        "Content":
        {
            "string": "******"
        },
        "Status": 3,
        "ImgStatus": 2,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持 : [小程序]腾讯云助手",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

引用消息#

判断此类消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.type=57
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 49,
        "Content":
        {
            "string": "******"
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "************",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

转账消息#

判断此类消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.type=2000
 {
     "TypeName": "AddMsg",   回调消息类型
     "Appid": "wx_*_**_***",  设备appid
     "Wxid": "wxid_******",  归属微信的wxid
     "Data":
     {
         "MsgId": ******,    消息ID
         "FromUserName":
         {
             "string": "wxid_******"    消息发送人的wxid
         },
         "ToUserName":
         {
             "string": "wxid_******"  消息接收人的wxid
         },
         "MsgType": 49,
         "Content":
         {
             "string": "******"
         },
         "Status": 3,
         "ImgStatus": 1,
         "ImgBuf":
         {
             "iLen": 0
         },
         "CreateTime": ******,  消息发送时间
         "MsgSource": "******",
         "PushContent": "苏生-技术支持 : [转账]",   消息通知内容
         "NewMsgId": ******,   消息ID
         "MsgSeq": ******
     }
 }

红包消息#

判断此类消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.type=2001
 {
     "TypeName": "AddMsg",   回调消息类型
     "Appid": "wx_*_**_***",  设备appid
     "Wxid": "wxid_******",  归属微信的wxid
     "Data":
     {
         "MsgId": ******,    消息ID
         "FromUserName":
         {
             "string": "wxid_******"    消息发送人的wxid
         },
         "ToUserName":
         {
             "string": "wxid_******"  消息接收人的wxid
         },
         "MsgType": 49,
         "Content":
         {
             "string": "******"
         },
         "Status": 3,
         "ImgStatus": 1,
         "ImgBuf":
         {
             "iLen": 0
         },
         "CreateTime": ******,  消息发送时间
         "MsgSource": "******",
         "PushContent": "苏生-技术支持 : [红包]恭喜发财,大吉大利",   消息通知内容
         "NewMsgId": ******,   消息ID
         "MsgSeq": ******
     }
 }

视频号消息#

消息通知和关注消息在拿到后调用获取消息列表接口查询
//消息通知(点赞、评论、小红心)
{
    "TypeName": "FinderSyncMsg",
    "Appid": "wx_xmt***********8uugAG",
    "Data": {
        "priority": 400000,
        "type": 2,
        "extInfo": "GKij2LcWsfA=",
        "showInfos": [
            {
                "showType": 2,
                "clearType": 2,
                "path": "TLPersonalCenter",
                "parent": "",
                "showExtInfoType": 2
            },
            {
                "showType": 27,
                "title": "有人评论了你的作品",
                "clearType": 1,
                "path": "FinderMessageEntryRight",
                "parent": "TLPersonalCenter",
                "showExtInfoType": 5,
                "showExtInfo": "CAI="
            }
        ],
        "tipsId": "tipsid_1727402408879585",
        "selfFinderUsername": "v2_060000231003b20fa***********@finder",
        "reportExtInfo": "eyJyZWRfY29udG***********OiuuuS6huS9oOeahOS9nOWTgSJ9",
        "tipsUuid": "tipsuuid_17***************_2704224217_2"
    },
    "Wxid": "wxid_7***********22"
}

//私信推送
{
    "TypeName": "FinderBypMsg",
    "Appid": "wx_xmtR***************gAG",
    "Data": {
        "msg": {
            "MsgId": 391,
            "FromUserName": {
                "string": "fv1_d6b0b96bfb508***********@findermsgstranger"
            },
            "ToUserName": {
                "string": "v2_060000231003b20faec8c***********@finder"
            },
            "MsgType": 1,
            "Content": {
                "string": "测试消息,",
                "Status": ":3,",
                "ImgStatus": ":1,",
                "ImgBuf": ":{",
                "iLen": ":0},",
                "CreateTime": ":1727458354,",
                "MsgSource": ":"
            }
        }
    }
}

//关注消息
{
    "TypeName": "FinderSyncMsg",
    "Appid": "wx_xmtR***********8uugAG",
    "Data": {
        "priority": 400000,
        "type": 2,
        "extInfo": "GMmp2LcAerfss=",
        "showInfos": [
            {
                "showType": 2,
                "clearType": 2,
                "path": "TLPersonalCenter",
                "parent": "",
                "showExtInfoType": 2
            },
            {
                "showType": 27,
                "title": "有人关注了你",
                "clearType": 1,
                "path": "FinderMessageEntryRight",
                "parent": "TLPersonalCenter",
                "showExtInfoType": 5,
                "showExtInfo": "CAM="
            }
        ],
        "tipsId": "tipsid_1727403209365726",
        "selfFinderUsername": "v2_060000231003b20faec8***********@finder",
        "reportExtInfo": "eyJyZWRfY29udGVu***********OS6huS9oCJ9",
        "tipsUuid": "tipsuuid_1727***********1_3695673591_2"
    },
    "Wxid": "wxid_***********2hpjq22"
}


撤回消息#

判断此类消息的逻辑:$.Data.MsgType=10002 并且 解析$.Data.Content.string中的xml sysmsg.type=revokemsg
 {
     "TypeName": "AddMsg",   回调消息类型
     "Appid": "wx_*_**_***",  设备appid
     "Wxid": "wxid_******",  归属微信的wxid
     "Data":
     {
         "MsgId": ******,    消息ID
         "FromUserName":
         {
             "string": "wxid_******"    消息发送人的wxid
         },
         "ToUserName":
         {
             "string": "wxid_******"  消息接收人的wxid
         },
         "MsgType": 10002,
         "Content":
         {
             "string": "******"
         },
         "Status": 3,
         "ImgStatus": 1,
         "ImgBuf":
         {
             "iLen": 0
         },
         "CreateTime": ******,  消息发送时间
         "MsgSource": "******",
         "NewMsgId": ******,   消息ID
         "MsgSeq": ******
     }
 }

拍一拍消息#

判断此类消息的逻辑:$.Data.MsgType=10002 并且 解析$.Data.Content.string中的xml sysmsg.type=pat
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 10002,
        "Content":
        {
            "string": "******"
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

地理位置#

{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 48, 回调消息类型,48是地理位置消息
        "Content":
        {
            "string": "******"
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "PushContent": "苏生-技术支持分享了一个地理位置",   消息通知内容
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

群聊邀请#

判断此类消息的逻辑:$.Data.MsgType=49 并且 解析$.Data.Content.string中的xml msg.appmsg.title=邀请你加入群聊(根据手机设置的系统语言title会有调整,不同语言关键字不同)
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    消息发送人的wxid
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 49,   
        "Content": 
        {
            "string": "******"
        },
        "Status": 3,
        "ImgStatus": 0,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

被移除群聊通知#

判断此类消息的逻辑:$.Data.MsgType=10000 并且 $.Data.Content.string内容为移除群聊的通知内容
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "******@chatroom"   所在群聊的ID
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 10000,
        "Content":
        {
            "string": "你被\"苏生-技术支持\"移出群聊"
        },
        "Status": 4,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

踢出群聊通知#

判断此类消息的逻辑:$.Data.MsgType=10002 并且 解析$.Data.Content.string中的xml sysmsg.type=sysmsgtemplate 并且 template中的内容为“你将xxx移出了群聊”(根据手机设置的系统语言template会有调整,不同语言关键字不同)
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "******@chatroom"    所在群聊的ID
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 10002,
        "Content":
        {
            "string": "******"
        },
        "Status": 4,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

解散群聊通知#

判断此类消息的逻辑:$.Data.MsgType=10002 并且 解析$.Data.Content.string中的xml sysmsg.type=sysmsgtemplate 并且 template中的内容为“群主xxx已解散该群聊”(根据手机设置的系统语言template会有调整,不同语言关键字不同)
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "*******@chatroom"    所在群聊的ID
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 10002,
        "Content":
        {
            "string": "******"
        },
        "Status": 4,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

修改群名称#

判断此类消息的逻辑:$.Data.MsgType=10000 并且 $.Data.Content.string为修改群名的通知内容
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "******@chatroom"    所在群聊的ID
        },
        "ToUserName":
        {
            "string": "wxid_******"  消息接收人的wxid
        },
        "MsgType": 10000,
        "Content":
        {
            "string": "你修改群名为“******”"
        },
        "Status": 4,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

更换群主通知#

判断此类消息的逻辑:$.Data.MsgType=10000 并且 $.Data.Content.string为更换群主的通知内容
 {
     "TypeName": "AddMsg",   回调消息类型
     "Appid": "wx_*_**_***",  设备appid
     "Wxid": "wxid_******",  归属微信的wxid
     "Data":
     {
         "MsgId": ******,    消息ID
         "FromUserName":
         {
             "string": "******@chatroom"    所在群聊的ID
         },
         "ToUserName":
         {
             "string": "wxid_******"  消息接收人的wxid
         },
         "MsgType": ******,
         "Content":
         {
             "string": "你已成为新群主"
         },
         "Status": 4,
         "ImgStatus": 1,
         "ImgBuf":
         {
             "iLen": 0
         },
         "CreateTime": ******,  消息发送时间
         "MsgSource": "******",
         "NewMsgId": ******,   消息ID
         "MsgSeq": ******
     }
 }

群信息变更通知#

{
    "TypeName": "ModContacts",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "UserName":
        {
            "string": "******@chatroom"   所在群聊的ID
        },
        "NickName":
        {
            "string": "******"
        },
        "PyInitial":
        {
            "string": "******"
        },
        "QuanPin":
        {
            "string": "******"
        },
        "Sex": 0,
        "ImgBuf":
        {
            "iLen": 0
        },
        "BitMask": ******,
        "BitVal": 2,
        "ImgFlag": 1,
        "Remark":
        {},
        "RemarkPyinitial":
        {},
        "RemarkQuanPin":
        {},
        "ContactType": 0,
        "RoomInfoCount": 0,
        "DomainList": [
        {}],
        "ChatRoomNotify": 1,
        "AddContactScene": 0,
        "PersonalCard": 0,
        "HasWeiXinHdHeadImg": 0,
        "VerifyFlag": 0,
        "Level": 0,
        "Source": 0,
        "ChatRoomOwner": "wxid_******",
        "WeiboFlag": 0,
        "AlbumStyle": 0,
        "AlbumFlag": 0,
        "SnsUserInfo":
        {
            "SnsFlag": 0,
            "SnsBgobjectId": 0,
            "SnsFlagEx": 0
        },
        "CustomizedInfo":
        {
            "BrandFlag": 0
        },
        "AdditionalContactList":
        {
            "LinkedinContactItem":
            {}
        },
        "ChatroomMaxCount": "******”,
        "DeleteFlag": 2,
        "Description": "******",
        "ChatroomStatus": 27,
        "Extflag": 0,
        "ChatRoomBusinessType": 0
    }
}

发布群公告#

判断此类消息的逻辑:$.Data.MsgType=10002 并且 解析$.Data.Content.string中的xml sysmsg.type=mmchatroombarannouncememt
{
    "TypeName": "AddMsg",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "MsgId": ******,    消息ID
        "FromUserName":
        {
            "string": "wxid_******"    发布人的wxid
        },
        "ToUserName":
        {
            "string": "******@chatroom"   所在群聊的ID
        },
        "MsgType": 10002,
        "Content":
        {
            "string": "******"
        },
        "Status": 3,
        "ImgStatus": 1,
        "ImgBuf":
        {
            "iLen": 0
        },
        "CreateTime": ******,  消息发送时间
        "MsgSource": "******",
        "NewMsgId": ******,   消息ID
        "MsgSeq": ******
    }
}

群待办#

判断此类消息的逻辑:$.Data.MsgType=10002 并且 解析$.Data.Content.string中的xml sysmsg.type=roomtoolstips
 {
     "TypeName": "AddMsg",   回调消息类型
     "Appid": "wx_*_**_***",  设备appid
     "Wxid": "wxid_******",  归属微信的wxid
     "Data":
     {
         "MsgId": ******,    消息ID
         "FromUserName":
         {
             "string": "******@chatroom"   所在群聊的ID
         },
         "ToUserName":
         {
             "string": "wxid_******"
         },
         "MsgType": 10002,
         "Content":
         {
             "string": "******"
         },
         "Status": 4,
         "ImgStatus": 1,
         "ImgBuf":
         {
             "iLen": 0
         },
         "CreateTime": ******,  消息发送时间
         "MsgSource": "******",
         "NewMsgId": ******,   消息ID
         "MsgSeq": ******
     }
 }

删除好友通知#

{
    "TypeName": "DelContacts",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "UserName":
        {
            "string": "wxid_******"   删除的好友wxid
        },
        "DeleteContactScen": 0
    }
}

退出群聊#

{
    "TypeName": "DelContacts",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******",  归属微信的wxid
    "Data":
    {
        "UserName":
        {
            "string": "******@chatroom"   退出的群聊ID
        },
        "DeleteContactScen": 0
    }
}

掉线通知#

{
    "TypeName": "Offline",   回调消息类型
    "Appid": "wx_*_**_***",  设备appid
    "Wxid": "wxid_******"  掉线号的wxid
}

产品可行性及API相关问题咨询

上一页
消息回调
下一页
接入Api相关问答
Built with