群发消息

请求说明

POST https://api.netease.im/nimserver/msg/sendMsgToAll.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

接口描述

给用户或者高级群发送普通消息,包括文本,图片,语音,视频和地理位置,具体消息参考下面描述

参数说明

参数 类型 必须 说明
from String 发送者accid,用户帐号,最大32字符, 必须保证一个APP内唯一
areaid String 地区id,外键,对应系统管理中的dic_area -> areaid
enterptypeid String 企业类型id,外键,对应系统管理 中dic_enterptype->enterptypeid
type int 0 表示文本消息, 1 表示图片, 2 表示语音,
body String 请参考下方消息示例说明中对应消息的body字段, 最大长度200字符,为一个JSON串
ext String 开发者扩展字段,长度限制1024字符
markRead int 可选,是否需要已读业务,0:不需要,1:需要

请求示例

curl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803mgq3" 
-H "Nonce: 4tgggergigwow323t23t" 
-H "CurTime: 1443592222" 
-H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" 
-H "Content-Type: application/json; charset=utf-8" 
-d '{
  "from": "adminuuid1",
  "type": 0,
  "body": "\"{jsonbody}\"",
  "ext": "\"\"",
  "markRead": 0
}' 
'https://api.netease.im/nimserver/msg/sendMsg.action'
{
  "body": {
    "contentinfoid": "1",
    "contentcode": 1022,
    "enterpinfoid": "10000",
    "contenttypeid": null,
    "contenttitle": "一米哥湖南梅菜扣肉、鱼香肉丝半成品 微波炉加热即可食用,方便卫生,高效快捷",
    "covermedia": "https://youpeiliangpin.oss-cn-beijing.aliyuncs.com/content/TIM%E5%9B%BE%E7%89%8720180502132735.png",
    "contentdesc": "测试内容描述42018-05-10 16:42:51",
    "contentimage": "https://youpeiliangpin.oss-cn-beijing.aliyuncs.com/content/TIM%E5%9B%BE%E7%89%8720180502132735.png,https://youpeiliangpin.oss-cn-beijing.aliyuncs.com/content/TIM%E5%9B%BE%E7%89%8720180502132741.png,https://youpeiliangpin.oss-cn-beijing.aliyuncs.com/content/TIM%E5%9B%BE%E7%89%8720180502132749.png",
    "contenttemplate": "2",
    "clicks": 4,
    "status": "1",
    "createtime": "2018-05-03 10:07:45",
    "datasource": "1",
    "creatorid": "ebdda385a01e4ecb880794e0e33c7622",
    "isdelete": "1",
    "memo": null,
    "linkmanid": "ebdda385a01e4ecb880794e0e33c7622",
    "companyname": "山东得利斯食品有限公司",
    "appregisterid": null,
    "contenttypename": null,
    "contentlabelname": null,
    "shareFew": null,
    "browseNumber": null,
    "contentCount": null,
    "commentNumber": null,
    "images": null,
    "pageNum": null,
    "pageSize": null
  },
  "type": "2",
  "two": [
    {
      "appregisterid": "531c506e48a340e5bff7eb72c6504250"
    },
    {
      "appregisterid": "yucx_test_10400"
    }
  ]
}

返回说明

http 响应:json

"Content-Type": "application/json; charset=utf-8"
{
  "code":200,
  "data":{
        "msgid":1200510468189,
        "antispam":false
     }
}

主要的返回码

200、403、414、416、431、500

results matching ""

    No results matching ""