I've been using a self-hosted federated Matrix server for chatting with family members and recently deployed it for one of my clients and needed a decent way to administrate the server. This is where I decided to make node-red-contrib-matrix-chat to accomplish just this.

node-red-contrib-matrix-chat
Matrix chat server client for Node-RED

The current nodes that existed didn't offer much flexibility (basically could only send/receive messages) and had quite a few issues that went years without being resolved. I tried to feature pack this module as much as possible and even added the ability for users to run functions directly on the client itself by exposing it globally for function nodes. This should cover most use-cases people have.

There is a public room I created to offer support to anyone using this module. Feel free to join and ask questions! #node-red-contrib-matrix-chat:skylar.tech

Installing

Installing this module is super easy. Just open your palette manager in Node-RED and search node-red-contrib-matrix-chat and click install. You are now good to go!

Setting up an account

You need an account for your client to use. If you are going to be using End-to-End Encryption you should generate the bot and only use it within Node-RED otherwise if you have other clients connected on the same user it could cause problems with e2ee (key sharing is currently not supported).

If you have access to the server directly you can use Shared Secret Registration as described here.

If this is a server you do not administrate/have access to follow these instructions:

  1. In a private/incognito browser window, open Element.
  2. Log in to the account you want to get the access token for, such as the bot's account. Do not setup key storage.
  3. Click on the bot's name in the top left corner then "Settings".
  4. (Optional) Set your bot's display name and avatar.
  5. Click the "Help & About" tab (left side of the dialog).
  6. Scroll to the bottom and click the <click to reveal> part of Access Token: <click to reveal>.
  7. Copy your access token to a safe place, like the bot's configuration file.
  8. Do not log out. Instead, just close the window. If you used a private browsing session, you should be able to still use Element for your own account. Logging out deletes the access token from the server, making the bot unable to use it.

Examples

I created some examples on the repository so feel free to check them out:

node-red-contrib-matrix-chat/examples at master · Skylar-Tech/node-red-contrib-matrix-chat
Matrix chat server support for Node-RED. Contribute to Skylar-Tech/node-red-contrib-matrix-chat development by creating an account on GitHub.

Generating user's from CSV file

This has been an extremely helpful module for me to use not only at home for my own self-hosted stuff but also for my clients. I currently have all the employees for one of my clients listed in a CSV file with columns containing their pre-generated password and whether they are currently enabled or not. Every few minutes I have it process the CSV and update the accounts on the server. This makes it easy for my client to administrate who has access as pretty much everyone knows how to use Excel. I'll most likely make a post in the future when I clean it up a little bit.

Manage Matrix Synapse users from a CSV file

I hope others find this useful and if anyone wants to contribute feel free to open a PR on the repository. I know it has been a while since I have posted anything and I am truly sorry. It's been a rough time since I last posted but things are starting to get better and I am planning to start posting regularly again.

I plan to create more modules for Node-RED moving forward. I started with this module to get familiar with how to build modules for Node-RED. I'm currently working on Cannabis tracking software for farmers and could see Node-RED being a powerful tool in automating basic tasks (such as creating a task for the flowering crew when moisture levels in boxes fall below a set threshold).

Thanks for reading! Feel free to leave a comment if you like my work :)