Slack

Slack Exports

Convert JSON exports to readable messages

import json
import sys

file = open(sys.argv[1],"r").read()
# Load the JSON data into a Python object
json_data = json.loads(file)

# Loop through the list of messages
for message in json_data:
    # Check if the message is a "message" type
    try:
        if message["type"] == "message":
            # Extract the sender's name from the user profile
            sender_name = message["user_profile"]["real_name"]

        # Print the sender's name and the message text
            print(f"{sender_name}: {message['text']}")
    except:
        pass

Last updated