A small web service that acts as a proxy for a Matrix homeserver. It receives a simple message and does a retransmit to a Matrix homeserver. Very useful for IoT devices who cant handle the Matrix api due to resource restrictions.
The state of the project is alpha but its working.
- You need a running Matrix homerserver
- On this homeserver you need a user with valid password (other login types are not supported)
- There must be a room where the user is member of or the user can join
Clone the repository and use Apache Maven to compile the project.
mvn clean compile package
Copy the single jar-file to a location of your choice
cp target/matrixProxy-0.1.0-jar-with-dependencies.jar ../matrixProxy.jar
matrixProxy uses a configuration file. sample_configuration.conf
is an example configuration
file.
BASE_URL=http://localhost:7654/matrix/
HOMESERVER_URL=https://example.com:8448
HOMESERVER_USER=username
HOMESERVER_PASS=secret
Substitute the values and save the file.
cp sample_configuration.conf /PATH/TO/CONFIG/matrixProxy.conf
java -jar matrixProxy.jar -c /PATH/TO/CONFIG/matrixProxy.conf
matrixProxy is going to write some log messages to /tmp/MatrixProxy0.log
.
Simply send the json-string {"message": "ring ring", "room": "#doorbell"}
to the matrixProxy
via HTTP-POST
. The Message will be retransmitted to the Matrix homeserver. Is the previously
configured user is not member of the given room, it will be added.
curl -i -H "Content-Type: application/json" -XPOST http://localhost:7654/matrix/transmit/message --data-binary '{"message": "Hallo123", "room": "#klingel"}'
docker build -t matrix_proxy .
docker run -d -p 0.0.0.0:7654:7654 -v "/etc/matrixProxy:/etc/matrixProxy" -v "$(pwd)/matrix-proxy-logs:/tmp/logs" matrix_proxy
- caching messages when the server is not reachable