Code to accompany https://intuitiveexplanations.com/tech/messenger.
NOTE: This is somewhat of a historical artifact, because companies like Facebook are always changing their internal APIs, both for legitimate optimization purposes as well as simply to keep end users from having too much control over their digital lives. So, the current code does not work exactly as printed without a bit of tweaking.
Updating the code would bring it out of sync with the blog post and cause confusion, so I'm leaving it be for the moment. But, you can see Unzuckify for the code that inspired the blog post, which I am keeping up to date (at least for the next few years, before I drop support for Messenger entirely).
By combining Messyger and Unzuckify, and perhaps some debugging skills of your own, I think you'll be able to get something working if you really want to.