Skip to content

patcon/matterbridge-autoconfig

Repository files navigation

Matterbridge Auto-Config

App that generates a Matterbridge config file based on channel names.

This remote configuration file* is generated based on simple channel-naming rules.

NOTE: This app is based on features that are not yet implemented or merged into Matterbridge. Unimplemented features are notes with an asterisk*.<.sup>

💌 The Dream

Internationalization

Imagine that you're a member of an international Slack team, and there's a channel called #rad-project. In this channel, people are speaking Japanese, but you only speak English.

Well, this sucks, right? No problem!

Just create a new channel called #rad-project-en (with added language code), and jump in! You'll be joined by a bot who will relay and translate all non-English messages into your language. Your English responses will be relayed untranslated back to #rad-project. If your new Japanese friends don't speak English, and want to know what you're saying, just have them create #rad-project-ja, where all non-Japansese messages will be translated for them.

Transparency

(Not yet implemented.)

Imagine you are part of a team that values transparency, but you use Slack, which has a few hurdles to being able to read messages and participate. Further, some conversations and channels are necessarily more private, and perhaps not being on the public internet is a good thing for them.

Imagine that you could start a channel in Slack for semi-public conversations with the community, but then easily promote a room to being fully transparent by bridging it with Gitter, with full public chat rooms. But renaming your Slack channel from #rad-project to #rad-project-pub, your channel will automatically be bridged with the Gitter room for my-organization/rad-project. If the chat room doesn't exist, it's created. Any messages in Slack will be relayed to this public room, and vice versa. If you decide to bring things private again, just rename the channel back to #rad-project, and the bridge will be deactivated.

✨ Features

  • Supports: Slack
  • Creates translation gateways* based on language-code suffix
  • Forces Matterbridge config reload when remote config* changes

🔌 Usage

Once you've got this app running and configured, here's how it works:

  • Add a two-letter language suffix to a channel will set the locale of that channel. This will allow Matterbridge to translate incoming messages into the target language, assuming the Google Translation feature is enabled*.
    • Example: #mychannel-en
    • This feature requires that a "base channel" exists (eg. #mychannel), which will have all untranslated messages dropped into it. This ensures that team members who speak multiple languages won't be forced to read imperfect Google Translations.

💻 Local Development

Setup

We recommend using pipenv and pyenv to manage development environments.

pipenv install
cp sample.env .env
# Add your Slack API token here:
vim .env

Running

On the command line:

pipenv run python cli.py

Or, for the web app:

pipenv run python app.py

🔧 Configuration

Configuration is done via environment variables. See sample.env for details. If a .env file is present, its values will be used automatically.

SLACK_API_TOKEN (Required)

The API token from your Slack team.

You may use legacy user tokens or bot tokens. We recommend bot tokens, or otherwise the token will have access to all the user's private conversations. Also, a bot must be invited into each channel or conversation, which is added precaution in case your token gets released into the wild.

TEMPLATE_URL (Optional)

The URL of a template file that will wrap the auto-generated portion of your configuration. The string {{AUTOGENERATED}} will be replaced.

See examples/matterbridge.sample.toml.

OUTGOING_WEBHOOK_URL and OUTGOING_WEBHOOK_TOKEN (Recommended)

The full url of the /webhook endpoint enabled on your Matterbridge instance*, used to prompt Matterbridge to reload remote configuration. When channel events are detected on Slack, this autoconfig app will use this endpoint to prompt a reload of the remotely hosted configuration.

The auth token must match the one configured in Matterbridge.

🚀 Deployment

We host a version of this on Heroku. Here are the details:

  • master branch is automatically deployed there.
  • All changes are made throgh pull requests.

About

App that generates a Matterbridge config file based on channel names.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Languages