A fully functional, modern Matrix backend for Errbot built using matrix-nio.
- Connection to any Matrix homeserver via username/password or access token.
- Automatic acceptance of room invitations.
- Formatted messages (HTML/xhtml and markdown) sent and received natively.
- Full support for threaded replies using standard Matrix relations.
- Support for End-to-End Encryption (E2EE) using
matrix-nio's database storage.
- Python 3.11 - 3.14
errbot>= 6.2.0matrix-nio>= 0.24.0
You can install the backend locally inside your Errbot virtual environment:
pip install -e .Errbot connects to the Matrix network using a standard Matrix user account. To set up an account for your bot:
-
Register the User Account:
- Open a Matrix client such as Element.
- Register a new account on your desired homeserver (e.g.,
matrix.orgor a self-hosted instance). - Save the bot's full User ID (MXID, e.g.,
@my_errbot:matrix.org) and password.
-
(Optional) Obtain an Access Token:
- If you prefer to authenticate using a login token rather than storing a plaintext password in
config.py:- Log in to Element using the bot account.
- Open Settings -> Help & About -> scroll down to the Advanced section and copy the Access Token.
- Paste this token into the
BOT_IDENTITYdictionary under thetokenkey.
- If you prefer to authenticate using a login token rather than storing a plaintext password in
-
Invite the Bot:
- Start a chat with the bot's MXID or invite the bot to a room. The backend is configured to automatically accept invites by default.
To use the Matrix backend, update your Errbot config.py file with the following settings:
# Set the backend to 'Matrix'
BACKEND = 'Matrix'
# Provide connection credentials and settings
BOT_IDENTITY = {
# The Matrix homeserver URL
'homeserver': 'https://matrix.org',
# The full Matrix user ID (MXID) of the bot
'username': '@my_errbot:matrix.org',
# Authentication (use either password OR token)
'password': 'my-secure-password',
# 'token': 'syt_your_access_token_here...',
# Optional settings:
# 'device_id': 'ERRBOT_DEVICE',
# 'ssl': True,
# 'proxy': 'http://proxy.example.com:8080',
# 'auto_join_on_invite': True,
# To enable End-to-End Encryption (E2EE), provide a path for the database store:
# 'store_path': '/path/to/errbot/matrix_store'
}To use End-to-End Encryption in rooms, you must:
- Ensure the
libolmsystem library is installed (on macOS,brew install libolm; on Debian/Ubuntu,apt-get install libolm-dev). - Specify a
'store_path'insideBOT_IDENTITYinconfig.pywherematrix-niocan store its encryption keys.
Start Errbot normally:
errbot