Last active
January 11, 2024 11:12
-
-
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')]) |
Can you provide more detail on which export tool should I use to create the input file for this script?
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
change
data['post']['create_at']
todata['post']['create_at']/1000
as mattermost export timestamp in millisecond otherwise slack will give (undetailed) error faling the import.