Update examples to include one for receiving and requesting device verification

This commit is contained in:
Skylar Sadlier 2022-03-17 19:51:14 -06:00
parent d01733c647
commit 68cb5a026e
5 changed files with 200 additions and 0 deletions

View File

@ -10,6 +10,8 @@ Build something cool with these nodes? Feel free to submit a pull request to sha
- [Create User with Shared Secret Registration](#create-user-with-shared-secret-registration)
- [Create/Edit Synapse User](#createedit-synapse-user)
- [Use function node to run any command](#use-function-node-to-run-any-command)
- [Start and accept device verification from specific user](#start-and-accept-device-verification-from-specific-user)
- [Request device verification & immediately accept](#request-device-verification--immediately-accept)
- [Respond to "ping" with "pong"](#respond-to-ping-with-pong)
- [Respond to "html" with an HTML message](#respond-to-html-with-an-html-message)
- [Respond to "image" with an uploaded image](#respond-to-image-with-an-uploaded-image)
@ -49,6 +51,26 @@ Allows an administrator to create or modify a user account with a specified `msg
![add-user-with-admin-user.png](add-user-with-admin-user.png)
### Request device verification & immediately accept
[View JSON](request-device-verification.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](request-device-verification.png)
### Start and accept device verification from specific user
[View JSON](start-accept-verification-from-user.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](start-accept-verification-from-user.png)
### Use function node to run any command
[View JSON](custom-redact-function-node.json)

View File

@ -0,0 +1,92 @@
[
{
"id": "9345e8c42e327dba",
"type": "matrix-device-verification",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"mode": "request",
"inputs": 1,
"outputs": 2,
"x": 480,
"y": 1660,
"wires": [
[
"b676082d56430aec"
],
[]
]
},
{
"id": "b676082d56430aec",
"type": "matrix-device-verification",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"mode": "start",
"inputs": 1,
"outputs": 1,
"x": 740,
"y": 1660,
"wires": [
[
"23a0225f2f2615a3"
]
]
},
{
"id": "23a0225f2f2615a3",
"type": "matrix-device-verification",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"mode": "accept",
"inputs": 1,
"outputs": 1,
"x": 970,
"y": 1660,
"wires": [
[]
]
},
{
"id": "3eced60b58c999eb",
"type": "inject",
"z": "f025a8b9fbd1b054",
"name": "",
"props": [
{
"p": "userId",
"v": "@bot:example.com",
"vt": "str"
},
{
"p": "devices",
"v": "[\"ZRRJKASJDUK\"]",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 290,
"y": 1660,
"wires": [
[
"9345e8c42e327dba"
]
]
},
{
"id": "f58ceba2a8819c09",
"type": "comment",
"z": "f025a8b9fbd1b054",
"name": "Request verification from a specific userId and device",
"info": "",
"x": 440,
"y": 1620,
"wires": []
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,86 @@
[
{
"id": "5073ca88b21abfb4",
"type": "matrix-device-verification",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"mode": "receive",
"inputs": 0,
"outputs": 1,
"x": 350,
"y": 1540,
"wires": [
[
"b76c1d185c2793a0"
]
]
},
{
"id": "05947740ced04e2c",
"type": "matrix-device-verification",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"mode": "start",
"inputs": 1,
"outputs": 1,
"x": 740,
"y": 1540,
"wires": [
[
"b3158c0779b72b41"
]
]
},
{
"id": "b76c1d185c2793a0",
"type": "switch",
"z": "f025a8b9fbd1b054",
"name": "is from me",
"property": "userId",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "@skylord123:skylar.tech",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 550,
"y": 1540,
"wires": [
[
"05947740ced04e2c"
]
]
},
{
"id": "b3158c0779b72b41",
"type": "matrix-device-verification",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"mode": "accept",
"inputs": 1,
"outputs": 1,
"x": 970,
"y": 1540,
"wires": [
[]
]
},
{
"id": "eb8ba0741df1b365",
"type": "comment",
"z": "f025a8b9fbd1b054",
"name": "Accept all device validation from a user",
"info": "",
"x": 390,
"y": 1500,
"wires": []
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB