send messages to Matrix rooms
Find a file
2022-08-02 16:26:20 +12:00
doc Added -t option 2022-07-29 08:12:43 +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 Fix Makefile 2022-07-29 06:49:52 +12:00
matrix-send Added -t option 2022-07-29 08:12:43 +12:00
matrix-send.1 Added EXAMPLES section 2022-08-02 16:26:20 +12:00
matrix-send.conf Updated matrix-send.conf 2022-07-28 20:34:30 +12:00
matrix-send.conf.5 Added EXAMPLES section 2022-08-02 16:26:20 +12:00
README.md Update 'README.md' 2022-07-28 22:17:09 +02:00

matrix-send

A script to send a message to a Matrix room.

Read the manual page


Syntax: matrix-send message room

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


matrix-send is a simple script to send a message to a Matrix room.

It does this by sending a JSON message to your Matrix server. The message types that are supported are m.text, and m.notice.

It is mainly designed for automation. I use it on a private Matrix room of mine.

There aren't any plans for matrix-send to support encryption.

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

Now edit the file ~/.config/matrix-send.conf. You will see three (uncommented) lines.

Server ...
Username ...
Password ...

Delete the example values and enter in your credentials.

If you don't want to put your password in plain text, since matrix-send.conf is a shell script, you could do something like this:

Password $(gpg -d /path/to/passwd.gpg)

/path/to/passwd.gpg is a GPG-encrypted file containing only your password, once decrypted.

For more configuration options, see matrix-send.conf(5).


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

# make install

In order to send messages, you will need your Room ID. Find the room you want to send to, and find its Room ID in the settings or somewhere else. It will likely be under Advanced or something similar.

To send a message, type matrix-send followed by your message 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 more information, see matrix-send(1).