Add message.delete in Slack nodes (#1377)

This commit is contained in:
tumf 2021-01-25 22:56:37 +09:00 committed by GitHub
parent 4b54b39903
commit 025272953e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 0 deletions

View file

@ -35,6 +35,11 @@ export const messageOperations = [
value: 'update',
description: 'Updates a message.',
},
{
name: 'Delete',
value: 'delete',
description: 'Deletes a message.',
},
],
default: 'post',
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[];

View file

@ -795,6 +795,17 @@ export class Slack implements INodeType {
Object.assign(body, updateFields);
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
if (operation === 'getPermalink') {
const channel = this.getNodeParameter('channelId', i) as string;