- matrix-create-room had wrong input information listed and wrong API reference URL (fixes #14)

- fixed docs & node for matrix-receive
This commit is contained in:
Skylar Sadlier 2021-09-01 07:26:21 -06:00
parent 14badaeeb5
commit b698389491
5 changed files with 57 additions and 44 deletions

View File

@ -38,19 +38,14 @@
<p>
Create a room with the defined options in <code>msg.payload</code>
</p>
<a href="https://matrix-org.github.io/synapse/develop/admin_api/room_membership.html#edit-room-membership-api" target="_blank">Synapse API Endpoint Information</a>
<a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266" target="_blank">Matrix API Endpoint Information</a>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg.payload
<span class="property-type">string</span>
<span class="property-type">object</span>
</dt>
<dd> a list of options to pass to the /createRoom API. <a href="https://matrix.org/docs/spec/client_server/r0.4.0#id266">Click here</a> for information about what can be passed.</dd>
<dt>msg.userId
<span class="property-type">string</span>
</dt>
<dd> User's ID that will be set into the room.</dd>
</dl>
<h3>Outputs</h3>

View File

@ -53,7 +53,6 @@ module.exports = function(RED) {
};
}
// we need the status code, so set onlydata to false for this request
node.server.matrixClient
.createRoom(msg.payload || {})
.then(function(e){

View File

@ -107,7 +107,7 @@
<p>Receive events from Matrix.</p>
<h3>Outputs</h3>
<ol class="node-ports">
<ul class="node-ports">
<li>Always Returned
<dl class="message-properties">
<dt>msg.type <span class="property-type">string</span></dt>
@ -146,6 +146,11 @@
<dd>the event object returned by the Matrix server</dd>
</dl>
<dl class="message-properties">
<dt>msg.eventId <span class="property-type">object</span></dt>
<dd>The event ID, e.g. $143350589368169JsLZx:localhost</dd>
</dl>
<dl class="message-properties">
<dt>msg.content <span class="property-type">object</span></dt>
<dd>the message's content object</dd>
@ -159,11 +164,6 @@
</li>
<li><code>msg.type</code> == '<strong>m.reaction</strong>'
<dl class="message-properties">
<dt>msg.info <span class="property-type">object</span></dt>
<dd>the content's info.</dd>
</dl>
<dl class="message-properties">
<dt>msg.referenceEventId <span class="property-type">string</span></dt>
<dd>the message that the reaction relates to</dd>
@ -187,39 +187,54 @@
<dd>URL to the sticker image</dd>
</dl>
<dl class="message-properties">
<dt>msg.mxc_url <span class="property-type">string</span></dt>
<dd>Matrix URL to the sticker image</dd>
</dl>
<dl class="message-properties">
<dt>msg.thumbnail_url <span class="property-type">string</span></dt>
<dd>URL to the thumbnail of the sticker</dd>
</dl>
<dl class="message-properties">
<dt>msg.thumbnail_mxc_url <span class="property-type">string</span></dt>
<dd>Matrix URL to the thumbnail of the sticker</dd>
</dl>
</li>
<li><code>msg.type</code> == '<strong>m.file</strong>'
<dl class="message-properties">
<dt>msg.file.info <span class="property-type">string</span></dt>
<dd>the content's info.</dd>
<dt>msg.url <span class="property-type">string</span></dt>
<dd>the file's URL</dd>
</dl>
<dl class="message-properties">
<dt>msg.file.url <span class="property-type">string</span></dt>
<dd>the file's URL</dd>
<dt>msg.mxc_url <span class="property-type">string</span></dt>
<dd>the file's Matrix URL</dd>
</dl>
</li>
<li><code>msg.type</code> == '<strong>m.image</strong>'
<dl class="message-properties">
<dt>msg.image.info <span class="property-type">string</span></dt>
<dd>the image info.</dd>
</dl>
<dl class="message-properties">
<dt>msg.file.url <span class="property-type">string</span></dt>
<dt>msg.url <span class="property-type">string</span></dt>
<dd>the image's URL</dd>
</dl>
<dl class="message-properties">
<dt>msg.file.thumbnail_url <span class="property-type">string</span></dt>
<dt>msg.mxc_url <span class="property-type">string</span></dt>
<dd>the image's Matrix URL</dd>
</dl>
<dl class="message-properties">
<dt>msg.thumbnail_url <span class="property-type">string</span></dt>
<dd>the image's thumbnail URL</dd>
</dl>
<dl class="message-properties">
<dt>msg.thumbnail_mxc_url <span class="property-type">string</span></dt>
<dd>the image's thumbnail Matrix URL</dd>
</dl>
</li>
</ol>
</ul>
</script>

View File

@ -81,10 +81,12 @@ module.exports = function(RED) {
if(msg.content.info) {
if(msg.content.info.thumbnail_url) {
msg.thumbnail_url = node.server.matrixClient.mxcUrlToHttp(msg.content.info.thumbnail_url);
msg.thumbnail_mxc_url = msg.content.info.thumbnail_url;
}
if(msg.content.url) {
msg.url = node.server.matrixClient.mxcUrlToHttp(msg.content.url);
msg.mxc_url = msg.content.url;
}
}
break;

View File

@ -25,14 +25,20 @@
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-server"><i class="fa fa-user"></i> Matrix Server Config</label>
<input type="text" id="node-input-server">
</div>
<div class="form-row">
<label for="node-input-roomId"><i class="fa fa-user"></i> Room ID</label>
<input type="text" id="node-input-roomId">
<input type="text" id="node-input-roomId" placeholder="msg.topic">
</div>
<div class="form-row form-tips">
The configuration Room ID will always override <code>msg.topic</code>
</div>
<div class="form-row">
<label for="node-input-messageType">
Message Type
@ -42,10 +48,11 @@
<option value="m.notice">m.notice</option>
<option value="msg.type">msg.type input</option>
</select>
<div class="form-tips">
It's recommended to use m.notice for bots because the message will render in a lighter text (at least in Element client) for users to distinguish bot and real user messages.
</div>
</div>
<div class="form-row form-tips">
It's recommended to use m.notice for bots because the message will render in a lighter text (at least in Element client) for users to distinguish bot and real user messages.
</div>
<div class="form-row">
<label for="node-input-messageFormat">
Message Format
@ -56,9 +63,6 @@
<option value="msg.format">msg.format input</option>
</select>
</div>
<div class="form-tips">
Must be a valid <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types" target="_blank">MIME Type</a>
</div>
</script>
<script type="text/html" data-help-name="matrix-send-message">
@ -67,6 +71,11 @@
<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg.topic
<span class="property-type">String | null</span>
</dt>
<dd> Room ID to send image to. Optional if configured on the node. If configured on the node this will be overridden.</dd>
<dt>msg.payload
<span class="property-type">String</span>
</dt>
@ -77,28 +86,21 @@
</dt>
<dd> the formatted HTML message (uses msg.payload if not defined). This only affects HTML messages.</dd>
<dt>msg.topic
<span class="property-type">String | Null</span>
</dt>
<dd> Room ID to send image to. Optional if configured on the node. Overrides node configuration if set.</dd>
<dt class="optional">msg.type
<span class="property-type">String | Null</span>
<span class="property-type">String | null</span>
</dt>
<dd> This is only used and required when configured so on the node. Must be set to either 'm.text' or 'm.notice'</dd>
<dd> This is only used and required when configured so on the node. Must be set to either <code>'m.text'</code> or <code>'m.notice'</code></dd>
<dt class="optional">msg.format
<span class="property-type">String | Null</span>
<span class="property-type">String | null</span>
</dt>
<dd> This is only used and required when configured so on the node. Set to null for plain text and 'html' for HTML.</dd>
<dd> This is only used and required when configured so on the node. Set to <code>null</code> for plain text and <code>'html'</code> for HTML.</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Success
<dl class="message-properties">
<dd>original msg object preserved.</dd>
<dt>msg.eventId <span class="property-type">string</span></dt>
<dd>the eventId from the posted message.</dd>
</dl>