Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey everyone, this was an enormous effort. Please support me to keep going!
Overview
WAM is "WhatsApp Metrics". As we all know, WhatsApp sends a lot of analytics on all its platforms. WhatsApp has exploited this fact to send some information verifying official clients. We need this to prevent the "unofficial client, install the official whatsapp" warning.
Detailed talk
All the current WAM events (harvested from Web) are available in the
./src/WAM/constants.ts
, and all the globals I saw being mentioned (there could be more). Due to the sheer amount, I'll just keep that file huge, it will get minified in TS compilation.WhatsApp sends WAM events randomly. We know there is a schedule to them, something like monthly/weekly/daily. Though in reality, if you are active, you can see this vary a lot!
WhatsApp tracks a ginormous amount of data, in the dozens of thousands of events per client per day. For this reason, they have made their own byte-efficient protocol. This protocol (WAMv5) insures that events only take as much data as they have to. This is why we keep the constants. The WAM_EVENT's/WAM_GLOBAL
ID
andNAME
properties are important as they serve a key-> value in the encoded protocol.I'll be explaining more about the protocol itself in an upcoming video.
Let's talk on what this all means for your current setup.
Usage
I have made a small example in the Example.ts file, as you can see. The first event will contain specific globals, IN THAT ORDER (The globals come before the events themselves, IN ORDER, so they seem to be ordered by alphabetical order (by event ID)).
The boot_analytics_test.json in this case is used to just contain one of the events I CAPTURED A FEW WEEKS AGO! DO NOT SIMPLY RUN THIS! Only use it as a basis for understanding. Your timestamps and sequenceNumbers and everything should be matching and your events should match what you're doing in the app (more on this later`t).
AGAIN, DO NOT RUN THIS IMMEDIATELY. YOU NEED TO MAKE SURE YOUR ANALYTICS MATCH YOUR SETUP! YOU HAVE BEEN WARNED!
In this case, we require your help! On the Discord server, in the #wam channel in a thread, I would like you guys to harvest events (using a tool I'll release soon) and correlate those events for actions made in the app)!
Development
There is a lot of place for further development for this feature, and I expect we do more soon! For now, Baileys doesn't actually send any analytics on it's own (but we can work on that!).
I'll be setting up a toolkit repository in WhiskeySockets soon, to decode captured WAMs from Baileys and WA Web to inspect their payload and verify what they're doing. It'll also contain some scripts for live event and WAM buffer capture straight from Web.
I currently have a repository (PurpShell/wam-prototype) up which contains (more than this) a decoder and sample payloads for you to test with!
Credit
Thank you to Samuel! He helped me a lot in the background, and it's only because of his constant help were we able to release something so large in a small time-frame. Thank you to my sponsors, and to all the other maintainers in the space for collectively working on understanding 2.3000.x's new build system!
Thank you Edgard for your work on Baileys, your contribution will not be missed! Thank you for the help all of these years. Good luck with what you're working on next! It was a wild run!!!