Mattermost – Live import tool

Based on my previous article to export complete channels from a Mattermost server I invested some more time to build something I would call a “live importer”. The bulk import CLI can’t solve this challenge at the moment. The purpose is to migrate specific data from an existing Mattermost server to another. This might be needed when:

  1. Moving from a DEV instance to PROD and keep the history
  2. Migrating to a new server and get rid of unwanted data
  3. Generate real data to test with in a CI/CD pipeline deployment

I published the tool on GitHub: https://github.com/cjohannsen81/mattermost-liveimport

The tool can be used directly called by python ‘python importer.py’ after setting all variables in the header. The important thing is that user is authorized on each system and team and channel names match.

 

This is how the original posts look like:

 

And they are displayed like this on the new server (different channel):

 

Keep in mind that you could enable the “override_username” props in the “create_post” function but this shows a “BOT” tag behind the username.

I will add some command line parsing and error handling in the future. Feel free to contribute!

 

Leave a Reply