回 1楼钉钉剑桥的帖子
protected void sendOaMsg(String title, String massageText,
String accessToken, String toUsers, String toParties,
String agentId) {
log.info(title);
log.info(accessToken);
log.info(massageText);
log.info(toUsers);
log.info(toParties);
log.info(agentId);
//发送微应用消息
try {
OAMessage oaMessage = new OAMessage();
oaMessage.message_url = "http://www.zhidianbao.cn";
//System.out.println("url:"+message_url + "&mid=" + scheduleid);
OAMessage.Head head = new OAMessage.Head();
head.bgcolor = "FFff4852";
oaMessage.head = head;
OAMessage.Body body = new OAMessage.Body();
body.title = title;
OAMessage.Body.Form form1 = new OAMessage.Body.Form();
form1.key = "";
form1.value = "";
body.form = new ArrayList();
body.form.add(form1);
OAMessage.Body.Rich rich = new OAMessage.Body.Rich();
rich.num = "";
rich.unit = "";
body.rich = rich;
body.content = massageText;
body.image = "";
body.file_found = "";
body.author = "";
oaMessage.body = body;
LightAppMessageDelivery lightAppMessageDelivery = new LightAppMessageDelivery(toUsers, toParties, agentId);
lightAppMessageDelivery.withMessage(oaMessage);
MessageHelper.send(accessToken, lightAppMessageDelivery);
log.info("发送给:" + toUsers+" 消息:"+title);
}
catch (Exception ex) {
log.error(ex.getMessage(), ex);
return;
}
finally {
}
}
sendOaMsg()是我的推送方法.
{"agentid":"9634567","msgtype":"oa","oa":{"body":{"author":"","content":"您有1张报销单已经打款,请及时进行核对,谢谢","file_found":"","form":[{"key":"","value":""}],"image":"","rich":{"num":"","unit":""},"title":"打款通知"},"head":{"bgcolor":"FFff4852"},"message_url":"http://www.zhidianbao.cn"},"toparty":"","touser":"zxx"}
这个是推送的参数。
-------------------------
Re发送oa消息出错
request url=https://oapi.dingtalk.com/message/send?access_token=60a7858ce37037d1b77a3802d8faf670,return value=
{"errcode":40035,"errmsg":"不合法的参数"}
请求 地址 和返回的结果
-------------------------
回 4楼忠恕的帖子
没有过期。我其他地方用access_toten都是正常的。
-------------------------
Re发送oa消息出错
我在 钉钉服务端API调试工具 里调试也都是可以的
-------------------------
回 4楼忠恕的帖子
这里具体是哪个参数不合法呢。现在不清楚问题在哪里
-------------------------
Re发送oa消息出错
问题解决了。谢谢你的解答