Every time I manage to connect correctly with the whatsapp qrcode, but when I try to reconnect to send a message or something, it doesn't return the object with ".registered()" it always ends up coming empty, here's the problem code, is there something wrong? In this case, it returns optionalWhatsapp as false
public Whatsapp executeOnReconnection(UUID id) {
Optional<WebOptionsBuilder> webOptionsBuilder = Whatsapp.webBuilder().newOptionalConnection(id);
log.info(String.format("webOptionsBuilder: %s", webOptionsBuilder.isPresent()));
if (webOptionsBuilder.isPresent()) {
Optional<Whatsapp> optionalWhatsapp = webOptionsBuilder.get().registered();
log.info(String.format("optionalWhatsapp: %s", optionalWhatsapp.isPresent()));
if (optionalWhatsapp.isPresent()) {
Whatsapp whatsapp = optionalWhatsapp.get();
whatsapp.addDisconnectedListener(onDisconnectedActions::onDisconnected);
whatsapp.addNewMessageListener(newMessageActions::onNewMessage);
whatsapp.reconnect().join();
return whatsapp;
}
}
throw new RuntimeException("Timeout");
}
Every time I manage to connect correctly with the whatsapp qrcode, but when I try to reconnect to send a message or something, it doesn't return the object with ".registered()" it always ends up coming empty, here's the problem code, is there something wrong? In this case, it returns optionalWhatsapp as false