Matrix
connector.matrix · connector.matrix_trigger · communication
Send text, files, reactions and edits to Matrix rooms, manage rooms and membership, read room history and state, and poll rooms for new events.
Vendor API documentation: https://spec.matrix.org/latest/client-server-api/
Authentication
| Method | Credential kind | Auth kind | Fields | Test request |
|---|---|---|---|---|
| Access token | matrix/access_token | bearer | homeserver_url, token (secret) | yes |
Actions
Node type connector.matrix. Choose a resource and an operation; each operation has its own parameters.
Message
| Operation | ID | Effect | Paginated | Cassette tests |
|---|---|---|---|---|
| Send a text message | message.send_text | writes | 5 | |
| Send a file | message.send_file | writes | 3 | |
| List room messages | message.list | reads | yes | 1 |
| Edit a message | message.edit | writes | 1 | |
| React to a message | message.react | writes | 1 | |
| Redact (delete) an event | message.redact | writes | 1 |
Send a text message
Operation message.send_text.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
text | string | yes | Plain text body (also the fallback when HTML is given). | ||
html | string | Optional HTML version (org.matrix.custom.html). | |||
msgtype | options | "m.text" | One of m.text, m.notice, m.emote. | ||
reply_to | string | Event ID to reply to. | |||
thread_root | string | Event ID of a thread root to post in. | |||
mentions | json | m.mentions object, for example {“user_ids”: [“@ada:example.com”]}. |
Send a file
Operation message.send_file. Uploads binary data to the media repository, then posts it as an image, video, audio or file message.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
binary_property | binary_property | "data" | yes | ||
file_name | string | Defaults to the binary file name. | |||
msgtype | options | Leave empty to pick from the MIME type (image, video, audio or file without the m. prefix are accepted too). One of m.image, m.video, m.audio, m.file. | |||
caption | string | Text shown with the media. | |||
thread_root | string |
List room messages
Operation message.list. Reads the room timeline, newest first by default.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
dir | options | "b" | One of b, f. | ||
filter | json | RoomEventFilter, for example {“types”: [“m.room.message”]}. | |||
return_all | boolean | false | |||
limit | number | 50 | return_all = false |
Edit a message
Operation message.edit.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_id | string | yes | The original message’s event ID. | ||
text | string | yes | |||
html | string |
React to a message
Operation message.react.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_id | string | yes | |||
key | string | yes | The reaction, usually an emoji. |
Redact (delete) an event
Operation message.redact.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_id | string | yes | |||
reason | string |
Event
| Operation | ID | Effect | Paginated | Cassette tests |
|---|---|---|---|---|
| Get an event | event.get | reads | 1 | |
| Send a custom event | event.send | writes | 1 | |
| Get a state event | event.get_state | reads | 1 | |
| Set a state event | event.set_state | writes | 1 |
Get an event
Operation event.get.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_id | string | yes |
Send a custom event
Operation event.send.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_type | string | yes | |||
content | json | yes |
Get a state event
Operation event.get_state.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_type | string | yes | |||
state_key | string | "" |
Set a state event
Operation event.set_state.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_type | string | yes | |||
state_key | string | "" | |||
content | json | yes |
Room
| Operation | ID | Effect | Paginated | Cassette tests |
|---|---|---|---|---|
| Create a room | room.create | writes | 1 | |
| Join a room | room.join | writes | 1 | |
| Leave a room | room.leave | writes | 1 | |
| Invite a user | room.invite | writes | 1 | |
| Kick a user | room.kick | writes | 1 | |
| Ban a user | room.ban | writes | 1 | |
| Unban a user | room.unban | writes | 1 | |
| List joined rooms | room.list_joined | reads | 1 | |
| List room members | room.members | reads | 1 | |
| Rename a room | room.set_name | writes | 1 | |
| Set the room topic | room.set_topic | writes | 1 | |
| Resolve a room alias | room.resolve_alias | reads | 1 |
Create a room
Operation room.create.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
name | string | ||||
topic | string | ||||
preset | options | "private_chat" | One of private_chat, trusted_private_chat, public_chat. | ||
visibility | options | "private" | One of private, public. | ||
room_alias_name | string | Local alias part, for example ops gives #ops:server. | |||
invite | string | User IDs to invite (array or comma-separated). | |||
is_direct | boolean | false |
Join a room
Operation room.join.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Room ID (!…) or alias (#…). Values from lookup public_rooms. |
Leave a room
Operation room.leave.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
reason | string |
Invite a user
Operation room.invite.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
user_id | string | yes | |||
reason | string |
Kick a user
Operation room.kick.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
user_id | resource_locator | yes | Depends on room. Values from lookup members. | ||
reason | string |
Ban a user
Operation room.ban.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
user_id | resource_locator | yes | Depends on room. Values from lookup members. | ||
reason | string |
Unban a user
Operation room.unban.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
user_id | string | yes | |||
reason | string |
List joined rooms
Operation room.list_joined.
This node has no parameters.
List room members
Operation room.members.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
membership | options | "join" | One of join, invite, leave, ban, knock. |
Rename a room
Operation room.set_name.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
name | string | yes |
Set the room topic
Operation room.set_topic.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
topic | string | yes |
Resolve a room alias
Operation room.resolve_alias.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
alias | string | yes |
User
| Operation | ID | Effect | Paginated | Cassette tests |
|---|---|---|---|---|
| Get the authenticated user | user.whoami | reads | 1 | |
| Get a user profile | user.get_profile | reads | 1 | |
| Search the user directory | user.search | reads | 1 |
Get the authenticated user
Operation user.whoami.
This node has no parameters.
Get a user profile
Operation user.get_profile.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
user_id | string | yes |
Search the user directory
Operation user.search.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
term | string | yes | |||
limit | number | 10 |
Media
| Operation | ID | Effect | Paginated | Cassette tests |
|---|---|---|---|---|
| Upload media | media.upload | writes | 1 | |
| Download media | media.download | reads | 1 |
Upload media
Operation media.upload. Stores binary data in the homeserver’s media repository and returns its mxc:// URI.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
binary_property | binary_property | "data" | yes | ||
file_name | string |
Download media
Operation media.download.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
mxc_uri | string | yes | |||
file_name | string | File name for the binary data. | |||
binary_property | string | "data" |
Lookups
Lookups fill dropdowns and resource pickers in the editor from the vendor API.
| Lookup | Depends on | Search | Description |
|---|---|---|---|
rooms | client-side | ||
public_rooms | client-side | {{ item.topic[:80] if item.topic else ‘’ }} | |
members | room | client-side | {{ item.state_key }} |
Triggers
Node type connector.matrix_trigger.
| Trigger | ID | Kind | Deduplication key | Signature | Webhook registration | Cassette tests |
|---|---|---|---|---|---|---|
| New event in room (polling) | new_event | poll | {{ item.event_id }} | 0 |
Trigger: New event in room (polling)
Checks a room for new events on the poll schedule (messages by default). Events sent by this account are included; compare sender with the whoami result to skip them.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
room | resource_locator | yes | Values from lookup rooms. | ||
event_types | multi_options | ["m.room.message"] | One of m.room.message, m.reaction, m.room.member, m.room.redaction, m.room.topic, m.room.name, m.sticker. |
Import
Exported workflows that use these node types import to this node. Unverified ranges import with a parameter warning until parity fixtures confirm them; see Migrating.
| Source type | Version range | Status | Fixtures |
|---|---|---|---|
n8n-nodes-base.matrix | 1 | unverified |
Provenance
Written from the vendor’s documentation:
- https://spec.matrix.org/latest/client-server-api/
- https://spec.matrix.org/latest/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid
- https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3roomsroomidmessages
- https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3createroom
- https://spec.matrix.org/latest/client-server-api/#room-membership
- https://spec.matrix.org/latest/client-server-api/#content-repository
- https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes
- https://spec.matrix.org/latest/client-server-api/#rich-replies
- https://spec.matrix.org/latest/client-server-api/#threading
- https://spec.matrix.org/latest/client-server-api/#event-replacements
- https://spec.matrix.org/latest/client-server-api/#event-annotations-and-reactions
- https://spec.matrix.org/latest/client-server-api/#redactions
- https://spec.matrix.org/latest/client-server-api/#user-directory
- https://spec.matrix.org/latest/client-server-api/#rate-limiting
- https://spec.matrix.org/latest/appendices/#uris