node-red-contrib-matrix-cha.../examples
2022-03-17 19:54:13 -06:00
..
add-user-with-admin-user.json - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
add-user-with-admin-user.png - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
custom-redact-function-node.json Closes #21 2021-09-03 08:24:02 -06:00
custom-redact-function-node.png Closes #21 2021-09-03 08:24:02 -06:00
deactivate-user.json - Bump version to 0.4.6 2022-02-09 12:48:52 -07:00
deactivate-user.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
delete-event.json Add example for delete-event node 2022-03-17 14:40:53 -06:00
delete-event.png Add example for delete-event node 2022-03-17 14:40:53 -06:00
force-join-room.json - Bump version to 0.4.6 2022-02-09 12:48:52 -07:00
force-join-room.png - Bump version to 0.4.6 2022-02-09 12:48:52 -07:00
README.md Update examples to move function example above verification ones. 2022-03-17 19:54:13 -06:00
request-device-verification.json Update examples to include one for receiving and requesting device verification 2022-03-17 19:51:14 -06:00
request-device-verification.png Update examples to include one for receiving and requesting device verification 2022-03-17 19:51:14 -06:00
respond-file-with-file.json - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
respond-file-with-file.png Added some examples 2021-08-18 14:19:20 -06:00
respond-image-with-image.json - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
respond-image-with-image.png Added some examples 2021-08-18 14:19:20 -06:00
respond-joinroom.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-joinroom.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-newroom-invite.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-newroom-invite.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-ping-pong.json - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
respond-ping-pong.png Added some examples 2021-08-18 14:19:20 -06:00
respond-react-with-reaction.json - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
respond-react-with-reaction.png Added some examples 2021-08-18 14:19:20 -06:00
respond-room-users.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-room-users.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-rooms.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-rooms.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-to-html-with-html.json - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
respond-to-html-with-html.png Added some examples 2021-08-18 14:19:20 -06:00
respond-users-list.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-users-list.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-whois.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
respond-whois.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
room-kick-ban.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
room-kick-ban.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
shared-secret-registration.json - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
shared-secret-registration.png - Fixed not being able to disable e2ee 2021-08-30 19:21:02 -06:00
start-accept-verification-from-user.json Update examples to include one for receiving and requesting device verification 2022-03-17 19:51:14 -06:00
start-accept-verification-from-user.png Update examples to include one for receiving and requesting device verification 2022-03-17 19:51:14 -06:00
store-received-files.json - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00
store-received-files.png - Move client storage to the Node-RED user directory. 2022-02-09 12:13:27 -07:00

Examples

These are examples of what is possible with the node-red-contrib-matrix-chat module for Node-RED

If you want to try any of them out just copy their JSON contents from their .json file and use the hamburger menu in Node-RED to import the flow.

Build something cool with these nodes? Feel free to submit a pull request to share it!

Index

Create user with Shared Secret Registration

View JSON

Use this flow to create users on servers with closed registration. You also use this endpoint to create your first admin user as it is the same as running the local python script on the server. This requires your registration secret from your homeserver.yaml Synapse server configuration file.

Edit the object on the inject node to the user/pass combo you want to create and hit the inject button (to the left of the inject node).

Note: This only works on Synapse servers.

shared-secret-registration.png

Create/Edit Synapse User

View JSON

Allows an administrator to create or modify a user account with a specified msg.userId.

add-user-with-admin-user.png

Use function node to run any command

View JSON

If we do not have a node for something you want to do you can do this manually with a function node. We now have a node for removing events but this is still a good example.

Note: You should make sure to catch any errors in your function node otherwise you could cause Node-RED to crash.

To view what sort of functions you have access to check out the client.ts file from matrix-js-sdk here.

custom-redact-function-node.png

Request device verification & immediately accept

View JSON

Edit the inject node to match the details of a user & device you would like to request verification from. After the end user starts verification the bot automatically accepts the result (note: you should be validating the result and not just blindly accepting them, this is just an example)

add-user-with-admin-user.png

Start and accept device verification from specific user

View JSON

Edit the switch node labeled "is from me" to match whatever user ID you would like to accept verification requests from. After verification starts the bot automatically accepts the result (note: you should be validating the result and not just blindly accepting them, this is just an example)

add-user-with-admin-user.png

Respond to "ping" with "pong"

View JSON

Use this flow to respond to anyone that says "ping" with "pong" into the same room.

respond-ping-pong.png

Respond to "html" with an HTML message

View JSON

Use this flow to respond to anyone that says "html" with an example HTML message. This shows how easy it is to send HTML.

respond-to-html-with-html.png

Respond to "image" with an uploaded image

View JSON

You will need an image on the machine running Node-RED. In this case example.png exists inside the Node-RED directory.

respond-image-with-image.png

Respond to "file" with an uploaded file

View JSON

You will need a file on the machine running Node-RED. In this case sample.pdf exists inside the Node-RED directory.

respond-file-with-file.png

Respond to "react" with a reaction

View JSON

Give a 👍 reaction when someone says "react"

respond-react-with-reaction.png

Remove messages containing "delete"

View JSON

Any messages containing "delete" will try to be removed by the client.

respond-react-with-reaction.png

Respond to "users" with full list of server users

View JSON

When someone sends the text "users" they get a HTML message back containing all the current users on the server. If your server has a lot of users this paginates and sends a message with 25 users per message.

This requires admin privileges.

respond-users-list.png

Respond to "newroom" by creating new room and inviting user

View JSON

When someone sends "newroom" a new room will be created and the user that said the message will be invited. The client will also send a welcome message into the new room.

respond-newroom-invite.png

Respond to "joinroom <room_id_or_alias>" by joining mentioned room

View JSON

When someone sends "newroom" a new room will be created and the user that said the message will be invited. The client will also send a welcome message into the new room.

respond-joinroom.png

Respond to "rooms <user_id>" with user's rooms (list server's rooms if <user_id> is left blank)

View JSON

Responds to "rooms <user_id>" with that user's rooms. If the message is just "rooms" it responds with a list of all rooms the server is participating in.

Note: If there are a lot of rooms this may fail to send the message as it is too large. This also only works for user's that are on the current server.

This requires admin privileges.

respond-rooms.png

Respond to "whois <user_id>" with information about the user's session

View JSON

This lists out the user's session info. Each session contains the IP address, when it was last seen, and the user agent. Useful to find out more about a specific user on your server.

Note: If there are a lot of sessions this may fail to send the message as it is too large. This also only works for user's that are on the current server.

This requires admin privileges.

respond-whois.png

Respond to "room_users" with current room's users

View JSON

List out the users participating in a room.

Note: If there are a lot of users in the room this will fail to send due to a large message error.

respond-room-users.png

Download & store all received files/images

View JSON

Download received files/images. If the file is encrypted it will decrypt it for you. The decrypt node downloads the file for you otherwise you need to use a HTTP Request node to download the file.

Note: You may need to edit the storage directory for this to work. Default action is to create a downloads folder in the Node-RED directory and places files in that but there is a good chance your Node-RED instance doesn't have access to write to this directory.

store-received-files.png

Kick/Ban user from room

View JSON

If you say "kick @test:example.com" the bot will kick @test:example.com from the current room.

If you say "ban @test:example.com" the bot will ban @test:example.com from the current room.

Note: This requires the bot to have permissions to kick/ban in the current room.

room-kick-ban.png

Deactivate user

View JSON

If you say "deactivate_user @test:example.com" the bot will deactivate the @test:example.com account on the server.

Note: This requires the bot to be a server admin.

WARNING: Accounts that are deleted cannot be restored. If you want to temp-disable edit the user instead.

room-kick-ban.png

Force user to join room

View JSON

If you say "force_join @test:example.com !320j90mf0394f:example.com" the bot will force the user @test:example.com into room !320j90mf0394f:example.com

Note: This requires the bot to be a server admin. This also only works for rooms on the same server.

room-kick-ban.png