Last active
April 22, 2024 23:11
-
-
Save ompugao/94c7d2109b09436c9c5b70429b9eb38c to your computer and use it in GitHub Desktop.
message migration from mattermost to slack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import pprint | |
import csv | |
if __name__ == '__main__': | |
with open('./bulk.csv', 'w') as csvf: | |
writer = csv.writer(csvf, lineterminator='\n', quoting=csv.QUOTE_ALL) | |
with open('./bulk.json', 'r') as f: | |
i = 0 | |
while True: | |
line = f.readline() | |
if not line: | |
break | |
i+=1 | |
data = json.loads(line) | |
if data.has_key('post') and data['post'].has_key('channel'):# and data['post']['channel'] == 'off-topic': | |
#from IPython.terminal import embed; ipshell=embed.InteractiveShellEmbed(config=embed.load_default_config())(local_ns=locals()) | |
writer.writerow([data['post']['create_at']/1000, data['post']['channel'], data['post']['user'], data['post']['message'].encode('utf-8')]) | |
Any chance one could modify this to include threads?
i dont use mattermost now. fork is welcome
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://docs.mattermost.com/administration/bulk-export.html