2019-02-17 05:46:00 -05:00
|
|
|
# Matrix Webhook
|
2019-02-10 16:02:48 -05:00
|
|
|
|
2019-02-17 05:46:00 -05:00
|
|
|
Post a message to a matrix room with a simple HTTP POST
|
2019-02-10 19:32:57 -05:00
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2019-02-17 06:31:49 -05:00
|
|
|
Create a matrix user for the bot, make it join the rooms you want it to talk into, and then set the following
|
|
|
|
environment variables:
|
2019-02-10 19:32:57 -05:00
|
|
|
|
2019-02-10 19:56:50 -05:00
|
|
|
- `MATRIX_URL`: the url of the matrix homeserver
|
|
|
|
- `MATRIX_ID`: the user id of the bot on this server
|
|
|
|
- `MATRIX_PW`: the password for this user
|
2019-02-10 19:32:57 -05:00
|
|
|
|
|
|
|
## Dev
|
|
|
|
|
|
|
|
```
|
|
|
|
pip3 install --user matrix-client
|
2019-02-17 06:15:27 -05:00
|
|
|
./matrix_webhook.py
|
2019-02-10 19:32:57 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
## Prod
|
|
|
|
|
2019-02-17 06:29:50 -05:00
|
|
|
- Use [Traefik](https://traefik.io/) on the `web` docker network, eg. with
|
|
|
|
[proxyta.net](https://framagit.org/oxyta.net/proxyta.net)
|
|
|
|
- Put the configuration into a `.env` file (don't forget about `CHATONS_DOMAIN`, otherwise by default you will stay on
|
|
|
|
`localhost`)
|
2019-02-10 19:32:57 -05:00
|
|
|
|
|
|
|
```
|
|
|
|
docker-compose up -d
|
|
|
|
```
|
|
|
|
|
2019-02-17 06:29:50 -05:00
|
|
|
## Test / Usage
|
2019-02-10 19:32:57 -05:00
|
|
|
|
|
|
|
```
|
2019-02-17 05:46:00 -05:00
|
|
|
curl -d '{"text":"new contrib from toto: http://radio.localhost/map/#44", "key": "secret"}' mwh.localhost
|
2019-02-10 19:32:57 -05:00
|
|
|
```
|
2019-02-17 05:46:00 -05:00
|
|
|
(or mwh.localhost:4785 without docker)
|