fix(Gotify Node): Add option to set content type to support Markdown messages (#8442)

This commit is contained in:
Jon 2024-01-26 10:33:23 +00:00 committed by GitHub
parent e5514793f6
commit c2ffd4e645
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);