体验账号 发送消息
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