From c2ffd4e6455b383e4ddc2eb310cefbcdf867d622 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 26 Jan 2024 10:33:23 +0000 Subject: [PATCH] fix(Gotify Node): Add option to set content type to support Markdown messages (#8442) --- .../nodes-base/nodes/Gotify/Gotify.node.ts | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Gotify/Gotify.node.ts b/packages/nodes-base/nodes/Gotify/Gotify.node.ts index e2699f927..a53537846 100644 --- a/packages/nodes-base/nodes/Gotify/Gotify.node.ts +++ b/packages/nodes-base/nodes/Gotify/Gotify.node.ts @@ -84,7 +84,7 @@ export class Gotify implements INodeType { }, }, default: '', - description: 'The message. Markdown (excluding html) is allowed.', + description: 'The message to send, If using Markdown add the Content Type option', }, { displayName: 'Additional Fields', @@ -115,6 +115,38 @@ export class Gotify implements INodeType { }, ], }, + { + displayName: 'Options', + name: 'options', + type: 'collection', + placeholder: 'Add Option', + displayOptions: { + show: { + resource: ['message'], + operation: ['create'], + }, + }, + default: {}, + options: [ + { + displayName: 'Content Type', + name: 'contentType', + type: 'options', + default: 'text/plain', + description: 'The message content type', + options: [ + { + name: 'Plain', + value: 'text/plain', + }, + { + name: 'Markdown', + value: 'text/markdown', + }, + ], + }, + ], + }, { displayName: 'Message ID', name: 'messageId', @@ -176,11 +208,20 @@ export class Gotify implements INodeType { const message = this.getNodeParameter('message', i) as string; const additionalFields = this.getNodeParameter('additionalFields', i); + const options = this.getNodeParameter('options', i); const body: IDataObject = { message, }; + if (options.contentType) { + body.extras = { + 'client::display': { + contentType: options.contentType, + }, + }; + } + Object.assign(body, additionalFields); responseData = await gotifyApiRequest.call(this, 'POST', '/message', body);