Last active
November 6, 2018 10:43
-
-
Save travnewmatic/6818340a5b3aa4566608957e240dc075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# substitute with your variables | |
# grabs all arguments and dumps them into the body of the message | |
MSGTYPE=m.text | |
BODY=$@ | |
HOMESERVER=<homeserver goes here> | |
ROOM=<room id goes here> | |
ACCESSTOKEN=<access token goes here> | |
JSON=$( jq -n \ | |
--arg msgtype "$MSGTYPE" \ | |
--arg body "$BODY"\ | |
'{msgtype: $msgtype, body: $body}' ) | |
/usr/bin/curl -XPOST -d "$JSON" "https://$HOMESERVER/_matrix/client/r0/rooms/$ROOM/send/m.room.message?access_token=$ACCESSTOKEN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment