Skip to main content

Retweet cleanup with scheduling for X/Twitter

Workflow preview

Workflow preview
100%
Retweet cleanup with scheduling for X/Twitter preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Who’s it for Social media managers, creators, and brand accounts that rely on retweets for reach but want an automated, hands off cleanup after campaigns to keep profiles tidy and on brand. What it...

Best for

  • Social Media automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.set, n8n-nodes-base.httprequest, n8n-nodes-base.splitout, n8n-nodes-base.if, n8n-nodes-base.splitinbatches, n8n-nodes-base.twitter, n8n-nodes-base.wait

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by masaya kawabe.

Original n8n.io source

1.1 Workflow description

Title
Retweet cleanup with scheduling for X/Twitter
Workflow name
Retweet cleanup with scheduling for X/Twitter

Who’s it for

Social media managers, creators, and brand accounts that rely on retweets for reach but want an automated, hands-off cleanup after campaigns to keep profiles tidy and on-brand.

What it does / How it works

On a schedule, the workflow resolves your handle to a user ID, fetches recent tweets, filters retweets only, and safely unretweets them using batching and delays to respect rate limits. A dedicated CONFIG (Set Fields) node centralizes variables (e.g., target_username, max_results, batch_delay_minutes) so you can adjust behavior without touching logic.

API endpoints used

  • GET /2/users/by/username/{username} – resolve handle → user ID
  • GET /2/users/{id}/tweets?tweet.fields=created_at,referenced_tweets – fetch recent tweets (identify retweets via referenced_tweets.type === "retweeted")
  • DELETE /2/users/{id}/retweets/{tweet_id} – unretweet

Example response payloads

GET /2/users/by/username/{username}

{
  "data": { "id": "2244994945", "name": "Twitter Dev", "username": "TwitterDev" }
}

GET /2/users/{id}/tweets (truncated)

{
  "data": [
    {
      "id": "1760000000000000000",
      "text": "RT @someone: …",
      "referenced_tweets": [{ "type": "retweeted", "id": "1759999999999999999" }],
      "created_at": "2025-01-15T09:10:11.000Z"
    }
  ],
  "meta": { "result_count": 20 }
}

DELETE /2/users/{id}/retweets/{tweet_id}

{ "data": { "retweeted": false } }

Use cases

  • Brand hygiene: Auto-unretweet promos after 48–72h.
  • Campaign cadence: Remove event retweets once the event ends.
  • Feed freshness: Clear low-priority retweets on a rolling basis.

How to set up

  1. Open CONFIG (Set Fields) and replace placeholders:

    • target_username = "your_handle"
    • max_results = 100 (per fetch)
    • batch_delay_minutes = 2 (throttle between batches)
  2. Connect X/Twitter credentials in n8n (no keys hard-coded in HTTP nodes).

  3. Run once with small values, verify logs, then enable the schedule.

> Optional enhancements: add a dead-letter path (Error Trigger → Set → Sheets/Email/Slack) and a notification node (e.g., Slack) for execution feedback.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - TRIGGER | Schedule (09:00 server time)

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - CONFIG | User Variables (Set Fields)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 2

Block 3 - FETCH | Get user ID by username (X API)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 4 - FETCH | Latest tweets (X API)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - SPLIT | One item per tweet

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 6 - IF | Is retweet?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 7 - LOOP | Split in batches (rate-limit friendly)

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 8 - SEND | Unretweet (delete retweet)

Type / Role
n8n-nodes-base.twitter - twitter
Config choices
Version 2

Block 9 - WAIT | Delay between API calls

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 10 - 🟨 Sticky: Description (copy of page)

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky: Quick setup

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky: Rules & customization

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky: Troubleshooting

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky: TRIGGER details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky: CONFIG details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky: GET USER details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky: FETCH TWEETS details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky: SPLIT details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky: IF RT details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky: LOOP details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky: UNRETWEET details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky: WAIT details

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky: Data flow map

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - NOTIFY | Slack (optional)

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 1

Showing the first 24 of 28 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Retweet cleanup with scheduling for X/Twitter
Complexity advanced
Nodes 28
Categories Social Media
Author masaya kawabe
Published 16 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9766/9766.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Retweet cleanup with scheduling for X/Twitter do?

Who’s it for Social media managers, creators, and brand accounts that rely on retweets for reach but want an automated, hands off cleanup after campaigns to keep profiles tidy and on brand. What it...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Social Media use case.