Room ID to send file to. Optional if configured on the node. Overrides node configuration if set.
+
Room ID to send file to. Ignored if configured on the node, otherwise required.
msg.filename
- String | Null
+ string | null
-
name of the file to upload (optional). Overrides node configuration.
-
-
msg.contentType
- String | Null
-
-
Content MIME Type. Optional if configured on the node. Overrides node configuration if set.
+
name of the file to upload (optional). Note: If this is not defined the file will receive a randomly generated name (without an extension).
msg.body
- String | Null
+ string | null
-
this will be the display name the client will see when rendered in their chat client. If this is left empty the it uses msg.filename. If msg.filename is also undefined it sets it to empty string
+
this will be the display name the client will see when rendered in their chat client. If this is left empty it will just display as "Attachment".
+
+
msg.contentType
+ string | null
+
+
Content MIME Type. Optional but highly recommended (so the client receiving knows what type of file it is).
+
+
msg.content
+ object | null
+
+
craft your own msg.content to send to the server. If defined then msg.filename, msg.contentType, msg.body, and msg.payload aren't required since the file already exists.
Outputs
Success
-
original msg object preserved.
+
msg.eventId string
+
the eventId from the posted message.
Error
diff --git a/src/matrix-send-file.js b/src/matrix-send-file.js
index 247fb98..d6a6d59 100644
--- a/src/matrix-send-file.js
+++ b/src/matrix-send-file.js
@@ -61,17 +61,12 @@ module.exports = function(RED) {
return;
}
- msg.contentType = msg.contentType || node.contentType;
- if(!msg.contentType) {
- node.error('msg.contentType is required');
- return;
- }
-
+ msg.contentType = node.contentType || msg.contentType || null;
node.log("Uploading file " + msg.filename);
node.server.matrixClient.uploadContent(
msg.payload, {
name: msg.filename || null, // Name to give the file on the server.
- rawResponse: (msg.rawResponse || false), // Return the raw body, rather than parsing the JSON.
+ rawResponse: false, // Return the raw body, rather than parsing the JSON.
type: msg.contentType, // Content-type for the upload. Defaults to file.type, or applicaton/octet-stream.
onlyContentUri: false // Just return the content URI, rather than the whole body. Defaults to false. Ignored if opts.rawResponse is true.
})
@@ -79,18 +74,18 @@ module.exports = function(RED) {
const content = {
msgtype: 'm.file',
url: file.content_uri,
- body: (msg.body || msg.filename) || "",
+ body: msg.body || "",
};
node.server.matrixClient
.sendMessage(msg.topic, content)
- .then(function(imgResp) {
- node.log("File message sent: " + imgResp);
+ .then(function(e) {
+ node.log("File message sent: " + e);
msg.eventId = e.eventId;
node.send([msg, null]);
})
.catch(function(e){
node.warn("Error sending file message " + e);
- msg.matrixError = e;
+ msg.error = e;
node.send([null, msg]);
});
}).catch(function(e){
diff --git a/src/matrix-send-image.html b/src/matrix-send-image.html
index 2faa577..655c283 100644
--- a/src/matrix-send-image.html
+++ b/src/matrix-send-image.html
@@ -30,50 +30,50 @@
-
+
- Must be a valid MIME Type
+ Must be a valid MIME Type (ex: image/png) or left empty
Is optional but used for pagination, denoting the offset in the returned results. This should be treated as an opaque value and not explicitly set to anything other than the return value of next_token from a previous call. Defaults to 0.
+
Is optional but used for pagination, denoting the offset in the returned results. This should be treated as an opaque value and not explicitly set to anything other than the return value of msg.next_token from a previous call. Defaults to 0.
msg.limit
- Integer
+ integer
limit - representing a positive integer - Is optional but is used for pagination, denoting the maximum number of items to return in this call. Defaults to 100.
msg.guests
- Bool
+ bool
Is optional and if false will exclude guest users. Defaults to true to include guest users.
msg.order_by
- String
+ string
The method by which to sort the returned list of users.
@@ -85,14 +85,41 @@
msg.payload object
the response object from the server.
+
msg.payload.next_token string
+
string representing a positive integer - Indication for pagination. If this is unset then there are no more users to paginate through.
+
+
msg.payload.total integer
+
Total number of users.
+
msg.payload.users array
-
list of users from the Matrix server. Click here for details on what this contains (or do a test and dump the output). We would put the details here in the doc but Synapse is constantly changing so it's best to reference the official Synapse docs.
+
list of users from the Matrix server. Click here for details on what this contains (or do a debug on the output).
-
msg.next_token string
-
string representing a positive integer - Indication for pagination. See above (input msg.from)
+
msg.payload.users[].name string
+
Fully-qualified user ID (ex. @user:server.com).
-
msg.total integer
-
Total number of media.
+
msg.payload.users[].is_guest bool
+
Status if that user is a guest account.
+
+
msg.payload.users[].admin string
+
Status if that user is a server administrator.
+
+
msg.payload.users[].user_type string
+
Type of the user. Normal users are type None. This allows user type specific behaviour. There are also types support and bot.
+
+
msg.payload.users[].deactivated bool
+
Status if that user has been marked as deactivated.
+
+
msg.payload.users[].shadow_banned bool
+
Status if that user has been marked as shadow banned.
+
+
msg.payload.users[].displayname string
+
The user's display name if they have set one.
+
+
msg.payload.users[].avatar_url string
+
The user's avatar URL if they have set one.
+
+
msg.payload.users[].creation_ts integer
+
The user's creation timestamp in ms.
Error
diff --git a/src/matrix-synapse-users.js b/src/matrix-synapse-users.js
index 32d42e0..7be6eb3 100644
--- a/src/matrix-synapse-users.js
+++ b/src/matrix-synapse-users.js
@@ -58,7 +58,7 @@ module.exports = function(RED) {
msg.payload = e;
node.send([msg, null]);
}).catch(function(e){
- node.warn("Error fetching user list " + e);
+ node.warn("Error fetching server user list " + e);
msg.error = e;
node.send([null, msg]);
});
diff --git a/src/matrix-whois-user.html b/src/matrix-whois-user.html
index edf68a4..81f1386 100644
--- a/src/matrix-whois-user.html
+++ b/src/matrix-whois-user.html
@@ -36,6 +36,7 @@