public static void main(String args[]){
// 获取token
JSONObject json = new JSONObject();
json.put("appKey", "应用程序的唯一标识符");
json.put("appSecret", "应用程序(App)的密钥");
String URL = "https://api.dingtalk.com/v1.0/oauth2/accessToken";
String TOKEN = null;
try {
TOKEN = HttpRequest.post(URL).body(json.toString()).timeout(10000).execute().body();
JSONObject tokenJson = JSONObject.parseObject(TOKEN);
if (tokenJson.containsKey("accessToken")) {
String sendUrl = "https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend";
TOKEN = tokenJson.getString("accessToken");
JSONObject sendParam = new JSONObject();
sendParam.put("x-acs-dingtalk-access-token", TOKEN);
JSONObject body = new JSONObject();
body.put("robotCode", "robotCode");// 机器人代码(robotCode)是标识一个机器人的唯一字符串,需要与你在钉钉后台所创建的机器人一致。
body.put("userIds", userIds);// 钉钉管理后台员工UserID
body.put("msgKey", "sam
05-31
2532
2532

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



