Drupal 8 and Matrix chat rooms: communication of the future

Aug 28, 2017
Drupal 8 and Matrix chat rooms: communication of the future

What if we all lived in the Matrix? Each of us has probably asked that question after watching the famous movie. While we aren’t sure about living in the Matrix, communicating in the Matrix is getting increasingly popular among companies and individuals — and its advantages are absolutely real. This is, of course, Matrix.org, the messaging service for easy and secure communication. Of course, our favorite CMS Drupal keeps pace with the latest trends, so there is a special module for connecting Drupal 8 sites to Matrix chat rooms. Let’s see how it all works.

Matrix and a new vision of communication

“Welcome to Matrix,” says its official website, and you immediately feel a touch of the future. It’s not just the design you see there, but the new approaches to communication you discover.

So what is Matrix meant for? Matrix allows for private and group chats and voice or video calls, enriched with features like file sharing, messaging history and various notifications. It also lets you create bots, connect your existing messaging apps to Matrix and much more.

Being an open network for decentralized and interoperable communication, it lets users communicate seamlessly on the Internet even if they have different service providers. Matrix offers simple standard HTTP APIs for real-time data sharing in the JSON format over an open federation of servers. The data sent is synchronized between all servers that participate in a chat room.

Reading the “between all servers” part, you might be thinking about the need for special security. It is achieved through end-to-end encryption and access control features.

Drupal 8 and Matrix: providing the connection via the Matrix API

If there is a hot technology, there must be a Drupal module for working with it! This is especially true when it comes to Drupal 8 and third-party integration. So, for connecting Drupal websites to Matrix chat rooms, Drupal 8 has the Matrix API module.

It is fresh from the oven — we can even say the dish is not yet fully baked, but it already looks very appetizing. In other words, Drupal 8’s Matrix API is not yet functional, but its roadmap, and the goals it has already achieved, are impressive, and the work is being done very actively.

What features are ready for the Matrix API?

When you set up your Drupal website’s Matrix account with helpful apps like Riot.IM, the Matrix API module will let you configure it (specify the server, provide authentication tokens for access, etc.). It will then enable you to send messages and states to Matrix chat rooms.

As for sending messages to rooms, Drupal 8’s Matrix API now has a new option for doing this via the Rules module. Thanks to the Rules integration, you can configure notifications coming to chat rooms about events on your Drupal website (new content posting, user sign-ups, and so on). To do this, you will need to create a new Reaction Rule in the Rules module settings.

What features are coming soon for the Matrix API?

You should expect to see: embedding Matrix rooms in your Drupal web page, allowing single sign-on with a Drupal login, creating an endpoint to receive Matrix events, as well as creating a Matrix Application Service for handling rooms and users from a Drupal module, and more.

However, these features might have easily jumped from the planning to the accomplished stage by the time you are reading this, and this Drupal module might already become stable.


Today’s reality is full of great inventions, so enjoy them! If you are interested in ways of seamlessly connect your Drupal website to Matrix chat rooms, our developers are ready to help you configure the Matrix API, or create a custom Drupal module for it. Contact us!

 Get new blog posts by email