收藏
回答

微信智能对话-发送客服消息API?

接口 :https://chatbot.weixin.qq.com/openapi/sendmsg/{TOKEN}

问题描述:如果传错误参数,返回错误结果,但是如果传正确的参数,接口没有返回

代码中个人信息是错误的,改了一下

        String data = "\n"
                + "    \n"
                + "    \n"
                + "    \n"
                + "    0\n"
                + "    \n" +
//                "    \n" +
                "";
//用户ID
        String userid = "AaOXUPs2kURD";
//        公众号appID
        String gongzonghaoAppID = "wxcafe4bcs03dbf818e";
//        对话平台token
        String mmmm = token;
        data = String.format(data, gongzonghaoAppID, userid);
//加密
        var encrypted = cryptor.encrypt("", data);
        System.out.println(encrypted);
        JSONObject map = new JSONObject();
//        String mm="PyPczjpK7kQjaEIEC0FymU/mn0e0IrPzOAx1+kQogEu/M8H65GEIYcBdy1LSceRgbsIoBepdbjlrAE2yMmdRBdgmyRmeYAye2VcFhKtJ+htBRaEbLekLFd3iV3T1dPcKc6nMRNQgetY+96nmik+8DGNxAdJ3K4o62pAUdcjSAW4fCz821eVFGcc406tg0NqXUlVwzTVO6yAwMYlOid/vapGcjbgToy8XKLEHIqjdqeIj7u46PTAqfTU5Z/BjC3GM7hAwd0kV+QbQpRVurUMS5WOlE0z9KI3ZvgRG+iRKyAfOVbPsfJD9jXHXASegMdE9vadMVMmWRk3ms6aC/OLZR86WxgHbAfekIEEaPZ7C4+CEFP7hPRS+stALuqTFT5E4R6H+TDasL3NNAGuaevXA5vaV70wMqSbZfTcEpW3VrA81XZpiXGx7CMwuTxx/0KQJ2Oo84hxDG++0aVnSgtUq8KBjDDo5Vl/YiZHvy1zi1XNeDAnfXhWY5Y7XpaNFxWpBJwCziOWjQbaTYxmnRGf5GVeC6/YQAjDUyNA4N3Z9U3oM7ShgVdLvCql0gm/aZfDw4rtkOgQq8SAG4s2Fj0dMeKZfDQd429rsx87O/YNvYFOVtgjgPC1nZl8mGGumO8cX/NQTySxL8hvWMW8YlyShS1MD6BFFrf2YCLzlHid43AFqp1inzGRd4oGSxBBT8Ta5JEVZGL7N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ydmVL6FD7B7TGKLWpRybuAhvbsQ5FtmWrWjO0A9qsw/p8E9yGMPgXVYZ1HIZ+I36";
//        MesXml decrypt = ParseUtils.decrypt(data);
        map.put("encrypt", encrypted);
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, map.toJSONString());
        System.out.println(map.toJSONString());
        Request request = new Request.Builder().url("https://chatbot.weixin.qq.com/openapi/sendmsg/" + token)
//                .url("http://127.0.0.1:10003/chat/al/getMessgaes" )
                .post(body).addHeader("Content-Type", "application/json").build();
        Response response = client.newCall(request).execute();
        System.out.println(response.isSuccessful());
        System.out.println(response.body().string());
        System.out.println(response.body());

代码和故障如下图,


最后一次编辑于  2023-03-19
回答关注问题邀请回答
收藏

3 个回答

  • str123
    str123
    05-09

    [code] => 1019 [errcode] => 1019 [errmsg] => Mp Verify Token Error, please check the doc. [rid] => b7a542ba

    也是这个原因,可有解

    05-09
    有用
    回复
  • 方旋
    方旋
    04-24

    有结果吗?现在我也是发送不了消息。

    04-24
    有用
    回复
  • 冧
    01-23

    有后续吗 怎么发送成功的?

    01-23
    有用
    回复
登录 后发表内容