工作通知可以 参考以下几点:
1,
开发者后台统一登录 - 钉钉统一身份认证 里面的
发送企业会话消息
2.代码地址
GitHub - ddtalk/HarleyCorp: 企业接入的Demo 里面的 src\com\alibaba\dingtalk\openapi\demo\utils\HttpHelper.java
3 ,调用实例:
publicString sendMessage2(){
String url=DingConstant.
Send_Message_Url.replace(
"ACCESS_TOKEN", AccessToken.
getAccessToken().getToken());
System.
out.println(
"----------"+url);
JSONObject image=
newJSONObject();
JSONObject text=
newJSONObject();
text.put(
"content",
"你好测试消息接口");
image.put(
"text", text);
image.put(
"msgtype",
"text");
image.put(
"agentid",
"");
image.put(
"touser",
"");
System.
out.println(image.toString());
JSONObject result=
null;
HttpHelper h=
newHttpHelper();
try{
result=
h.
httpPost
(url, image);
}
catch(OApiException e) {
//
TODO
Auto-generated catch block
e.printStackTrace();
}
System.
out.println(result.toString());
returnresult.toString();
}