Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

MethodCredential kindAuth kindFieldsTest request
Access tokenmatrix/access_tokenbearerhomeserver_url, token (secret)yes

Actions

Node type connector.matrix. Choose a resource and an operation; each operation has its own parameters.

Message

OperationIDEffectPaginatedCassette tests
Send a text messagemessage.send_textwrites5
Send a filemessage.send_filewrites3
List room messagesmessage.listreadsyes1
Edit a messagemessage.editwrites1
React to a messagemessage.reactwrites1
Redact (delete) an eventmessage.redactwrites1

Send a text message

Operation message.send_text.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
textstringyesPlain text body (also the fallback when HTML is given).
htmlstringOptional HTML version (org.matrix.custom.html).
msgtypeoptions"m.text"One of m.text, m.notice, m.emote.
reply_tostringEvent ID to reply to.
thread_rootstringEvent ID of a thread root to post in.
mentionsjsonm.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.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
binary_propertybinary_property"data"yes
file_namestringDefaults to the binary file name.
msgtypeoptionsLeave 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.
captionstringText shown with the media.
thread_rootstring

List room messages

Operation message.list. Reads the room timeline, newest first by default.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
diroptions"b"One of b, f.
filterjsonRoomEventFilter, for example {“types”: [“m.room.message”]}.
return_allbooleanfalse
limitnumber50return_all = false

Edit a message

Operation message.edit.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_idstringyesThe original message’s event ID.
textstringyes
htmlstring

React to a message

Operation message.react.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_idstringyes
keystringyesThe reaction, usually an emoji.

Redact (delete) an event

Operation message.redact.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_idstringyes
reasonstring

Event

OperationIDEffectPaginatedCassette tests
Get an eventevent.getreads1
Send a custom eventevent.sendwrites1
Get a state eventevent.get_statereads1
Set a state eventevent.set_statewrites1

Get an event

Operation event.get.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_idstringyes

Send a custom event

Operation event.send.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_typestringyes
contentjsonyes

Get a state event

Operation event.get_state.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_typestringyes
state_keystring""

Set a state event

Operation event.set_state.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_typestringyes
state_keystring""
contentjsonyes

Room

OperationIDEffectPaginatedCassette tests
Create a roomroom.createwrites1
Join a roomroom.joinwrites1
Leave a roomroom.leavewrites1
Invite a userroom.invitewrites1
Kick a userroom.kickwrites1
Ban a userroom.banwrites1
Unban a userroom.unbanwrites1
List joined roomsroom.list_joinedreads1
List room membersroom.membersreads1
Rename a roomroom.set_namewrites1
Set the room topicroom.set_topicwrites1
Resolve a room aliasroom.resolve_aliasreads1

Create a room

Operation room.create.

NameTypeDefaultRequiredShown whenDescription
namestring
topicstring
presetoptions"private_chat"One of private_chat, trusted_private_chat, public_chat.
visibilityoptions"private"One of private, public.
room_alias_namestringLocal alias part, for example ops gives #ops:server.
invitestringUser IDs to invite (array or comma-separated).
is_directbooleanfalse

Join a room

Operation room.join.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesRoom ID (!…) or alias (#…). Values from lookup public_rooms.

Leave a room

Operation room.leave.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
reasonstring

Invite a user

Operation room.invite.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
user_idstringyes
reasonstring

Kick a user

Operation room.kick.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
user_idresource_locatoryesDepends on room. Values from lookup members.
reasonstring

Ban a user

Operation room.ban.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
user_idresource_locatoryesDepends on room. Values from lookup members.
reasonstring

Unban a user

Operation room.unban.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
user_idstringyes
reasonstring

List joined rooms

Operation room.list_joined.

This node has no parameters.

List room members

Operation room.members.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
membershipoptions"join"One of join, invite, leave, ban, knock.

Rename a room

Operation room.set_name.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
namestringyes

Set the room topic

Operation room.set_topic.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
topicstringyes

Resolve a room alias

Operation room.resolve_alias.

NameTypeDefaultRequiredShown whenDescription
aliasstringyes

User

OperationIDEffectPaginatedCassette tests
Get the authenticated useruser.whoamireads1
Get a user profileuser.get_profilereads1
Search the user directoryuser.searchreads1

Get the authenticated user

Operation user.whoami.

This node has no parameters.

Get a user profile

Operation user.get_profile.

NameTypeDefaultRequiredShown whenDescription
user_idstringyes

Search the user directory

Operation user.search.

NameTypeDefaultRequiredShown whenDescription
termstringyes
limitnumber10

Media

OperationIDEffectPaginatedCassette tests
Upload mediamedia.uploadwrites1
Download mediamedia.downloadreads1

Upload media

Operation media.upload. Stores binary data in the homeserver’s media repository and returns its mxc:// URI.

NameTypeDefaultRequiredShown whenDescription
binary_propertybinary_property"data"yes
file_namestring

Download media

Operation media.download.

NameTypeDefaultRequiredShown whenDescription
mxc_uristringyes
file_namestringFile name for the binary data.
binary_propertystring"data"

Lookups

Lookups fill dropdowns and resource pickers in the editor from the vendor API.

LookupDepends onSearchDescription
roomsclient-side
public_roomsclient-side{{ item.topic[:80] if item.topic else ‘’ }}
membersroomclient-side{{ item.state_key }}

Triggers

Node type connector.matrix_trigger.

TriggerIDKindDeduplication keySignatureWebhook registrationCassette tests
New event in room (polling)new_eventpoll{{ 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.

NameTypeDefaultRequiredShown whenDescription
roomresource_locatoryesValues from lookup rooms.
event_typesmulti_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 typeVersion rangeStatusFixtures
n8n-nodes-base.matrix1unverified

Provenance

Written from the vendor’s documentation: