Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion packages/nodes-base/nodes/Gotify/Gotify.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
},
],
},
],
},
michael-radency marked this conversation as resolved.
Show resolved Hide resolved
{
displayName: 'Message ID',
name: 'messageId',
Expand Down Expand Up @@ -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);
Expand Down
Loading