noti icon indicating copy to clipboard operation
noti copied to clipboard

Support Matrix

Open matthiasbeyer opened this issue 5 years ago • 4 comments

Hi,

nobody seemd to mention Matrix support. Would be nice to have that!

matthiasbeyer avatar Jul 21 '19 18:07 matthiasbeyer

Sounds great. Can someone help with the implementation?

variadico avatar Jul 22 '19 06:07 variadico

Could use this lib: https://github.com/matrix-org/gomatrix

dawidd6 avatar Sep 15 '19 07:09 dawidd6

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.

peterhoeg avatar Sep 16 '19 04:09 peterhoeg

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

c33s avatar Mar 02 '21 10:03 c33s