Auties00 / Cobalt

Standalone unofficial fully-featured Whatsapp Web and Mobile API for Java and Kotlin
MIT License
616 stars 180 forks source link

"No routes" error while using mobile builder #413

Closed hayimzvik closed 7 months ago

hayimzvik commented 8 months ago

I am attempting to register a new number as a mobileBuilder using the code snippet below. However, I am encountering a "no_routes" error from the registration phase ("/code"). I have tried multiple prepaid numbers from the same provider in Cyprus, but the issue persists. I'm using numbers that never had a WhatsApp account installed on them if it is relevant. I can get the SMS using an actual device, so the problem isn't the number itself, I think. Am I doing something wrong? Thanks!

Code:

Whatsapp api = Whatsapp.mobileBuilder()
        .newConnection()
        .unregistered()
        .verificationCodeMethod(VerificationCodeMethod.SMS)
        .verificationCodeSupplier(() -> {
            System.out.println("Enter OTP: ");
            var scanner = new Scanner(System.in);
            return CompletableFuture.completedFuture(scanner.nextLine());
        })
        .register(357XXXXXXL)
        .join();

Error:

 Exception in thread "main" java.util.concurrent.CompletionException: 
 it.auties.whatsapp.exception.RegistrationException: 
 VerificationCodeResponse[number=357XXXXXXX, 
            lid=0, status=ERROR, errorReason=NO_ROUTES, method=null, 
            codeLength=0, notifyAfter=0, retryAfter=3600, 
            voiceLength=0, voiceWait=0, smsWait=0, whatsappOtpWait=0, 
            flashType=0, oldWait=0, securityCodeSet=false, 
            whatsappOtpEligible=false, imageCaptcha=null, 
            audioCaptcha=null]
ItzmeSwapy commented 8 months ago

did it work?

wanxings commented 7 months ago

This is normal. Due to WhatsApp’s risk control, an Authorization parameter is missing in the request header.