Minor improvements to Matrix Node

This commit is contained in:
Jan Oberhauser
2020-11-16 07:58:58 +01:00
parent 4ca2b63bcc
commit 59ecc0e9c1
2 changed files with 18 additions and 19 deletions

View File

@@ -126,16 +126,16 @@ export async function handleMatrixCall(this: IExecuteFunctions | IExecuteSingleF
} else if (resource === 'message') {
if (operation === 'create') {
const roomId = this.getNodeParameter('roomId', index) as string;
const text = this.getNodeParameter('text', index) as string;
const msgType = this.getNodeParameter('msgType', index) as string;
const format = this.getNodeParameter('format', index) as string;
const text = this.getNodeParameter('text', index, '') as string;
const messageType = this.getNodeParameter('messageType', index) as string;
const messageFormat = this.getNodeParameter('messageFormat', index) as string;
const body: IDataObject = {
msgtype: msgType,
msgtype: messageType,
body: text,
};
if (format === 'org.matrix.custom.html') {
const fallbackText = this.getNodeParameter('fallbackText', index) as string;
body.format = format;
if (messageFormat === 'org.matrix.custom.html') {
const fallbackText = this.getNodeParameter('fallbackText', index, '') as string;
body.format = messageFormat;
body.formatted_body = text;
body.body = fallbackText;
}
@@ -167,7 +167,7 @@ export async function handleMatrixCall(this: IExecuteFunctions | IExecuteSingleF
} else {
const limit = this.getNodeParameter('limit', index) as number;
const qs: IDataObject = {
dir: 'b', // Get latest messages first - doesn't return anything if we use f without a previous token.
dir: 'b', // GetfallbackText latest messages first - doesn't return anything if we use f without a previous token.
limit,
};