telematrix/README.md

68 lines
3.1 KiB
Markdown
Raw Normal View History

2016-09-25 20:30:15 -04:00
# telematrix
2016-11-14 05:14:36 -05:00
A bridge between Telegram and [Matrix](http://matrix.org/). Currently under development — this project isn't considered to be in a usable state right now.
2016-09-26 05:34:46 -04:00
## Usage
After the [installation](#installation), follow these steps to bridge a matrix room to a telegram group chat or channel:
- Invite the bot to the telegram chat.
- Send `/alias` in the telegram chat.
- The bot will answer with an alias, something like `#telegram_-XXXXXXXXX:yourserver.example`. Add that as an alias to the matrix room you want to bridge.
In case it doesn't work make sure that all these are true:
2017-10-15 14:41:09 -04:00
- You are on the same server as the bridge. If that is not the case, you can't set the alias, because you can only set aliases on the server you are on.
- The matrix room is not set to invite only. The bridge currently doesn't support invite only rooms, so the rooms must be set to be open for all. Guests access is not required though.
## Installation
### Dependencies
First, create a virtualenv and activate it:
```bash
virtualenv venv -p $(which python3)
. venv/bin/activate
```
Then install the requirements using pip:
```bash
pip install -r requirements.txt
```
### Configuration
2016-11-15 01:45:09 -05:00
**telematrix configuration**
First, copy config.json.example to config.json. Then fill in the fields:
2016-11-15 04:06:41 -05:00
* `tokens.hs`: A randomly generated token
* `tokens.as`: Another randomly generated token
* `tokens.telegram`: The Telegram bot API token, as generated by @BotFather
* `tokens.google`: A Google API key, used for URL shortening. Can be left out to disable.
* `hosts.internal`: The homeserver host to connect to internally.
* `hosts.external`: The external domain of the homeserver, used for generating URLs.
* `hosts.bare`: Just the (sub)domain of the server.
* `user_id_format`: A Python `str.format`-style string to format user IDs as
* `db_url`: A SQLAlchemy URL for the database. See the [SQLAlchemy docs](http://docs.sqlalchemy.org/en/latest/core/engines.html).
* `bot_owners`: A list of matrix users the bot won't use a `<username>` prefix for. Can be left blank to print a prefix for all matrix users. Useful if you would like the bridge to replace Telegram for yourself, but also want to allow others to use the Matrix room.
2017-10-30 10:09:35 -04:00
* `print_url_with_image`: Set to `false` to disable sending the Matrix url of an image to Telegram.
2016-11-15 01:45:09 -05:00
**Synapse configuration**
2016-11-15 04:12:30 -05:00
Copy asconfig.yaml.example to asconfig.yaml, then fill in the fields:
* `url`: The host and port of telematrix. Most likely `http://localhost:5000`.
* `as_token`: `token.as` from telematrix config.
* `hs_token`: `token.hs` from telematrix config.
The rest of the config can be left as is. Finally, add a relative path to this config file in the Synapse's homeserver.yaml:
```yaml
app_service_config_files:
- "../telematrix/asconfig.yaml"
```
2016-09-26 05:34:46 -04:00
## Contributions
Want to help? Awesome! This bridge still needs a lot of work, so any help is welcome.
2016-11-14 05:14:36 -05:00
A great start is reporting bugs — if you find it doesn't work like it's supposed to, do submit an issue on Github. Or, if you're a programmer (which you probably are, considering you are on this website), feel free to try to fix it yourself. Just make sure Pylint approves of your code!