How to programmatically scroll up conversation in WhatsApp web

Please, how to create a script which would programmatically scroll up conversation in WhatsApp web, up to the very start. Doing it manually is excruciatingly slow and dull.
I was thinking about using Puppeteer, whatsapp-web.js or Greasemonkey/ Tampermonkey.

Background:

The best way to backup WhatApp conversation I found so far is to use WhatsApp Web and manually scroll to the beginning and then use SingleFile (browser extension) to store it as HTML. It works like a charm – it preserves the original chat look, it include image thumbnails and is essentially without limit how far you can go, no backup message limit.
I saved conversations like this that were kilometres long 🙂
Result is one neat HTML file, searchable and good looking.

Challenges:

  • WhatsApp needs to be logged in. After first successful login WhatsApp rememberers you (cookies?) and automatically opens the app. So this should not be a problem.
  • Opening correct conversation – I can do this manually.
  • The conversation is in a div with scrollable overflow.
  • The script should basically emulate mouse scrolling over that div.
  • It cannot be done too aggressively to avoid potential ban (??).

Puppeteer – looks like a lot of work and I’m unfortunately a skilled JS developer; I’m a Java developer. Puppeteer seems to be used mainly for UI testing.
I’m not sure if I can use Puppeteer on already opened page.

whatsapp-web.js is a high level API, which I like; it is based on Puppeteer, but it’s intended mainly for bots. It has API methods like fetchMessages(), which return only text, but not methods for scrolling conversation up.

Greasemonkey/Tampermonkey – I have no experience; they look like my best bet.

I appreciate solution in any of those above. The simpler the better.