BUG如下
三月 07, 2022 10:28:52 下午 topsdk logApiError
嚴重: 2022-03-07 22:28:52.638^_^_dingtalk_^_^dingtalk.oapi.robot.send^_^172.22.192.106^_^Mac OS X^_^475^_^https://oapi.dingtalk.com/robot/send?access_token=38524de10a37cf0394f987f9924f36220f69111509dd9236032f8b3255057971^_^link=%7B%22messageUrl%22%3A%22http%3A%5C%2F%5C%2Fsam01%3A8081%22%2C%22picUrl%22%3A%22%22%2C%22text%22%3A%22%E8%BF%99%E6%98%AF%E6%88%91%E5%8F%91%E7%9A%84%E7%AC%AC%E4%B8%80%E6%9D%A1%E9%92%89%E9%92%89%E6%B6%88%E6%81%AF%22%2C%22title%22%3A%22ding+talk+test%22%7D&msgtype=link^_^{"errcode":310000,"errmsg":"keywords not in content, more: [https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq]"}
原代碼:
package com.sam;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.taobao.api.ApiException;
public class DingDingTalkTest {
public static void main(String[] args) throws ApiException {
String token = "38524de10a37cf0394f987f9924f36220f69111509dd9236032f8b3255057971";
DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=" + token);
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("link");
OapiRobotSendRequest.Link link= new OapiRobotSendRequest.Link();
link.setMessageUrl("http://sam01:8081");
link.setPicUrl("");
link.setTitle("ding talk test");
link.setText("這是我發的第一條釘釘消息");
request.setLink(link);
try{
client.execute(request);
} catch (ApiException e){
e.printStackTrace();
}
}
}
解決方法:在發送的消息那添加設置的關鍵詞
在釘釘app查看機器人的關鍵詞

代碼中添加關鍵詞
