noti
noti copied to clipboard
Support Matrix
Hi,
nobody seemd to mention Matrix support. Would be nice to have that!
Sounds great. Can someone help with the implementation?
Could use this lib: https://github.com/matrix-org/gomatrix
I don't think an external library is needed. Use the pushover service as a basis/inspiration and it wouldn't require a lot of work.
recently i noticed that sending a message to matrix (not e2e) is as simple as a curl call. here are my findings, maybe they help:
one time setup
pre-setup done by the user
from my point of view this is the part the user should do by itself.
get an access token
curl -XPOST -d '{"type":"m.login.password", "user":"username", "password":"password"}' "https://matrix.org/_matrix/client/r0/login"
get room id
- (create the room)
- from room settings > advanced. called internal room ID looking like that
!xxxxxxxxxxxx:matrix.org
sending a message
access_token=YOURACCESSTOKEN
# $message_id is to prevent sending duplicate messages in a certain timeframe (i think it is 24h). you don't have to provide it but it makes sense.
message_id=YOURMESSAGEID
# jo produces a json from bash variables
message_json_data=$(jo -p msgtype="m.text" body="my message - aka hello world")
full_matrix_url="https://matrix.org/_matrix/client/r0/rooms/$room_id/send/m.room.message/$message_id?access_token=$access_token"
curl --silent -X PUT -H "Content-Type: application/json" -d "$message_json_data" $full_matrix_url