-3

In order to obtain the the status(online/offline) and typing state of an user in whatsApp, I used the Store.Presence.find( phonenumber+ '@c.us').then(function(r){ console.log(r)}) function after retrieveing the resultng object I always get offline status which is wrong, because I tesitfy that with my phone number.

So what are the recent functions for presence (online/offline) status and typing function in WhatsAPI ?

Sonya Blade
  • 399
  • 7
  • 24
  • `[WhatsAPI] is part of Chat API, a PHP library` so why is your question about javascript?? – Jonas Wilms Dec 22 '17 at 14:20
  • @JonasW. I wasn't even aware of that, I learned whatsApp functionality with JS and most of the examples I have seen so far was in JS even in github. Mostly there are JS libraries when its compared with PHP. I connect with WhatsApp Web and directly write the JS code in the console so I can see the immediate result, that was the reason behind of that. – Sonya Blade Dec 23 '17 at 07:04

1 Answers1

0
    var check = window.setInterval( function() {
        Store.Presence.find( phonenumber + '@c.us' ).then(  function(d) {
            if (d.isOnline) {
                console.log( phonenumber + " is ONLINE" );
                // do something with it
            }
        });
    } , 2000);

still working.

Nsarc
  • 11