mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(Gotify Node): Add option to set content type to support Markdown messages (#8442)
This commit is contained in:
parent
e5514793f6
commit
c2ffd4e645
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue