Matrix Commands#

synadm matrix#

Execute Matrix API calls.

synadm matrix [OPTIONS] COMMAND [ARGS]...

login#

Login to Matrix via username/password and receive an access token.

The response also contains a newly generated device ID and further information about user and homeserver.

Each successful login will show up in the user’s devices list marked with a display name of ‘synadm matrix login command’.

synadm matrix login [OPTIONS] USER_ID

Options

-p, --password <password>#

The Matrix user’s password. If missing, an interactive password prompt is shown.

Arguments

USER_ID#

Required argument

raw#

Execute a custom request to the Matrix API.

The endpoint argument is the part of the URL _after_ the configured base URL (actually “Synapse base URL”) and “Matrix API path” (see synadm config). A get request could look like this: synadm matrix raw client/versions URL encoding must be handled at this point. Consider enabling debug outputs via synadm’s global flag -vv

Use either --token or --prompt to provide a user’s token and execute Matrix commands on their behalf. Respect the privacy of others! Act responsible!

The precedence rules for token reading are:
1. Interactive input using --prompt;
2. Set on CLI via --token
3. Read from environment variable $MTOKEN;
4. Preconfigured admin token set via synadm config.

Caution: Passing secrets as CLI arguments or via environment variables is not considered secure. Know what you are doing!

synadm matrix raw [OPTIONS] ENDPOINT

Options

-m, --method <method>#

The HTTP method used for the request.

Default:

get

Options:

get | post | put | delete

-d, --data <data>#

The JSON string sent in the body of post, put and delete requests - provided as a string. Make sure to escape it from shell interpretation by using single quotes. E.g ‘{“key1”: “value1”, “key2”: 123}’

Default:

{}

-f, --data-file <data_file>#

Read JSON data from file. To read from stdin use “-” as the filename argument.

-t, --token <token>#

Token used for Matrix authentication instead of the configured admin user’s token. If --token (and --prompt) option is missing, the token is read from environment variable $MTOKEN instead. To make sure a user’s token does not show up in system logs, don’t provide it on the shell directly but set $MTOKEN with shell command read MTOKEN.

-p, --prompt#

Prompt for the token used for Matrix authentication. This option always overrides $MTOKEN.

Default:

False

Arguments

ENDPOINT#

Required argument

Environment variables

MTOKEN

Provide a default for --token