我正在尝试设置一个 java messenger 机器人。当我尝试验证 webhook 时,facebook 一直说无法验证 url。
我没有通过 ngrok 看到任何获取/发布请求或任何连接通知。该错误似乎在“platform.getVerifyWebhook().challenge()”中。
// Verify Token Route
get("/bot", (request, response) -> {//called when user first loads page
System.out.println("get has been called");
BotPlatform platform = new BotPlatform("src/main/java/resources/config.properties");
platform.getVerifyWebhook().setHubMode((request.queryParams("hub.mode") != null) ? request.queryParams("hub.mode") : "");
if(request.queryParams("hub.verify_token") == null) System.out.println("null hub token passed");//for debugging
platform.getVerifyWebhook().setHubVerifyToken((request.queryParams("hub.verify_token") != null) ? request.queryParams("hub.verify_token") : "");
platform.getVerifyWebhook().setHubChallenge((request.queryParams("hub.challenge") != null) ? request.queryParams("hub.challenge") : "");
if (platform.getVerifyWebhook().challenge()) {
System.out.println("challenge successful!");
platform.finish();
response.status(200);
return (request.queryParams("hub.challenge") != null) ? request.queryParams("hub.challenge") : "";
}
System.out.println("its not accepting our webHook...");
platform.finish();
response.status(403);
return "Verification token mismatch";
});
System.out.println("we made it past get");
我期待 Facebook 授权我的令牌,但根本没有令牌请求发送到 url