Chatrix

Description

Easily add a Matrix client to WordPress pages, either through the Block Editor, or as a popup.

Feedback welcome

If you have any feedback or questions about Chatrix, please do talk to plugin maintainers at #chatrix:matrix.org.

Screenshots

Blocks

This plugin provides 1 block.

  • Chatrix Matrix client

FAQ

How can I install this plugin on my site?

This plugin can be used in two distinct ways:

  1. By adding a block to a page through the block editor
  2. By selecting pages in which a popup will be displayed. You configure this through Settings -> Chatrix.

Is there a more flexible way to configure the popup?

Yes. Instead of configuring the popup through Settings -> Chatrix, you can configure it through code, by using the chatrix_instances filter:

// functions.php

add_filter( 'chatrix_instances', function ( array $default_instances ) {
    // The key is an instance_id, the value array is the config for that instance.
    // Set 'pages' to an array of the ids of the pages which should show chatrix.
    // You can also set 'pages' to 'all' which results in that instance always being used.
    // Only one instance can be shown on a given page.
    return array(
        'foo' => array(
            'homeserver' => 'https://foo.com',
            'room_id'    => '!id:foo.com',
            'pages'      => 'all',
        ),
        'bar' => array(
            'homeserver' => 'https://bar.com',
            'room_id'    => '!id:bar.com',
            'pages'      => array(1, 2, 3),
        ),
    );
} );

How can I configure WordPress user accounts to register and login on Matrix homeserver?

The plugin will respect the login methods configured on the Matrix homeserver. For example, if the homeserver has both password and SSO login enabled, both options will be available to the user.

In light of the plan for Matrix to replace their user management with Open ID Connect (OIDC), we recommend to use a Single-Sign On (SSO) flow by configuring Open ID Connect login on Synapse and use the OpenID Connect Server WordPress plugin.

The flow will then be as follows: When logging into your homeserver, it will redirect you to your own WordPress login page and ask you to authorize the login by the click of a button, and then relay your information to the homeserver. You’ll be redirected back to your WordPress page and Chatrix will receive the login information and you can start chatting.

Later, when Matrix makes the switch to OIDC, you are already prepared and can continue to use this setup.

Reviews

སྤྱི་ཟླ་དང་པ། 1, 2023 2 replies
I've been eagerly awaiting a matrix chat box. (And also matrix based comments -- look up Cactus Comments for that.) A review of my first experience setting it up. I first tried the option to make it appear as an icon on all blog pages. This Chatrix plugin at early version 0.4.0 provides a pop-up generic matrix chat box, in which a viewer can log in to their existing matrix account, and chat with other matrix users, no matter whether inside or outside wordpress in the same way as using any generic matrix messaging client. This early version doesn't seem to integrate with wordpress beyond appearing on the page. First, it doesn't seem to have a way to re-use the viewer's wordpress login to help with logging in to a matrix account, either in the sense of acting as an OIDC provider or in the sense of simplifying the UX when viewer's matrix account is on the same domain as the blog, like might be typical in an organization or family server setup, nor in having an ability to integrate with a local matrix server and offer to create a matrix account for the visitor who doesn't have one. All these things could be good to see in future. Once logged in to a matrix account, in the pop-up version it didn't seem to take notice of the plugin configuration setting for default room: once I logged into my matrix account, I saw a list of all my current room memberships and had to find or create a suitable chat room on my own. However, when inserted as a block, with a particular matrix room chosen in the blpck settings, then the chat did load the specified room. In both pop-up and block modes, the matrix room currently has to be specified as a matrix room-id string (starting with exclamation mark) which is a bit awkward but only for the blog admin; that doesn't affect the viewer. A minor improvement would be to allow a room "alias" (the user-friendly identifier starting with a hash character). This matrix chat currently allows just plain text and attchments, none of the rich text and other features that other matrix clients can do. That's not inappropriate start, but soon it will need some options such as to limit the possible uploads, further customise the appearance, and have a way to introduce the viewer to the author of the blog. All in all, plenty of room for improvement but a good start for such an early version.
Read all 1 review

Contributors & Developers

“Chatrix” is open source software. The following people have contributed to this plugin.

Contributors

“Chatrix” has been translated into 2 locales. Thank you to the translators for their contributions.

Translate “Chatrix” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

0.9.0

  • Chatrix is now a single-session client. The session picker is no longer displayed [#239]. This fixes #236 #224 #200.

0.8.3

  • Improve the view for rooms that are you not a member of (Upgraded our Hydrogen’s fork to latest)

0.8.2

  • Fix issues with single-room mode and guest login [#222]

0.8.1

  • Correctly remember last url when multiple blocks are on the same page [#217]

0.8.0

  • Fix issue when chatrix plugin is not installed in the default location [#205]
  • Fix issue with z-index of the popup [#207]
  • Fix issue that prevented navigating away from the unknown room screen [#213]
  • Allow multiple blocks on the same page or on different browser tabs (behind feature flag, still unstable) [#214]

0.7.1

  • Fix button text from ‘Login’ to ‘Log In’
  • Meta changes for WP.org plugins repo

0.7.0

  • Implement Room Previews (Peeking) functionality [#199]
  • Disable restoration to last screen when in Single room mode [#196]
  • Switch to our Hydrogen’s fork (ahead of v0.3.8) as dependency which includes un-merged upstream contributions
    • Fix query params in SSO
    • Allow create room screen to be closed on smaller width screens
    • Ensure Service worker is started before anything else
    • Fix bug in normalization of homeserver
    • Room Previews (Peeking) support
    • Fix loading of messages & timelines in some cases

0.6.0

  • Support for multiple blocks on the same page [#175]
  • Support room alias in configuration [#179]
  • Fixed a bug where port wasn’t allowed in homeserver in configuration [#184]
  • Provide a filter to choose to not load the logout script if required [#165]

0.5.1

  • Fix issue that caused popup configuration to be ignored [#173]

0.5.0

  • Logout and delete data when user logs out of WordPress [#150, #153]
  • Improvements to single room mode [#151]
    • Add a Settings entry to the options menu of the room
    • Closing the Settings screen navigates to configured roomId
    • Closing the Room (timeline) screen navigates to session picker
    • Hide the left panel completely
  • Fix issue that caused Chatrix to not load in certain conditions [#160]
  • Allow setting a unit for certain styling options (previously was always px) [#154]

0.4.0

  • Prevent data corruption when more than one Chatrix instance (block or Popup) is active, either in multiple browser tabs or windows, or in the same page [#75]
  • Allow setting the height of the block from the block editor [#135]
  • Allow styling the block’s border from the block editor [#139]
  • Styling and layout improvements and fixes in pre-session screens (session selection, login, logout) [#134]
  • Reduce plugin size by 50%, from 12MB to 6MB [#143]
  • Update to Hydrogen 0.3.5
    • Fix issue that prevented opening rooms with slashes in the room ID [#451]
    • Improve date headers in room timeline [#938]
    • Provide basic UI to join room [#870]
    • Fix an error that can stop sync [#885]
    • Fetch missing e2ee devices when verifying message sender [#913]
    • Fix message verification not working in rooms where we haven’t sent a message yet [#920]
    • Various maintenance fixes

0.3.9

  • Initial public release