Mattermost Platform

Mattermost Recipe: How to sync existing chat systems with Mattermost

Here’s the next installment in our Mattermost Recipes series.

The goal of these posts is to provide you with a solution to a specific problem, a discussion about the details of the solution and some tips about how to customize it to suit your needs perfectly.

If there’s a Recipe you want us to cook up in the future, drop us a line on our forum.

Problem

Most Mattermost prospects and customers have used a tool for simple chat in the past.

Others have sophisticated collaboration platforms and need to keep two or more systems up and running while they migrate to Mattermost.

In most cases, this is either due to financial considerations (e.g, “We already paid for it!”) or organizational challenges (e.g., “We can’t move everybody to Mattermost immediately!”).

In either case, organizations start wondering how to keep an existing chat system up and running while establishing Mattermost as their new workstream collaboration solution because they don’t want to lose their existing chats or force everyone to the new platform overnight.

You could always use webhooks and write a plugin.

But there’s an easier way forward: a tool called Matterbridge, which allows you to create a link between tools like Slack and Hipchat to Mattermost so you can migrate without losing your data.

Solution

For the purposes of this Recipe, we will focus on migrating from Slack to Mattermost.

Here’s what you need to do:

1. Create a virtual machine to host Matterbridge

After setting up Go, grab the binaries using:

    
cd $GOPATH
go get github.com/42wim/matterbridge
    

2. Start configuring the Matterbridge binary

Now that the Matterbridge binary is available, configuration can begin.

If you want everything that’s posted in a Slack channel available in a Mattermost channel (Slack-synced), you first need to create the Slack API token (instructions here).

Once that’s done, your configuration file should look like this:

    
[slack]
[slack.clickedways] 
Token="TOKEN"  
PrefixMessagesWithNick=true

[mattermost]
[mattermost.work] 
Server="MATTERMOST:8065" 
NoTLS=true 
Team="dach" 
Login="USERNAME" sd
Password="PASSWORD" 
PrefixMessagesWithNick=true 
RemoteNickFormat="[{PROTOCOL}]  "

[[gateway]]
name="mygateway"
enable=true 
[[gateway.inout]] 
account="slack.clickedways" 
channel="testchannel" 
[[gateway.inout]] 
account="mattermost.work" 
channel="slack-synced"
    

3. Start Matterbridge

Now that Matterbridge is configured, start it up:

./matterbridge

4. Set up Matterbridge

Set up Matterbridge as a service, a Docker container or even a Mattermost plugin.

Matterbridge output
/matterbridge output

Everything written in a Slack channel should now be visible in a corresponding Mattermost channel. You should be able to search for and comment on existing conversations that originated on Slack.

Slack channel view
 Slack channel view

The “RemoteNickFormat” can be customized in the configuration file to meet your unique requirements.

Mattermost synced message
Mattermost synced message

Currently, Matterbridge supports several different messaging protocols and chat solutions (e.g., XMPP, Discord, Telegram, Slack and IRC).

If you use any of these systems, you can keep your team happy on your familiar platform while keeping the folks on Mattermost up-to-date.

Discussion

Matterbridge, a self-hosted Go application, was created by Wim to serve as a bridge between Mattermost and IRC, Gitter, XMPP, Slack, Discord, Telegram, Rocket.Chat, Hipchat (via XMPP), Steam, Twitch, ssh-chat, Zulip and Matrix with REST API.

The open source tool can be installed with a few simple commands.

You can use Matterbridge to migrate users from one of the supported platforms to Mattermost without losing any of your older chats. You can also use it to ensure that employees using an old chat platform can communicate with users on your newly deployed Mattermost instance.

(Editor’s noteThis post was written by Christian Johannsen, Solution Architect at Mattermost, IncIf you have any feedback or questions about Mattermost Recipe: How to sync existing chat systems with Mattermost, please let us know.)

mm

Christian Johannsen is a former Solutions Architect at Mattermost, covering the EMEA region. Prior to joining Mattermost, Christian worked in IT for nearly 20 years and served as a VMware consultant for integration and automation. Being a specialist in the virtualization space, he wanted to get more involved with the DevOps scene. His experience in these areas is what allowed him to help customers integrate the Chef framework into new and existing environments. With these skills, he decided to focus more on ChatOps solutions and helping customers collaborate more effectively using Mattermost. Follow him on Twitter: @cjohannsen81.