mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
✨ Add message.delete in Slack nodes (#1377)
This commit is contained in:
parent
4b54b39903
commit
025272953e
|
@ -35,6 +35,11 @@ export const messageOperations = [
|
||||||
value: 'update',
|
value: 'update',
|
||||||
description: 'Updates a message.',
|
description: 'Updates a message.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Delete',
|
||||||
|
value: 'delete',
|
||||||
|
description: 'Deletes a message.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
default: 'post',
|
default: 'post',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
|
@ -1680,4 +1685,46 @@ export const messageFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------- */
|
||||||
|
/* message:delete
|
||||||
|
/* ----------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Channel',
|
||||||
|
name: 'channelId',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getChannels',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'message',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'Channel containing the message to be deleted.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Timestamp',
|
||||||
|
name: 'ts',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'message',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'delete',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: `Timestamp of the message to be deleted.`,
|
||||||
|
},
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
|
@ -795,6 +795,17 @@ export class Slack implements INodeType {
|
||||||
Object.assign(body, updateFields);
|
Object.assign(body, updateFields);
|
||||||
responseData = await slackApiRequest.call(this, 'POST', '/chat.update', body, qs);
|
responseData = await slackApiRequest.call(this, 'POST', '/chat.update', body, qs);
|
||||||
}
|
}
|
||||||
|
//https://api.slack.com/methods/chat.delete
|
||||||
|
if (operation === 'delete') {
|
||||||
|
const channel = this.getNodeParameter('channelId', i) as string;
|
||||||
|
const ts = this.getNodeParameter('ts', i) as string;
|
||||||
|
const body: IDataObject = {
|
||||||
|
channel,
|
||||||
|
ts,
|
||||||
|
};
|
||||||
|
// Add all the other options to the request
|
||||||
|
responseData = await slackApiRequest.call(this, 'POST', '/chat.delete', body, qs);
|
||||||
|
}
|
||||||
//https://api.slack.com/methods/chat.getPermalink
|
//https://api.slack.com/methods/chat.getPermalink
|
||||||
if (operation === 'getPermalink') {
|
if (operation === 'getPermalink') {
|
||||||
const channel = this.getNodeParameter('channelId', i) as string;
|
const channel = this.getNodeParameter('channelId', i) as string;
|
||||||
|
|
Loading…
Reference in a new issue