matrix-org / matrix-org/matrix-spec

Specify a PostMessage/Plugin API for clients

Open
#253 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Client-Server feature
Dominant language
HTML
Stars
330
Forks
150
Avg merge
2h 21m
Merged PRs (30d)
3

Description

As Riot already includes widgets and there is more to come to extend client functionality, a unique API is needed that can be used across all different client applications. However, **it should be completely optional** which is specifically important for small clients (e.g. IoT).

## What I think it should do
The API should provide endpoints plugins can use to transform messages before they get displayed (transmitted to an end user). Specifically, one could write a plugin that reads markdown and parses it to html before the user sees the message. You could also parse messages that contain a link to a website and provide an integrated webview.

On the other hand, plugins could also have direct access to some Matrix APIs through the client application. This would allow a plugin to implement e2e: an encrypted message would be transmitted to that plugin, processed and the decrypted output would be displayed. Public key management would be done by the plugin through exposed client APIs. There are probably much more use cases.

The overall benefit is that a client would only need to implement this API and could benefit from all plugins out there without the need to reimplement everything again. If a client does not support the API it could still do message processing itself (especially for e2e).

## How it can be implemented
The only two options I can think of to make this happen:

1. **Use a local http server that provides endpoints for plugins**
This would allow any programming language to be used, but every client would need to run a server. This is especially bad for smartphones because it probably drains battery and operating systems would
need to allow port bindings.

2. **Use a common scripting language for all plugins**
Every client would need to provide a VM for that scripting language. I think _Lua_ has proven to be a good choice for plugins in other projects. _Lua_ also provides language bindings for every commonly used language, including Java, Python, Go, C++, JavaScript (and more).

These are only ideas I had and criticism is welcome :). I am especially interested in which extent plugins are used (just post message processing or more functionality).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name implementation files, tests, or entry points. Start by reviewing the proposed plugin use cases and comparing the local HTTP server and Lua VM approaches; done would require an agreed scope and API design for optional client plugin support.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
api, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.