发送应用消息(message/user/send)

使用场景: 发送企业微信应用消息、家校消息给指定范围或用户。

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持
机构凭证 支持 -

请求方式: POST(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/message/user/send?access_token=ACCESS_TOKEN

请求包体

{
    "org_id": 523,
    "userids": [
        {
            "userid": "userid",
            "child_userid": "child_userid"
        },
        {
            "userid": "userid2"
        }
    ],
    "department_ids": [
        10012,
        10013
    ],
    "app_para": "abcdef",
    "msg_type": "miniprogram",
    "toall": 0,
    "message": {
        "title": "{UserName},你的会议室预订成功",
        "content": "123",
        "pic_url": "http://res.mail.qq.com/node/doc/test_pic_msg1.png"
    }
}

参数说明:

参数 必须 说明
access_token 调用接口凭证,使用用户态access_token,由/open/access_token获得
org_id 推送目标用户或架构所在的机构id
userids.userid 教职工id/家长id(最多支持1000个),家校消息的发送对象为家长,应用消息的发送对象为教职工
userids.child_userid 孩子id,表示发给家长的指定孩子
department_ids 指定接收消息的部门,部门id列表(最多支持100个)。说明:暂不支持部门消息发送
app_para 透传参数,由应用侧定义,消息跳转时作为参数传给应用,推荐用base64编码,如果这个参数是json串base64编码,且含有字段EduRedirectUri,会走兜底应用推送企微消息
msg_type miniprogram:小程序消息(家校消息、应用消息皆支持),news:图文消息(限H5应用,家校消息、应用消息皆支持),markdown:markdown消息(限H5应用,仅支持应用消息) ,text:文本消息,textcard:文本卡片消息(仅支持应用消息)
toall 1表示发送给学校的所有家长,默认为0(只支持家校消息)
message.title 消息标题,长度限制4-12个汉字。当推送目标用户为指定用户(非部门)时,可以使用个性化标题。Title传参形式为:“{UserName},你的会议室预订成功”,推送的消息标题会转换为:“张小明,你的会议室预订成功”。发送家校消息时,推送目标为学生的消息,title中的UserName会替换为学生姓名;推送目标为家长的消息,title中的UserName会替换为家长姓名
message.content 消息内容。msg_type=markdown/text/textcard时必填
message.pic_url 图文消息的图片链接,支持JPG、PNG格式,较好的效果为大图 1068455,小图150150

返回结果:

{
    "errcode": 0,
    "errmsg": "ok",
    "msgid" : "123456"
}

参数说明:

参数 说明
errcode 返回码
errmsg 对返回码的文本描述内容

发送小程序订阅消息(message/corp/send_mp_subscribe)

请求方式: POST(HTTPS)

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 未支持
机构凭证 支持 -

请求地址: https://jz.hasmartedu.com/oapi/message/corp/send_mp_subscribe?access_token=ACCESS_TOKEN

请求参数:

参数 是否必须 说明
access_token 调用接口凭证,使用corp_access_token,由/service/get_corp_token获得
corpid 推送目标用户或架构所在的机构id
userid 指定接收消息的成员,成员id列表,最多支持1000个
app_para 透传参数,由应用侧定义,消息跳转时作为参数传给应用
template_id 所需下发的订阅模板id
content 模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } }
miniprogram_state 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版

请求包体:

{
    "corpid": 1010454,
    "userid": ["3724065635","3724328080"],
    "app_para": "abcdef",
    "template_id": "y345adsfsdfasdfsfd",
    "content": {
      "number01": {
          "value": "339208499"
      },
      "date01": {
          "value": "2015年01月05日"
      },
      "site01": {
          "value": "腾讯大厦"
      } ,
      "site02": {
          "value": "深南大道10000号"
      }
   }
}

返回结果:

{

   "errcode" : 0,
   "errmsg" : "ok",
   "msgid" : "123456"

}

参数说明:

参数 说明
errcode 返回码
errmsg 对返回码的文本描述内容

发送公众号模板消息(message/wechat/template/send)

使用场景: 发送公众号模板消息。

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持

请求方式: POST(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/message/wechat/template/send?access_token=ACCESS_TOKEN

请求包体

{
    "userid_list": ["111", "222"],
    "template_id": "abcdef",
    "url": "miniprogram",
    "official_account_id": "wxaaaaa",
    "mp": {
        "appid": "",
        "page_path": "index?foo=bar"
    },
  "data": {
    "keyword1":{
      "value":"巧克力"
    }
  }
}

参数说明:

参数 必须 说明
access_token 调用接口凭证,使用机构态access_token,由/open/access_token获得
userid_list 用户id
template_id 模板ID
url 模板跳转链接,可以传任意地址,如果要走教育号单点登录,唤起地址可以设置为https://sso.qq.com/open/oauth2/authorize?appid={教育号appid}&redirect_url={url_encode(http://xxxxxxxxxxxxxxxxxx)} 用户点击模板消息的时候,会带着教育号code跳转到redirect_url的地址
mp.appid 所需跳转到的微信小程序appid, appid为微信小程序appid
mp.page_path 所需跳转到小程序的具体页面路径,支持带参数
data 模板数据
color 模板内容颜色
official_account_id 指定发送的公众号appid

返回结果:

{
    "errcode": 0,
    "errmsg": "ok"
}

参数说明:

参数 说明
errcode 返回码
errmsg 对返回码的文本描述内容

获取公众号模板消息列表(message/wechat/template/get_list)

使用场景: 发送公众号模板消息。

权限说明

权限项 说明 备注
应用是否需要申请白名单 需要
用户凭证 支持

请求方式: GET(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/message/wechat/template/get_list?access_token=ACCESS_TOKEN&official_account_id=wx1111

参数说明:

参数 必须 说明
access_token 调用接口凭证,使用机构态access_token,由/open/access_token获得
official_account_id 公众号appid

返回结果:

{
    "errcode": 0,
    "errmsg": "ok",
    "template_list": [{
        "template_id": "iPk5sOIt5X_flOVKn5GrTFpncEYTojx6ddbt8WYoV5s",
        "title": "领取奖金提醒",
        "primary_industry": "IT科技",
        "deputy_industry": "互联网|电子商务",
        "content": "{ {result.DATA} }\n\n领奖金额:{ {withdrawMoney.DATA} }\n领奖  时间:    { {withdrawTime.DATA} }\n银行信息:{ {cardInfo.DATA} }\n到账时间:  { {arrivedTime.DATA} }\n{ {remark.DATA} }",
        "example": "您已提交领奖申请\n\n领奖金额:xxxx元\n领奖时间:2013-10-10 12:22:22\n银行信息:xx银行(尾号xxxx)\n到账时间:预计xxxxxxx\n\n预计将于xxxx到达您的银行卡"
  }]
}

参数说明:

参数 说明
errcode 返回码
errmsg 对返回码的文本描述内容
template_list 模板列表,一个公众号只能有25个模板
template_list.template_id 模板id,发送消息时需要传入
template_list.title 模板标题
primary_industry 模板所属行业的一级行业
deputy_industry 模板所属行业的二级行业
content 模板内容
example 模板示例
© 1998 - 2021 Tencent Inc. All Rights Reserved all right reserved,powered by ePaaS.更新时间: 2025-01-09 17:17:38

results matching ""

    No results matching ""

    results matching ""

      No results matching ""