Assistance with bridging Mattermost with Nextcloud Talk

NethServer release - 7.9.2009 (final)
Nextcloud Version - 20.0.7

Hello Forum,

I’m hoping someone can point me in the right direction here on how to bridge our Nextcloud Talk to use our Mattermost Server through Matterbridge. I’ve installed Nextcloud and Mattermost on my Nethserver and both work independently very well.

I’ve installed the matterbridge app from the Talk settings.
I’m now looking at the page on setting up matterbridge - https://github.com/42wim/matterbridge

The above page references the configuration required - https://github.com/42wim/matterbridge/wiki/How-to-create-your-config

Where I select the Section Mattermost HTTPS (secure) - https://github.com/42wim/matterbridge/wiki/Section-Mattermost-(basic)#https-secure

But…

I’ve now discovered that within Talk I see where I can add settings for Matterbridge and it appears maybe I don’t need to create a matterbridge json file manually. So I’ve added in the details within this settings on Talk but I’m seeing errors in the matterbridge log:

time="2021-02-26T09:01:41-05:00" level=fatal msg="Starting gateway failed: Bridge mattermost.0 failed to start: "AppErrorFromJson: model.utils.decode_json.app_error, body: <html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n"" prefix=main

Questions for this forum:

  • Has anyone enabled Matterbridge within Nextcloud (on Nethserver) and can successfully use mattermost within Talk?

  • Do I need to still create a matterbridge json file manually or should I be able to use the settings from within Talk?

Thank you.

2 Likes

I am really interested here :smiley:

2 Likes

It works just with the GUI, no json file creation is needed.

You need to create a user in Mattermost, I created a user “matterbridge”.

Then go to Nextcloud Talk and create a conversation, I created a conversation “off-topic”.

On the right side in settings you can setup matterbridge, you need to add a new bridged channel to get the Mattermost settings to enter Mattermost URL, the created MM user, password, team and channel.

After clicking save Nextcloud creates a bot user “bridge_bot” and if you chat in the conversation in Talk then in Mattermost in the “off-topic” channel you can see the matterbridge user posting the Talk post.
Vice versa if you chat in the “off-topic” channel in Mattermost, the Talk bot “bridge-bot” presents the post in Talk.

5 Likes

Hello @mrmarkuz,

Thank you for these instructions. I’ve created a user account on my Mattermost and I’ve updated the settings on my Nextcloud Talk. I’m seeing the following error still within the log of matterbridge on Nextcloud Talk:

> time="2021-03-06T20:17:05-05:00" level=fatal msg="Starting gateway failed: Bridge mattermost.0 failed to start: "AppErrorFromJson: model.utils.decode_json.app_error, body: <html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n"" prefix=main

Any idea why I’m getting a forbidden message on Nextcloud by Admin rules?

Thank you.

In which logfile do you get this error?

You don’t need to run matterbridge manually.

Do you use a reverse proxy with Nextcloud?

You may try to disable apps to check if there’s an issue with a Nextcloud app.

1 Like

Hello @mrmarkuz,

Within Nextcloud Talk I created a conversation and in the settings of this conversation I enter in the Details to connect to my Nethserver Mattermost. Within this settings I see a “Show matterbridge log” button:

When I open the “Show matterbridge log” I see the following messages:

time=“2021-03-08T14:48:47-05:00” level=info msg=“Running version 1.22.0 afcd362c” prefix=main
time=“2021-03-08T14:48:47-05:00” level=info msg=“Parsing gateway myGateway” prefix=router
time=“2021-03-08T14:48:47-05:00” level=info msg="Starting bridge: nctalk.1 " prefix=router
time=“2021-03-08T14:48:47-05:00” level=info msg=Connecting prefix=nctalk
time=“2021-03-08T14:48:48-05:00” level=info msg=Connected prefix=nctalk
time=“2021-03-08T14:48:48-05:00” level=info msg=“nctalk.1: joining bn4u8jgt (ID: bn4u8jgtnctalk.1)” prefix=nctalk
time=“2021-03-08T14:48:48-05:00” level=fatal msg=“Starting gateway failed: Bridge nctalk.1 failed to join channel: unexpected return code” prefix=main

I’m guessing it’s related to my settings I’ve input. If I use the URL: https://swaschat.swaslab.ca I see the errors above.

But if I include the channel name in my URL I get different errors.

Hopefully this helps you to help me get this setup and working.

Thanks!

Maybe the trailing slash in the Mattermost URL makes problems?

Hmm, not sure if this is getting me closer or not but when I remove the slash at the end of the URL I now see this message in the log:

time=“2021-03-08T15:35:53-05:00” level=fatal msg=“Starting gateway failed: Bridge mattermost.0 failed to start: “AppErrorFromJson: model.utils.decode_json.app_error, body:

403 Forbidden

\nRequest forbidden by administrative rules.\n\n”” prefix=main

And now I’ve noticed that beside the checkbox to Enable the bridge I see:

Enabled (not running)

@mrmarkuz, is your mattermost connected to your Nextcloud talk and working?

Yes. Here are my settings:

and the logfile:

time="2021-03-08T21:09:37+01:00" level=info msg="Running version 1.22.0 afcd362c" prefix=main
time="2021-03-08T21:09:37+01:00" level=info msg="Parsing gateway myGateway" prefix=router
time="2021-03-08T21:09:37+01:00" level=info msg="Starting bridge: nctalk.1 " prefix=router
time="2021-03-08T21:09:37+01:00" level=info msg=Connecting prefix=nctalk
time="2021-03-08T21:09:37+01:00" level=info msg=Connected prefix=nctalk
time="2021-03-08T21:09:37+01:00" level=info msg="nctalk.1: joining c5v8pf4u (ID: c5v8pf4unctalk.1)" prefix=nctalk
time="2021-03-08T21:09:37+01:00" level=info msg="Starting bridge: mattermost.0 " prefix=router
time="2021-03-08T21:09:37+01:00" level=info msg="Connecting using login/password (sending and receiving)" prefix=mattermost
time="2021-03-08T21:09:37+01:00" level=info msg="Connecting matterbridge (team: cmb) on team.domain.tld:443" prefix=mattermost
time="2021-03-08T21:09:38+01:00" level=info msg="Found version 5.32.1.5.32.1.08a7e6ed6855cdc97fc80ad42fb0f9d7.false" prefix=matterclient
time="2021-03-08T21:09:38+01:00" level=info msg="found 5 users in team cmb" prefix=matterclient
time="2021-03-08T21:09:38+01:00" level=info msg="Connection succeeded" prefix=mattermost
time="2021-03-08T21:09:38+01:00" level=info msg="mattermost.0: joining off-topic (ID: off-topicmattermost.0)" prefix=mattermost
time="2021-03-08T21:09:38+01:00" level=info msg="Gateway(s) started succesfully. Now relaying messages" prefix=main

Did you rename a mattermost channel or team? Be careful because they still may use the old names internally.

Channel name is not needed in the URL.

Hello @mrmarkuz,

I have been playing with the names of my channels and teams in mattermost. Now I’m not sure which name is which?

Any ideas what I can do now if things have changed? Or how I can check the internal channel name and team name?

Thank you.

In Mattermost if you go to “Rename Channel” you can set the name and the URL.
I tested to rename a channel name and URL and matterbridge is still working so I think this isn’t an issue.

Maybe create a new channel for testing?

Did you add an .htaccess file manually?

No I haven’t made any changes to my .htaccess file. I do use HAProxy to manage my secure connections to WebTop, Nextcloud and Mattermost.

Do you use Pf/Opnsense?

No, I don’t use Pf/Opensense.

We use Untangle as our Security Router - UTM and have a port forward rule to our HAProxy.

Thanks.

Hello,

I’ve still not been able to bridge our Mattermost with our Nextcloud. So I think I’ll try another avenue.

We use ejabberd on Nethserver to allow our Webtop chat app so our employees can chat through Webtop. But not all our employees use Webtop mail but they all use Nextcloud. Could I have assistance with what settings within the Nethserver hosted Nextcloud Matterbridge App to connect our Nextcloud to our ejabberd server also running on Nethserver.

Thank you.