This is how my spring boot controller looks like:
@RestController
public class WhatsappController {
private final String VERIFICATION_TOKEN = "12345";
@GetMapping("/webhook")
public ResponseEntity<String> verifyWebhook(@RequestParam("hub.mode") String mode,
@RequestParam("hub.challenge") String challenge,
@RequestParam("hub.verify_token") String token) {
if (mode.equals("subscribe") && token.equals(VERIFICATION_TOKEN)) {
return new ResponseEntity<>(challenge, HttpStatus.OK);
} else {
return new ResponseEntity<>("Verification token or mode mismatch", HttpStatus.FORBIDDEN);
}
}
}
But when I configure ngrok URL with Whatsapp it says:
The callback URL or verify token couldn't be validated. Please verify the provided information or try again later.
Please tell me what I am doing wrong!