Warning
This script was written for a course to learn Ruby. For real usecases, you should look at more elaborate/robust implementations like this or this!
Note
Media and attachments are not supported!
Process Whatsapp chat exports programmatically with ruby.
- Export your Whatsapp chat without media
- See Whatsapp FAQ
- Place the resulting
.txt
file in the same folder as thisREADME.md
- Make sure ruby version >=3 is installed
- Use the provides nix flake if you can
- Create your own driver file (see main.rb for reference usage)
# Define process lambda function.
process = lambda do |msg|
author = msg[:author]
date = msg[:date]
content = msg[:content]
# Do whatever you want with this.
end
# Open file and create parser.
file = File.readlines('input.txt', chomp: true)
parser = Parser.new(file, process_read_fn)
# Start parsing!
parser.parse()
# Execute the script.
ruby your_file.rb