diff --git a/packages/nodes-base/nodes/Twitter/TweetDescription.ts b/packages/nodes-base/nodes/Twitter/TweetDescription.ts index 9005cbbc0a..aece462828 100644 --- a/packages/nodes-base/nodes/Twitter/TweetDescription.ts +++ b/packages/nodes-base/nodes/Twitter/TweetDescription.ts @@ -20,6 +20,11 @@ export const tweetOperations = [ value: 'create', description: 'Create or reply a tweet', }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a tweet', + }, { name: 'Search', value: 'search', @@ -146,6 +151,28 @@ export const tweetFields = [ ], }, + /* -------------------------------------------------------------------------- */ + /* tweet:delete */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Tweet ID', + name: 'tweetId', + type: 'string', + required: true, + default: '', + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'tweet', + ], + }, + }, + description: 'The ID of the tweet to delete.', + }, + /* -------------------------------------------------------------------------- */ /* tweet:search */ /* -------------------------------------------------------------------------- */ diff --git a/packages/nodes-base/nodes/Twitter/Twitter.node.ts b/packages/nodes-base/nodes/Twitter/Twitter.node.ts index 7a526b91f2..8a9298a660 100644 --- a/packages/nodes-base/nodes/Twitter/Twitter.node.ts +++ b/packages/nodes-base/nodes/Twitter/Twitter.node.ts @@ -195,6 +195,12 @@ export class Twitter implements INodeType { responseData = await twitterApiRequest.call(this, 'POST', '/statuses/update.json', {}, body as unknown as IDataObject); } + // https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-destroy-id + if (operation === 'delete') { + const tweetId = this.getNodeParameter('tweetId', i) as string; + + responseData = await twitterApiRequest.call(this, 'POST', `/statuses/destroy/${tweetId}.json`, {}, {}); + } // https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets if (operation === 'search') { const q = this.getNodeParameter('searchText', i) as string;