主题
更新企业微信的按钮消息 3.6.2.SP4+(不包含 3.7.1Beta1)
更新企业微信的按钮消息,前提要先发送企业微信的按钮消息 注意如果要使用消息回调,消息中心发送按钮时 ext中参数task_id 必须是mcBt_,注意mcBt_有下滑线
json
{
"sign": "{{sign}}", //请求签名:accessToken +[schoolCode+] +[第1个userID] 的MD5值
"msgType":"0",//0: 普通消息(默认)1: 必读消息2: 验证码(为验证码时消息一定不入收件箱)
"subject": "按钮消息",
"content": "按钮消息",
"pcUrl": "http://172.16.34.93:8091/router/systemConfig/messageCenter/channelManager",
"urlDesc": "详情",
"sendType": "5",//发送方式: 0.PC门户通知和移动校园同时发送(通常为此种方式) 1.只发送PC门户 2.只发送移动校园 3邮件 4短信 5微信企业号 6钉钉企业内部应用工作通知7 微信服务号
"wxSendType":"button",//当发送类型为5时此字段才会生效:text(文本消息)、textcard(文本卡片)不传默认为text
"sendNow": "true",
"isInbox": "1",//是否入收件箱 0: 否 1: 是,当msgType为2验证码时不受此字段控制,一定不入收件箱
"receiverType": "1",//1:用户2:用户组3:部门
"receivers": [//reveiverType为1时,必填,具体参数参照receivers
{
"userId": "{{userId}}",
"mobile": "手机号",
"email": "xxx@wisedu.com"
}
],
"extParams":{
"qiYeWeChatButton": " { \"card_type\" : \"button_interaction\", \"main_title\" : { \"title\" : \"欢迎使用企业微信\", \"desc\" : \"您的好友正在邀请您加入企业微信\" },\"sub_title_text\" : \"下载企业微信还能抢红包!\", \"task_id\": \"mcBt_\", \"button_list\": [ { \"text\": \"按钮1\", \"style\": 1, \"key\": \"button_key_1\" }, { \"text\": \"按钮2\", \"style\": 2, \"key\": \"button_key_2\" } ] }"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
接口说明
请求URL:http[s]://{网关地址}/mp/restful/v2/updateWorkWeiXinCard
请求方式: POST
请求内容类型: application/json
响应内容类型: application/json
请求说明
请求体
| 字段名 | 参数名 | 必填 | 类型 |
|---|---|---|---|
| 用户账号 | userAccount | M | string |
| 应消息id(消息发送2.0的返回的msgid) | msgId | M | string |
| 更新卡片的json,json对象转成的字符串,具体实例可以查看,企业微信示例中的userids、resposne_code和agentid不用传递,示例中的("partyids", "tagids" )不可以使用 ,消息中心会拼接上 https://developer.work.weixin.qq.com/document/path/94888#按钮交互型 | updateJson | M | string |
请求示例
json
{
"userAccount": "01119092", //账号
"msgId": "937429478933504", //消息id
"updateJson": " { \"button\":{ \"replace_name\": \"替换的内容\" } }"
}1
2
3
4
5
2
3
4
5
响应说明
响应体
| 字段名 | 参数名 | 类型 | 描述 |
|---|---|---|---|
| 状态码 | code | String | 0000请求成功 |
| 错误内容 | msg | string | 错误内容(里面会有消息业务错误以及企业微信返回的错误,消息只是做传递不做具体业务处理) |
响应示例
json
{
"code": "0000"
}1
2
3
2
3
错误码
| 错误码 | 描述 |
|---|---|
| 0000 | 请求成功 |
| 其他 | 失败 |
Demo
java
Client client = new DefaultClient(BASE_URL, APP_ID, APP_SECRET);
AppListRequest request = new AppListRequest();
request.setSearchContent("");
request.setUserAccount("01119092");
AppListResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
throw new Exception("获取启用通道异常:" + JSONObject.toJSONString(response));
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10

