1

I'm attempting to set up a java messenger bot. facebook keeps saying the url cannot be validated when I try to validate the webhook.

i dont see any get/post requests through ngrok or any notifications of a connection. The error appears to be in "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");

I'm expecting Facebook to authorize my token, but no token request is sent to the url at all

1 Answers1

0

For other people having this problem, you have to close the window every time you enter a new password/change something. I had fixed it but because I hadn't reopened the window it was still broken.