====== register new user ======
ssh in. normally you use ''register_new_matrix_user'', but the digital ocean droplet comes with:
./new-user
====== curl as client ======
you're on port 8448, which is unusual.
faq: how do I get an apostrophe? you can just glue strings, be they double-apostrophe or double-quote, together immediately:
#password is asdf'fdsa
pw='asdf'"'"'fdsa'
we're going to do the same to glue the password in.
username doesn't have to be your //full// username. (less-past adam here: idk wtf he means. just do full. @user:greyn.club.)
pw='PASSWORD'
echo $pw
curl -XPOST -d '{"type":"m.login.password", "user":"USERNAME", "password":"'"$pw"'"}' "https://greyn.club:8448/_matrix/client/r0/login"
that'll give you back a json object, including an access token
now for extra fun: get yourself ''jq''. take the json you get back, pipe it to jq, tell jq you just want the access_token.
pw='PASSWORD'
username='@USERNAME:greyn.club'
echo $pw
token=$(curl -XPOST -d '{"type":"m.login.password", "user":"'"$username"'", "password":"'"$pw"'"}' "https://greyn.club:8448/_matrix/client/r0/login" | jq .access_token --raw-output)
echo $token
curl -XPOST \
-d "{\"msgtype\":\"m.text\", \"body\":\"TEXT\"}" \
"https://greyn.club:8448/_matrix/client/r0/rooms/"'!'"pPZWsacCoTafJoyJXu:greyn.club/send/m.room.message?access_token=ACCESSTOKEN"