開發文檔
https://open.dingtalk.com/document/tutorial/create-a-robot
內網穿透的方法
機器人接口api
https://www.cnblogs.com/kaibindirver/p/12558358.html
開發者后台
實際你@機器人的時候他就會往你配置的接口post發送信息
我這里沒用阿里雲給框架自己寫了個demo
@RequestMapping("/xxx")
public Object deleteKnowledge(@RequestBody(required = false) JSONObject json){
//接收群里@機器人發的東西
System.out.println(json);
String content = json.getJSONObject("text").get("content").toString().replaceAll(" ", "");
System.out.println(content);
String url = "https://oapi.dingtalk.com/robot/send?access_token=3ee060351ba863abbff8c2c5ccd442347edb6acc7e45ea1ddc4ac7b701f51e31";
Map map2=new HashMap();
String json2="{content:\"主人,收到!\"}";
JSONObject jo = JSONObject.parseObject(new String(json2));
map2.put("msgtype","text");
map2.put("text",jo);
// 發送請求
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url,map2,String.class);
return content;
}