體驗賬號 發送消息
WxCpInMemoryConfigStorage config = new WxCpInMemoryConfigStorage();
config.setCorpId("wx26728386add7dbe2"); // 設置微信企業號的appid
config.setCorpSecret("QYV_cZq7fgMAyQ9Z1wgGj-7-xqaDiLcb6qs4t5t4dtd5Nl8-vaN8-FnC_N38zPZO"); // 設置微信企業號的app
// corpSecret
config.setAgentId("0"); // 設置微信企業號應用ID
config.setToken("HpMLv2I3jR44fKh8i92y3Jm3Q"); // 設置微信企業號應用的token
config.setAesKey("wEUIokdCAktg0pRhtwFk5zce96KC8javdSNQPnQAgwv"); // 設置微信企業號應用的EncodingAESKey
WxCpServiceImpl wxCpService = new WxCpServiceImpl();
wxCpService.setWxCpConfigStorage(config);
WxCpMessage message = WxCpMessage.TEXT().agentId("0") // 企業號應用ID
.toUser("").content("sfsfdsdf").build();
// 設置消息的內容等信息
try {
System.out.println("msg json :" + message.toJson());
wxCpService.messageSend(message);
} catch (WxErrorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
msg json :{"agentid":"0","msgtype":"text","text":{"content":"sfsfdsdf"}}
me.chanjar.weixin.common.exception.WxErrorException: 微信錯誤 errcode=60011, errmsg=no privilege to access/modify contact/party/agent
json:{"errcode":60011,"errmsg":"no privilege to access/modify contact/party/agent "}
at me.chanjar.weixin.cp.api.WxCpServiceImpl.execute(WxCpServiceImpl.java:385)
微信錯誤 errcode=60011, errmsg=no privilege to access/modify contact/party/agent