Skip to content

Instantly share code, notes, and snippets.

@travnewmatic travnewmatic/sendmatrix

Last active Nov 6, 2018
Embed
What would you like to do?
#!/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
You can’t perform that action at this time.