#!/bin/bash # Usage: # echo "Hello world" | ./post_to_matrix.sh msgtype=m.text homeserver=glasgow.social room=!BOrDFgeDdZZbUvfjjs:glasgow.social access_token=put_your_user_access_token_here curl -XPOST -d "$( jq -Rsc --arg msgtype "$msgtype" '{$msgtype, body:.}')" "https://$homeserver/_matrix/client/r0/rooms/$room/send/m.room.message?access_token=$access_token"