There is a keybase widget for the grin.mw website.
Maybe this implementation can give some hints.
It is limited to 100 messages. Not sure how feasible it would be to page through everything and dump it into JSON and HTML, as well as saving all the attachments.