Skip to main content

Onbot

Onbot keeps a Matrix (Synapse) homeserver in sync with an Authentik identity provider and gives every new user a friendly welcome into the right rooms.

Authentik is the source of truth. Onbot mirrors it into Matrix: each Authentik group becomes a room, group membership becomes room membership, and roles become power levels. When a new user shows up, they get a guided 1:1 welcome message.

Onbot is built for Matrix 2.0. It assumes a Matrix Authentication Service (MAS) deployment with Authentik as the upstream identity provider.

What Onbot does and does not do

Onbot does not create accounts. MAS provisions a Matrix account the first time a user logs in through Authentik. Onbot's job is projection: turn Authentik groups into rooms, group membership into room membership, attributes into power levels, and drive the offboarding lifecycle when a user is disabled.

Quick start with Docker

The published image is dzdde/onbot on Docker Hub. It runs as a non-root user and needs one thing from you: a config file.

  1. Create a config.yml (see Minimal config below).

  2. Run it:

docker run --rm \
  -v "$PWD/config.yml:/config/config.yml:ro" \
  dzdde/onbot:latest

The image defaults to reading /config/config.yml and running the long-lived onbot run service. It also ships a built-in HEALTHCHECK.

docker-compose

services:
  onbot:
    image: dzdde/onbot:latest
    restart: unless-stopped
    volumes:
      - ./config.yml:/config/config.yml:ro

More deployment detail (env-only config, CLI commands, healthcheck) lives in docs/deployment.md.

Minimal config

Configuration is a single YAML file. Copy this, fill in the values, save it as config.yml:

synapse_server:
  server_name: company.org                  # your Matrix domain (the part after the ':')
  server_url: https://internal.matrix       # how the bot reaches Synapse (an internal URL is fine)
  bot_user_id: "@welcome-bot:company.org"
  bot_access_token: syt_REPLACE_ME          # or an `oauth2:` block instead

authentik_server:
  url: https://authentik.company.org/
  api_key: REPLACE_ME                        # an Authentik API token

# Required to enforce offboarding under MAS (omit on non-MAS deployments):
mas_admin:
  url: https://auth.company.org              # the MAS base URL
  client_id: REPLACE_ME                      # a MAS admin client (in policy.data.admin_clients)
  client_secret: REPLACE_ME

sync_authentik_users_with_matrix_rooms:
  authentik_username_mapping_attribute: username   # MUST agree with MAS's localpart template

Two settings above are easy to get wrong and worth calling out:

  • authentik_username_mapping_attribute must match the localpart template MAS uses. Onbot computes each user's MXID from this Authentik attribute. If it disagrees with MAS, the computed MXIDs will not match the real accounts and nobody gets added to rooms.
  • mas_admin is required to actually offboard disabled users. The Synapse admin API cannot revoke a MAS-issued session, only MAS can. Without this block, offboarding silently does nothing to live sessions.

Every setting can also be supplied via an environment variable (prefix ONBOT_, nest with __), for example ONBOT_SYNAPSE_SERVER__BOT_ACCESS_TOKEN=syt_….

Never commit a real config. config*.yml is gitignored (only config.example.yml is tracked) and the image carries no secrets. Provide config at runtime.

For the full picture (bot credential options, the MAS auth topology, and every field), see the docs below.

Documentation

License

MIT, see LICENSE.

Release files for onbot 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onbot 0.0.4
File Size Uploaded
onbot-0.0.4.tar.gz 136.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for onbot 0.0.4
File Interpreter ABI Platform
onbot-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 233.9 kB

Release files / onbot-0.0.4.tar.gz

Download URL onbot-0.0.4.tar.gz
Size 136.2 kB
Tags Source
SHA-256 checksum
How to use checksums
19e17eebd51020e5f6e41c6e54f8683d7de745b88250dc761a8a8e66c27ac05e
BLAKE2b-256 checksum
How to use checksums
0393f5b1cab96a146bc8d9ab7b9d74ec96b1a6f59917e9fc2b6df035becc35e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / onbot-0.0.4-py3-none-any.whl

Download URL onbot-0.0.4-py3-none-any.whl
Size 97.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
592b5cb8f4ef5204176a0c9eddb53127f6781ae1f3db75fcfab2cecf12ecc05b
BLAKE2b-256 checksum
How to use checksums
df650d55ca8581fe1637aa55b6c41ab6604145efa9fc56385cfa4ad564245818
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page