mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
🔀 Merge branch 'master' of github.com:n8n-io/n8n
This commit is contained in:
commit
b4e6f240f2
|
@ -4,11 +4,11 @@ import {
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
IBinaryKeyData,
|
||||||
IDataObject,
|
IDataObject,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
IBinaryKeyData,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -65,7 +65,12 @@ export class Signl4 implements INodeType {
|
||||||
{
|
{
|
||||||
name: 'Send',
|
name: 'Send',
|
||||||
value: 'send',
|
value: 'send',
|
||||||
description: 'Send an alert.',
|
description: 'Send an alert',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Resolve',
|
||||||
|
value: 'resolve',
|
||||||
|
description: 'Resolve an alert',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'send',
|
default: 'send',
|
||||||
|
@ -161,7 +166,8 @@ export class Signl4 implements INodeType {
|
||||||
default: '',
|
default: '',
|
||||||
description: `If the event originates from a record in a 3rd party system, use this parameter to pass <br/>
|
description: `If the event originates from a record in a 3rd party system, use this parameter to pass <br/>
|
||||||
the unique ID of that record. That ID will be communicated in outbound webhook notifications from SIGNL4,<br/>
|
the unique ID of that record. That ID will be communicated in outbound webhook notifications from SIGNL4,<br/>
|
||||||
which is great for correlation/synchronization of that record with the alert.`,
|
which is great for correlation/synchronization of that record with the alert.<br/>
|
||||||
|
If you resolve / close an alert you must use the same External ID as in the original alert.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Filtering',
|
displayName: 'Filtering',
|
||||||
|
@ -216,9 +222,31 @@ export class Signl4 implements INodeType {
|
||||||
name: 'title',
|
name: 'title',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
description: 'The title or subject of this alert.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'External ID',
|
||||||
|
name: 'externalId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: false,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'resolve',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'alert',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: `If the event originates from a record in a 3rd party system, use this parameter to pass <br/>
|
||||||
|
the unique ID of that record. That ID will be communicated in outbound webhook notifications from SIGNL4,<br/>
|
||||||
|
which is great for correlation/synchronization of that record with the alert.<br/>
|
||||||
|
If you resolve / close an alert you must use the same External ID as in the original alert.`,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -233,6 +261,7 @@ export class Signl4 implements INodeType {
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
if (resource === 'alert') {
|
if (resource === 'alert') {
|
||||||
//https://connect.signl4.com/webhook/docs/index.html
|
//https://connect.signl4.com/webhook/docs/index.html
|
||||||
|
// Send alert
|
||||||
if (operation === 'send') {
|
if (operation === 'send') {
|
||||||
const message = this.getNodeParameter('message', i) as string;
|
const message = this.getNodeParameter('message', i) as string;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields',i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields',i) as IDataObject;
|
||||||
|
@ -259,6 +288,7 @@ export class Signl4 implements INodeType {
|
||||||
if (additionalFields.service) {
|
if (additionalFields.service) {
|
||||||
data['X-S4-Service'] = additionalFields.service as string;
|
data['X-S4-Service'] = additionalFields.service as string;
|
||||||
}
|
}
|
||||||
|
data['X-S4-Status'] = 'new';
|
||||||
if (additionalFields.title) {
|
if (additionalFields.title) {
|
||||||
data['title'] = additionalFields.title as string;
|
data['title'] = additionalFields.title as string;
|
||||||
}
|
}
|
||||||
|
@ -303,14 +333,33 @@ export class Signl4 implements INodeType {
|
||||||
this,
|
this,
|
||||||
'POST',
|
'POST',
|
||||||
'',
|
'',
|
||||||
{},
|
data,
|
||||||
{},
|
{},
|
||||||
endpoint,
|
endpoint,
|
||||||
{
|
{},
|
||||||
formData: {
|
);
|
||||||
...data,
|
}
|
||||||
},
|
// Resolve alert
|
||||||
},
|
if (operation === 'resolve') {
|
||||||
|
|
||||||
|
const data: IDataObject = {};
|
||||||
|
|
||||||
|
data['X-S4-ExternalID'] = this.getNodeParameter('externalId', i) as string;
|
||||||
|
|
||||||
|
data['X-S4-Status'] = 'resolved';
|
||||||
|
|
||||||
|
const credentials = this.getCredentials('signl4Api');
|
||||||
|
|
||||||
|
const endpoint = `https://connect.signl4.com/webhook/${credentials?.teamSecret}`;
|
||||||
|
|
||||||
|
responseData = await SIGNL4ApiRequest.call(
|
||||||
|
this,
|
||||||
|
'POST',
|
||||||
|
'',
|
||||||
|
data,
|
||||||
|
{},
|
||||||
|
endpoint,
|
||||||
|
{},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue