This Python package exports WhatsApp backup chat to JSON or HTML:
https://github.com/KnugiHK/WhatsApp-Chat-Exporter
It also links to a Telegram exporter.
https://github.com/KnugiHK/WhatsApp-Chat-Exporter
It also links to a Telegram exporter.
Telegram has this natively already