Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# Adjust homserver, room, and accesstoken to your particular setup
# Script is expecting data to be piped in on STDIN
# Example:
# echo "some text" | sendmatrix
msgtype=m.text
homeserver=<homeserver>
room=<room id>
accesstoken=<access token>
curl -XPOST -d "$( jq -Rsc --arg msgtype "$msgtype" '{$msgtype, body:.}')" "https://$homeserver/_matrix/client/r0/rooms/$room/send/m.room.message?access_token=$accesstoken"
@rajil

This comment has been minimized.

Copy link

@rajil rajil commented May 17, 2020

Any way to send a video or an image?

@jasalt

This comment has been minimized.

Copy link

@jasalt jasalt commented Jul 16, 2020

Any way to send a video or an image?

Maybe see here:

https://matrix.org/docs/api/client-server/#!/Media/uploadContent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment