zl程序教程

您现在的位置是:首页 >  硬件

当前栏目

钉钉群 自动回复机器人 打造

机器人自动 打造 回复
2023-09-27 14:25:19 时间

开发文档

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;
    }