Rhymen / go-whatsapp

WhatsApp Web API
MIT License
2.08k stars 491 forks source link

How to check whether it is possible to send a message, whatsapp phone numbers? #373

Closed Diden05 closed 4 years ago

Diden05 commented 4 years ago

Is it possible, somehow, before sending a message to find out if the recipient has an installed Whatsapp application?

I thought you could use the Exist function, but did not find what this or that code means.

beshoo commented 4 years ago

Do not spam, just send your contact.

Regard

On Sat, 23 May 2020, 10:16 am Denis Didenko, notifications@github.com wrote:

Is it possible, somehow, before sending a message to find out if the recipient has an installed Whatsapp application?

I thought you could use the Exist function, but did not find what this or that code means.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Rhymen/go-whatsapp/issues/373, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDLT25KPFR6ZNEXFBBQWSLRS5Z3TANCNFSM4NIKUGGQ .

Diden05 commented 4 years ago

Do not spam, just send your contact. Regard

And who said about spam, there are many scenarios when you need to check if the phone has a whatsapp.

beshoo commented 4 years ago

It is just an advice. sorry for the inconvenience

beshoo commented 4 years ago
        value, err : wh.Wac.Exist(wa.WidJidFromNumber(phoneNumber+"@s.whatsapp.net"));
        if err != nil {
                          fmt.Printf("Error: ", err)
        }
               fmt.Printf("json: ", value)

https://github.com/Rhymen/go-whatsapp/blob/18dafd1f0c73172eeeaaaf7022c8b7e8518d480b/contact.go#L89

Diden05 commented 4 years ago
        value, err : wh.Wac.Exist(wa.WidJidFromNumber(phoneNumber+"@s.whatsapp.net"));
        if err != nil {
                          fmt.Printf("Error: ", err)
        }
               fmt.Printf("json: ", value)

https://github.com/Rhymen/go-whatsapp/blob/18dafd1f0c73172eeeaaaf7022c8b7e8518d480b/contact.go#L89

Excellent thank you!

Maybe you know the answer to another question, but how to check the activity of your connection, is everything all right, can I send a message?

beshoo commented 4 years ago

Sure


pong, err := wac.AdminTest()

    if !pong || err != nil {
        log.Fatalf("error pinging in: %v\n", err)
    }
Diden05 commented 4 years ago

Thanx!

beshoo commented 4 years ago

Thanx!

Glad to help you... Have a great day

Diden05 commented 4 years ago

@beshoo Perhaps you know, another question arose, is it possible to add a contact to your contact list? So that you can normally correspond with a person?

beshoo commented 4 years ago

No. 😉

On Fri, 29 May 2020, 11:22 am Denis Didenko, notifications@github.com wrote:

@beshoo https://github.com/beshoo Perhaps you know, another question arose, is it possible to add a contact to your contact list? So that you can normally correspond with a person?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Rhymen/go-whatsapp/issues/373#issuecomment-635842494, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDLT2ZZABROA2I7VNP2VTTRT5WF7ANCNFSM4NIKUGGQ .

Diden05 commented 4 years ago

No. 😉 On Fri, 29 May 2020, 11:22 am Denis Didenko, @.***> wrote: @beshoo https://github.com/beshoo Perhaps you know, another question arose, is it possible to add a contact to your contact list? So that you can normally correspond with a person? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#373 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDLT2ZZABROA2I7VNP2VTTRT5WF7ANCNFSM4NIKUGGQ .

Thank you, I decided these questions :)