send messages to Matrix rooms
Find a file
2022-07-28 20:41:32 +12:00
config.md Updated documentation 2022-07-28 20:41:32 +12:00
LICENSE Initial commit 2022-04-18 23:13:25 +00:00
Makefile Made the Makefile proper 2022-07-28 20:34:01 +12:00
matrix-send Fixed a few issues 2022-07-28 18:31:13 +12:00
matrix-send.1 Added matrix-send(1) manpage 2022-07-28 18:27:45 +12:00
matrix-send.conf Updated matrix-send.conf 2022-07-28 20:34:30 +12:00
matrix-send.conf.5 Fixed mistakes in matrix-send.conf(5) 2022-07-28 20:34:50 +12:00
README.md Updated documentation 2022-07-28 20:41:32 +12:00

matrix-send

A script to send a message to a Matrix room.


Syntax: matrix-send <message> <room id>

For example: matrix-send "Hello world\!" aBcDeFgHiJkLmNoP:matrix.org


matrix-send is a simple script to interact with a Matrix homeserver in order to send a message to a room.

If you don't understand, matrix-send is an oversimplified Matrix client.

It is mainly designed for automation. I use it on my Matrix room.

matrix-send doesn't have support for end-to-end encryption, and never will.

Get started

In order to start using matrix-send you need a config file. To copy the configuration to .config, clone this repository and type:

make config

The configuration has now been copied to ~/.config, so open the file ~/.config/matrix-send.conf with your favourite text editor.

You will see three "directives"; configuration options that take an argument. Directives' syntax look like so:

Directive Argument

Modify the Server directive to match your server's Matrix URL. If you're using matrix.org you can leave it as default.

If you're not using matrix.org, one way you can find your server's Matrix URL is by typing your server's address into Element. Click Continue, and hover over your server's address that popped up. The Matrix URL should be showing.

Set the Username directive to your username, and the Password directive to your password.

You might not want to put your password in plain text, so you could do something like this instead:

Password $(gpg -d ~/.matrix_pass.gpg)

This will open gpg to decrypt a file with your password inside. You will need to set this up first.

After you've finished changing these, your configuration should look like this (without the comments):

Server matrix-client.matrix.org  # or your server
Username jeremy  # your name
Password mysupersecurepassword  # your password

After you have these three directives set, you're ready to start.

Additional directives can be found in config.md.


To install, run make install as root, in the cloned repository's directory.

make install

Now, using your Matrix client, make a room, and find the Room ID. On Element, right click your room, and click Advanced. Your Room ID is under "Internal Room ID".

To send a message to your chosen room, type matrix-send followed by your message (in speech marks) and then your Room ID. You may need to escape the exclamation mark(s). For example:

matrix-send "Hi\!" \!asdfasdfasdfasdf:matrix.org

That will send the message "Hi!" to the Matrix room !asdfasdfasdfasdf:matrix.org.

For a more detailed guide, see the manual page man matrix-send.