Auties00 / Cobalt

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

PairingCodeHandler Not Working #402

Closed BasselAshi closed 9 months ago

BasselAshi commented 11 months ago

Problem

As described, running PairingCodeHandler generates a code that cannot be validated on the phone.

Observations

I noticed that using the verification code on Whatsapp Web will send a notification to my phone asking to pair and showing the validation code to be entered on Whatsapp Web. When using the library, I do not get this notification. Regardless, the verification code sent to the terminal cannot be validated on my phone.

My code looks like this (phone number redacted):

val connection = Whatsapp.webBuilder()
            .newConnection(1289*******)
            .name("WhatsAutomate")
            .unregistered(phoneNumber, PairingCodeHandler.toTerminal())
            .addLoggedInListener{ x -> println("Hello :)" + x)}
            .connect()
            .join()
Auties00 commented 11 months ago

Problem

As described, running PairingCodeHandler generates a code that cannot be validated on the phone.

Observations

I noticed that using the verification code on Whatsapp Web will send a notification to my phone asking to pair and showing the validation code to be entered on Whatsapp Web. When using the library, I do not get this notification. Regardless, the verification code sent to the terminal cannot be validated on my phone.

My code looks like this (phone number redacted):

val connection = Whatsapp.webBuilder()
            .newConnection(1289*******)
            .name("WhatsAutomate")
            .unregistered(phoneNumber, PairingCodeHandler.toTerminal())
            .addLoggedInListener{ x -> println("Hello :)" + x)}
            .connect()
            .join()

Does your phone number include the country prefix?

BasselAshi commented 11 months ago

Does your phone number include the country prefix?

Yes. The prefix is just 1 being Canada.

ht-sp commented 10 months ago

I have got the same problem using the phone number with country prefix. No notification and the generated code is not accepted by the whatsapp app.

WebOptionsBuilder webOptionsBuilder = Whatsapp.webBuilder()
    .newConnection("alias1")
    .historyLength(WebHistoryLength.ZERO);

Whatsapp whatsapp = webOptionsBuilder
    .registered()
    .orElseGet(() -> webOptionsBuilder.unregistered(...L, PairingCodeHandler.toTerminal()))
    .addLoggedInListener(api -> System.out.printf("Connected: %s%n", api.store().privacySettings()))
    .addDisconnectedListener(reason -> System.out.printf("Disconnected: %s%n", reason))
    .connect()
    .join();
linde9821 commented 10 months ago

Same issue for me. Any news regarding the problem?

Rpeche-pk commented 9 months ago

Same issue for me. Any news regarding the problem?

Auties00 commented 9 months ago

Will be fixed in cobalt 1.0

Auties00 commented 9 months ago

Fixed in 0.0.1