Featured image of post How to send a matrix message using CURL and an access token

How to send a matrix message using CURL and an access token

Here is a how you can send a simple matrix message with CURL:

1
curl 'https://matrix.org/_matrix/client/r0/rooms/!xxxxxx:example.com/send/m.room.message/?access_token=xxxxxxxx' -X PUT --data '{"msgtype":"m.text","body":"hello world"}'

generate an access token

if you don’t have an access token, you can generate one using curl too:

1
2
3
curl -XPOST \
  -d '{"type":"m.login.password", "user":"<userid>", "password":"<password>"}' \
  "https://matrix.org/_matrix/client/r0/login"

Sources

https://news.ycombinator.com/item?id=19227859 https://webapps.stackexchange.com/questions/131056/how-to-get-an-access-token-for-element-riot-matrix

FarisZR
Built with Hugo
Theme Stack designed by Jimmy