Skip to content
A Python Matrix client library, designed according to sans I/O ( principles
Python Other
  1. Python 99.9%
  2. Other 0.1%
Branch: master
Clone or download


Build Status codecov license Documentation Status #nio

nio is a multilayered matrix client library. The underlying base layer doesn't do any IO on its own. On top of the base layer, a no-IO HTTP client implementation exists, as well as a full fledged batteries included asyncio layer using aiohttp.


The full API documentation for nio can be found at


To install nio, simply use pip:

$ pip install matrix-nio

Note that this installs nio without end-to-end encryption support. For e2ee support python-olm is needed which requires the libolm C library.

After libolm has been installed the e2ee enabled version of nio can be installed using pip:

$ pip install "matrix-nio[e2e]"


Unless special requirements disallow the usage of asyncio, by far the easiest way to use nio is using the asyncio layer:

import asyncio
from nio import (AsyncClient, RoomMessageText)

async def message_cb(room, event):
        "Message received for room {} | {}: {}".format(
            room.display_name, room.user_name(event.sender), event.body

async def main():
    client = AsyncClient("", "")
    client.add_event_callback(message_cb, RoomMessageText)

    await client.login("hunter1")
    await client.sync_forever(timeout=30000)


Please do note that this example requires python 3.5+ for the async/await syntax. nio on the other hand works with older python versions as well.

You can’t perform that action at this time.