Extending chat message blocks

Hi all,

I would like to develop a plugin for displaying GitLab/GitHub activity notifications in Discourse Chat, or more broadly any kind of regular events.

For a richer output I would like to display activity as a card, and I saw that chat messages have a blocks JSON field that seems useful for this purpose. Unfortunately, right now the block types do not seem extensible without patching Chat internals: the schema, serializers, and frontend renderer all enumerate the supported block/element types.

Would it be possible to make blocks a plugin extension point, or should plugins treat it as internal implementation detail?

Concretely, would Discourse be open to either:

  1. a generic event/card block type in core, or
  2. a registerChatBlockType-style plugin API?

I can fall back to rendering Markdown and decorating cooked chat messages client-side, but structured blocks seem like the cleaner model if this direction is considered fair game.

1 Like