Reference · Tools

Matrix

Interact with Matrix decentralized communication: manage rooms, send messages, upload media, inspect events, and manage room membership.

Action (binary) Communication v1 Binary data

The Matrix node works with decentralized Matrix communication: sending messages, uploading media, creating and managing rooms, handling membership and inspecting events through the Client-Server API. A typical build is relaying alerts into a Matrix room with a screenshot attached.

Node type
Action (binary)
Parameters
35
Outputs
Output, Error
Credentials
Matrix API

Matrix

Manage Matrix rooms, messages, media, events, and members

Overview

The Matrix tool interacts with the Matrix Client-Server API (r0) to manage decentralized communication. Resources: Account (get current user info), Event (get a single event by ID), Media (upload a file to a room), Message (send text/HTML/emote/notice, get all messages with pagination), Room (create, join, leave, invite, kick), Room Member (get all members with membership filters). Media upload is a two-step process: the file is uploaded to the homeserver’s media repository to obtain an mxc:// URI, and a room message event is then posted referencing that URI. Messages are sent idempotently with a client-generated transaction ID.

Category: Communication
Tool Name: matrix
Version: 1

Appearance: Icon: si-matrix | Color: #0DBD8B

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires Matrix API credentials. See the Credentials Guide for setup instructions.

Resources

ResourceValue
Accountaccount
Eventevent
Mediamedia
Messagemessage
Roomroom
Room MemberroomMember

Operations

OperationValueDescription
MemeGet current user’s account information
GetgetGet a single event by ID
UploaduploadUpload media to a room
CreatecreateSend a message to a room
Get ManygetAllGet messages from a room
CreatecreateCreate a new chat room
InviteinviteInvite a user to a room
JoinjoinJoin a room
KickkickKick a user from a room
LeaveleaveLeave a room
Get ManygetAllGet room members

The operation list is scoped to the resource you pick, which is why create and getAll each appear twice.

Parameters

Account: Me takes no parameters of its own — see All Operations.

Event: Get

ParameterTypeRequiredDefaultDescription
Room IDstringYesThe room ID containing the event. Supports expressions like {{ $json.roomId }}.
Event IDstringYesThe event ID to retrieve. Supports expressions.

Media: Upload

ParameterTypeRequiredDefaultDescription
Room IDstringYesThe room ID to send the uploaded media to. You can find room IDs by calling Account > Me to list joined rooms. Supports expressions.
Binary PropertystringYesdataName of the binary property on the input item containing the file to upload. Names are case-sensitive — see the upstream node’s Binary Data panel for the exact names to use.
Media TypeoptionsYesimageThe type of media being uploaded. Determines the message type (m.image, m.file, m.audio, m.video).
Options: audio, file (general file), image, video
Additional FieldscollectionNo{}Optional overrides for the uploaded file.
— File NamestringNoOverride the file name (defaults to the binary data file name). Supports expressions.

Message: Create

ParameterTypeRequiredDefaultDescription
Room IDstringYesThe room ID to send the message to. Supports expressions like {{ $json.roomId }}.
TextstringNoThe message text to send. When using HTML format, this becomes the formatted_body. Supports expressions like {{ $json.message }}.
Message TypeoptionsNom.textThe type of message to send.
Options: m.emote (perform an action, similar to /me in IRC), m.notice (send a notice), m.text (send a text message)
Message FormatoptionsNoplainThe format of the message body.
Options: org.matrix.custom.html (HTML-formatted text), plain (text only)
Fallback TextstringNoPlain text fallback when using HTML format. Displayed by clients that cannot render HTML. Supports expressions. (shown when Message Format is org.matrix.custom.html)

Message: Get Many

ParameterTypeRequiredDefaultDescription
Room IDstringYesThe room ID to retrieve messages from. Supports expressions.
Return AllbooleanYesfalseWhether to return all messages or only up to a given limit.
LimitnumberNo100Maximum number of messages to return. Accepts 1–500. (shown when Return All is false)
Other OptionscollectionNo{}Extra retrieval settings.
— FilterstringNoA JSON RoomEventFilter to filter returned events. E.g.: {“types”:[“m.room.message”]}

Room: Create

ParameterTypeRequiredDefaultDescription
Room NamestringYesDisplay name for the new room. Supports expressions.
PresetoptionsYespublic_chatRoom visibility preset.
Options: private_chat (private room), public_chat (open and public chat)
Room AliasstringNoOptional local alias for the room (e.g., coolest-room-around becomes #coolest-room-around:server). Supports expressions.

Room: Invite

ParameterTypeRequiredDefaultDescription
Room IDstringYesRoom ID to invite the user to. Supports expressions.
User IDstringYesFully qualified Matrix user ID to invite. Supports expressions like {{ $json.userId }}.

Room: Join

ParameterTypeRequiredDefaultDescription
Room ID or AliasstringYesRoom ID or alias to join (e.g., !abc:matrix.org or #room:matrix.org). Supports expressions.

Room: Kick

ParameterTypeRequiredDefaultDescription
Room IDstringYesRoom ID to kick the user from. Supports expressions.
User IDstringYesFully qualified Matrix user ID to kick. Supports expressions.
ReasonstringNoOptional reason for the kick. Supports expressions.

Room: Leave

ParameterTypeRequiredDefaultDescription
Room IDstringYesRoom ID to leave. Supports expressions.

Room Member: Get Many

ParameterTypeRequiredDefaultDescription
Room IDstringYesRoom ID to get members from. Supports expressions.
FilterscollectionNo{}Narrow the member list by membership state.
— MembershipoptionsNoOnly include members with this membership status.
Options: ban (users removed from the room), invite (users invited to join), join (users currently in the room), leave (users who left) — leave unset for Any
— Exclude MembershipoptionsNoExclude members with this membership status.
Options: ban (users removed from the room), invite (users invited to join), join (users currently in the room), leave (users who left) — leave unset for no exclusion

All Operations

ParameterTypeRequiredDefaultDescription
Max ConcurrencynumberNo10Maximum number of items to process concurrently.

Output Data

The Matrix API response is merged into the item JSON at the top level, so the fields the input item already carried pass through unchanged and binary data is forwarded.

OperationOutput items
account / meOne item per input item, carrying the account information the homeserver returned
event / getOne item per input item, carrying the event
media / uploadOne item per input item, carrying the send response plus content_uri, fileName and mimeType
message / createOne item per input item, carrying the send response
message / getAllFans out — one output item per message. A room with no matching messages yields a single item carrying messages: []
room / createOne item per input item, carrying the new room’s identifiers
room / invite, join, kick, leaveOne item per input item. Matrix answers these with an empty or near-empty body, so the item is effectively the input passed through
roomMember / getAllFans out — one output item per member. A room with no matching members yields a single item carrying members: []

The two getAll operations are the only ones that change the item count: fifty messages become fifty items, each a copy of the input item’s JSON with one message’s fields merged on. No Split Out node is needed after them.

After a media upload, content_uri is the mxc:// address the homeserver assigned to the file — reference it downstream as {{ $json.content_uri }} to embed the same file in another message.

Usage Examples

  • Send a text message to a Matrix room
  • Upload an image to a Matrix room
  • Get all messages from a Matrix room
  • Create a new public Matrix room
  • Invite a user to a Matrix room
  • Kick a user from a Matrix room
  • Get current Matrix account info
  • Get an event by ID from a room
  • Get all members of a Matrix room

Example Configuration

Get the account the credential belongs to:

{
  "type": "matrix",
  "parameters": {
    "resource": "account",
    "operation": "me"
  }
}

Fetch one event by ID:

{
  "type": "matrix",
  "parameters": {
    "resource": "event",
    "operation": "get",
    "roomId": "!abc123:matrix.org",
    "eventId": "$event123:matrix.org"
  }
}

Upload an image an upstream node produced:

{
  "type": "matrix",
  "parameters": {
    "resource": "media",
    "operation": "upload",
    "roomId": "!abc123:matrix.org",
    "binaryPropertyName": "data",
    "mediaType": "image",
    "additionalFields": {
      "fileName": "screenshot.png"
    }
  }
}

Send a plain text message:

{
  "type": "matrix",
  "parameters": {
    "resource": "message",
    "operation": "create",
    "roomId": "!abc123:matrix.org",
    "text": "Hello, Matrix!",
    "messageType": "m.text",
    "messageFormat": "plain"
  }
}

Send an HTML message with a plain-text fallback:

{
  "type": "matrix",
  "parameters": {
    "resource": "message",
    "operation": "create",
    "roomId": "!abc123:matrix.org",
    "text": "<strong>Hello</strong>, {{ $json.name }}!",
    "messageType": "m.text",
    "messageFormat": "org.matrix.custom.html",
    "fallbackText": "Hello, {{ $json.name }}!"
  }
}

Get the most recent messages in a room, restricted to real chat events:

{
  "type": "matrix",
  "parameters": {
    "resource": "message",
    "operation": "getAll",
    "roomId": "!abc123:matrix.org",
    "returnAll": false,
    "limit": 50,
    "otherOptions": {
      "filter": "{\"types\":[\"m.room.message\"]}"
    }
  }
}

Get every message in a room:

{
  "type": "matrix",
  "parameters": {
    "resource": "message",
    "operation": "getAll",
    "roomId": "!abc123:matrix.org",
    "returnAll": true
  }
}

Create a private room with an alias:

{
  "type": "matrix",
  "parameters": {
    "resource": "room",
    "operation": "create",
    "roomName": "Team Discussion",
    "preset": "private_chat",
    "roomAlias": "team-discussion"
  }
}

Join a room by alias:

{
  "type": "matrix",
  "parameters": {
    "resource": "room",
    "operation": "join",
    "roomIdOrAlias": "#general:matrix.org"
  }
}

Invite a user:

{
  "type": "matrix",
  "parameters": {
    "resource": "room",
    "operation": "invite",
    "roomId": "!abc123:matrix.org",
    "userId": "@user:matrix.org"
  }
}

Kick a user with a reason:

{
  "type": "matrix",
  "parameters": {
    "resource": "room",
    "operation": "kick",
    "roomId": "!abc123:matrix.org",
    "userId": "@user:matrix.org",
    "reason": "Violation of room rules"
  }
}

Leave a room:

{
  "type": "matrix",
  "parameters": {
    "resource": "room",
    "operation": "leave",
    "roomId": "!abc123:matrix.org"
  }
}

List the joined members of a room, excluding banned users:

{
  "type": "matrix",
  "parameters": {
    "resource": "roomMember",
    "operation": "getAll",
    "roomId": "!abc123:matrix.org",
    "filters": {
      "membership": "join",
      "notMembership": "ban"
    }
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

Matrix decentralized communication: send messages, upload media, manage rooms and members via the Client-Server API.

Parameter Dependencies Summary

  • operation options depend on resource selection
  • Event parameters require both roomId and eventId
  • Media upload requires roomId, binaryPropertyName, and mediaType
  • HTML messages should also set fallbackText when messageFormat is HTML
  • Message retrieval with limits requires returnAll: false and limit
  • Room operations require appropriate identifiers (roomId, userId, roomIdOrAlias)
  • Collection parameters use flat object structure without arrays or _default keys

Key Notes

  • Room IDs start with !, aliases with #. Only Room: Join accepts either; every other operation wants the ID. Account > Me is the quickest way to list the rooms you have joined.
  • Filter takes a JSON string, not a keyword — for example {"types":["m.room.message"]}.
  • Media upload is one node, two steps. The file is uploaded and then posted into the room in a single execution, so you do not need a separate send node afterwards.

Frequently asked questions

What does a media upload require?

A room ID, the binary property name holding the file, and the media type. All three are needed — a missing media type is a common cause of a rejected upload.

What should I set when sending HTML messages?

Also set Fallback Text. Clients that cannot render the HTML format show the fallback instead, so without it those users see nothing useful.

Why can I not set a limit on message retrieval?

Limit applies only when Return All is off. With Return All on there is nothing to limit.

What do event operations need?

Both a room ID and an event ID — an event is only addressable within its room.

Build with the Matrix node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Matrix API credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.