A microservice that forwards form data or JSON objects received in an HTTP POST request to an end-to-end-encrypted (E2EE) Matrix room. There is no schema restriction on the posted data, so you can throw at it anyting! Supports multiple rooms and sender aliases with different associated webhook URLs, e.g, one for Grafana, another for curl
, and so on. Can convert the received payload to JSON or YAML for better message readability, and can apply Markdown formatting to messages. Easy installation with docker-compose
.
.env.example
file as .env
, and fill in all the required infocurl
or any HTTP POST capable client to the gatewaycp .env{.example,}
# edit the .env with your preferred editor
mkdir -p store
chown 1000:1000 store
sudo docker-compose up -d --build
# post form data
curl -d 'hello="world"' http://localhost:8000/post/YOURSECRETTOKEN
# post a JSON
curl -H 'Content-Type: application/json' -d '{"hello":"world"}' http://localhost:8000/post/YOURSECRETTOKEN
# post a text file by converting it to a valid JSON array
cat /etc/resolv.conf | jq -R -s -c 'split("\n")' | curl -H 'Content-Type: application/json' -d @- http://localhost:8000/post/YOURSECRETTOKEN
# make posts cleaner by adding all parameters to a curl config file
printf '# @see: https://ec.haxx.se/cmdline-configfile.html
url = "http://localhost:8000/post/YOURSECRETTOKEN"
header = "Content-Type: application/json"
output = /dev/null
silent
' > ~/.matrix.curlrc
/any/command | curl -K ~/.matrix.curlrc -d @-
The gateway tries to join all of the specified rooms in the .env
file on start. However, you must make sure to invite the webhook user and accept the invite on behalf of them from any client before you start up the gateway!
MESSAGE_FORMAT
: raw
| json
| yaml
(default)USE_MARKDOWN
: True
| False
(default)\u1234
) or Unicode characters (e.g., ű
) in JSON or YAML content via ALLOW_UNICODE
: True
(default) | False
DISPLAY_APP_NAME
: True
(default) | False
MATRIX_SERVER
: a string like https://matrix.example.org
MATRIX_SSLVERIFY
: True
(default) | False
MATRIX_USERID
: a string like @myhook:matrix.example.org
MATRIX_PASSWORD
: a string like mypass+*!word
MATRIX_DEVICE
: a string like docker
MATRIX_ADMIN_ROOM
: a string like !privatechatwiththebotuser:matrix.example.org
!
) at all times even if the room has an alias like #alias:matrix.example.org
!token,roomid,name
triplets separated by spaces via KNOWN_TOKENS
: a string likeYOURSECRETTOKEN,!myroomid:matrix.example.org,Curl anOTheRToKen99,!myroomid2:matrix.example.org,Grafana
token
and name
parts should match the following regexp: [a-zA-Z0-9]+
!
) at all times even if the room has an alias like #alias:matrix.example.org
!PYTHON_LOG_LEVEL
: debug
| info
(default) | warn
| error
| critical
LOGIN_STORE_PATH
: a path-string without trailing slash like /config
(default)
1000:1000
user:group.Installation on Manjaro Linux:
sudo pacman -S docker docker-compose
sudo systemctl enable --now docker
Of course, you'll also need a Matrix server up and running with at least one E2EE room and two users joined in the same room (the webhook user and probably you). Explaining setting these up is way beyond the scope of this document, so please see the online docs for proper instructions, or use a hosted Matrix server.
Install global dependencies, install dev dependencies, create a new virtual environment, install package dependencies, then start the project:
# Manjaro
sudo pacman -S libolm
sudo pip install virtualenv
virtualenv venv
# Fish
source venv/bin/activate.fish
pip install -r requirements.txt
./docker-entrypoint.sh
False
in the environment file) if your certs are self-signed or you experience any problem with the cert verification even if you have a valid cert.This is an experimental project. I do not take responsibility for anything regarding the use or misuse of the contents of this repository.
curl
).