whatsappwhatsapi

Whatsapp Web - how to access data now?


It used to be possible to access http://web.whatsapp.com/ with the Store object in JavaScript. A few hours ago, this stopped working. How does it update chat data now? It must save the data somewhere.


Solution

  • I'm using this to get the Store again:

    setTimeout(function() {
    // Returns promise that resolves to all installed modules
    function getAllModules() {
        return new Promise((resolve) => {
            const id = _.uniqueId("fakeModule_");
            window["webpackJsonp"](
                [],
                {
                    [id]: function(module, exports, __webpack_require__) {
                        resolve(__webpack_require__.c);
                    }
                },
                [id]
            );
        });
    }
    
    var modules = getAllModules()._value;
    
    //  Automatically locate modules
    for (var key in modules) {
     if (modules[key].exports) {
            if (modules[key].exports.default) {
                if (modules[key].exports.default.Wap) {
                    store_id = modules[key].id.replace(/"/g, '"');
                }
            }
        }
     }
    
    }, 5000);
    
    function _requireById(id) {
    return webpackJsonp([], null, [id]);
    }
    // Module IDs
    var store_id = 0;
    var Store = {};
    
    function init() {
     Store = _requireById(store_id).default;
     console.log("Store is ready" + Store);
    }
    
    setTimeout(function() {
     init();
    }, 7000);
    

    Just copy&paste on the console and wait for the message "Store is ready". Enjoy!