cadence’s website.

Some changes will be applied after reloading.
Some changes will be applied after reloading.

How to start an unencrypted chat on Matrix (Element)

Starting a regular, ordinary, encrypted chat

This is nice and easy because encryption is the default. On the "people" section on the left side, click the plus icon. Search for a person's name, or enter their full handle into the box. Click Go. All done!

If you like encryption - most people do - then you don't need to read the rest of this post.


About unencrypted chats

Starting one is really difficult and annoying. You used to be able to do this by flipping a switch, but the functionality has been removed now.

To get into the technical details, Matrix's representation for whether chats are direct or not is also a pain. Rather than being a property that's set on the room and consistent for everybody, the is-direct state of a chat is determined for each user by their own account data, and can only be broadcast to other users when inviting them during room creation.

This article will mostly be avoiding the technical details.

Starting an unencrypted direct chat in Element

First, go to the rooms section and create a new room. Make sure the room is private, but make sure it's *not* encrypted by flipping the switch off.

Then, invite the other person to the room. (You can click on "people -> invite to this room" in the side bar.)

Once everybody is in the room, run the command "/converttodm". This will give the chat the correct name and picture, and it will warp up to the "people" section in the left side list. Each person needs to run this command because the command does not synchronise between people.

This is, currently, the only way to do it in Element.

For Linux users: A more convenient shell script

This is a long shell script because creating the chat is a three step process with many opportunities to fail along the way. I have used the non-POSIX-compatible fish shell, but feel free to port this to another shell. You need curl and jq to run it.

Put this file into the `~/.config/fish/functions` folder. You'll need to put your access token in the script (or read it interactively); you can find an access token under "settings -> about -> access token" in Element. You can now immediately invoke `matrix-start-chat @user:server.tld` (multiple recipients allowed) in the shell to start a new unencrypted chat. The people you're inviting to chat don't need to do anything special.

Why is it so complicated?

Step 1: Call the createRoom API endpoint with all the users you want to invite, saying that you'd like the chat to be direct. This does create the chat and asks all *other* users to make the chat direct on their side, but we still need to mark it direct on our side.

Step 2: Query the account data, which stores which chats are displayed as direct chats on our side.

Step 3: Insert the new chat into this field, which is a non-trivial process, even with jq. The modified can be sent back to the account data. All done.

Hope this post helps you!


A seal on a cushion spinning a globe on its nose.
Another seal. They are friends!