Drupal Meets Matrix 04

Drupal Meets Matrix 04 - Linking Matrix and Drupal Users

By John Locke on November 30, 2026

A reply in Matrix can already show up as a comment in Drupal. But whose comment is it?

In the last episode, I showed what it looks like when a Matrix room and a Drupal comment thread share a conversation. This time, I’m connecting the people on either side of it. If I reply from my Matrix client, Drupal should be able to show that reply under my Drupal account.

In episode 4, I install Matrix API Identity (matrix_api_identity), set up a fallback service user in Drupal, and walk through linking and verifying an existing Matrix account. Then I send messages from Matrix to show what Drupal does with senders it knows and senders it doesn’t.

What happens when Drupal doesn’t know the sender?

People in the Matrix room may never have signed in to the Drupal site. In the workflow I show, those messages can still come across. A dedicated Drupal service user gives the import somewhere to land when there’s no matching account. Once Drupal can match a sender to a verified account, the imported comment can be attributed to that person instead.

Proving a Matrix account is yours

Anyone can type a Matrix ID into a form. To prove it’s mine, I open the Matrix identities tab on my Drupal account and add my full Matrix ID, including the homeserver. The bot sends a confirmation link to that account in Matrix. I follow it back to Drupal and confirm the link while signed in to the same Drupal account that requested it.

Now when I reply in Matrix, the integration can look up the sender’s Matrix ID and attribute the new Drupal comment to the right account. For the Drupal Groups initiative, that’s what makes this feel like one discussion: I can reply from chat and still show up as myself on the website.

Next: sending to Matrix as yourself

Verifying an existing Matrix ID lets Drupal recognize who sent a message. It doesn’t give Drupal permission to send as that Matrix account. In episode 5, I’ll show the other direction: using OpenID Connect (OIDC) so people can sign in to Matrix with their Drupal account, provision a linked Matrix account, and send messages from Drupal under that Matrix identity.

Comments

Skip to content after comments

0 comments

0 total 0 new

Reading settings

Saved for comment discussions across this site in this browser. Apply saves your choices; Cancel discards edits. Selected comments and drafts stay open beyond the chosen depth.

No comments yet.

Add new comment

The content of this field is kept private and will not be shown publicly.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <blockquote cite> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h1> <h2 id> <h3 id> <h4 id> <h5 id> <p> <br> <img src alt height width>
  • Lines and paragraphs break automatically.

About the Author

Profile picture for user John Locke

John Locke is the lead developer and founder of Freelock, LLC. In addition to being a proficient web developer, he is an experienced technical writer, network administrator, and all around problem solver. He has worked with computers since 1984, and currently advises small businesses on open source software.

More Like This

New year
🕑Jan 15, 2018 🖋John Locke 💬0

New Year, New Website!

It's only taken two years since the release of Drupal 8 for us to get our own site updated... Cobbler's children and all. But finally, we are proud to unveil our shiny new site!

But wait, don't you tell your clients you don't need a new site?