The Messages Saver for Facebook extension can download chats from your Facebook account in 4 various formats:
The DM Saver for Instagram extension can download chats from instagram.com.
You can download them all at once or one by one.
You can save a chat as an HTML file or a ZIP archive.