Templates by masaya kawabe
Auto-post X videos with OpenRouter AI captions & Google Sheets deduplication
Who’s it for Marketers, creators, and social managers who want hands-off reposting of a specific X (Twitter) user’s videos — with on-brand AI captions and clean, deduplicated logs. What it does / How it works On a schedule, the workflow resolves a target user, fetches recent tweets with media, filters to video posts, and writes them to Google Sheets for tracking and dedupe. It then builds a shareable video URL, generates a short caption via an AI model (OpenRouter), posts to your X account, and updates the sheet with completion status. Sticky notes inside the workflow explain each step, setup tasks, and best practices. How to set up Add credentials: Twitter (X) OAuth2, Google Sheets OAuth2, OpenRouter. Replace the demo Google Sheet with your own (document ID & sheet name). Set the target X username (or parameterize it). Adjust the schedule (interval/cron) and run a test execution. Verify logs and posting format, then enable. Requirements Twitter (X) OAuth2 credential Google Sheets OAuth2 credential OpenRouter credential (choose an affordable model) How to customize Edit the caption prompt (tone, hashtags count, CTAs, compliance lines). Add filters (language, min/max tweet age, exclude replies/retweets, since_id). Extend logging (timestamps, posted text, account, errors). Introduce a dry-run boolean to skip posting while testing. Swap the caption model or add retry rules for robustness. Security: Don’t hardcode tokens in HTTP nodes. Use n8n Credentials only and remove personal IDs before publishing.
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., targetusername, maxresults, batchdelayminutes) 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=createdat,referencedtweets – 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} json { "data": { "id": "2244994945", "name": "Twitter Dev", "username": "TwitterDev" } } GET /2/users/{id}/tweets (truncated) json { "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} json { "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 Open CONFIG (Set Fields) and replace placeholders: targetusername = "yourhandle" max_results = 100 (per fetch) batchdelayminutes = 2 (throttle between batches) Connect X/Twitter credentials in n8n (no keys hard-coded in HTTP nodes). 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.
Scheduled automation for X and Google Sheets services
Auto-like and repost latest tweets from accounts in Google Sheets Who’s it for Teams and solo creators who manage multiple X (Twitter) accounts they follow and want consistent engagement with minimal effort. Ideal for social managers, community leads, and campaign operators who need safe, repeatable automation. What it does / How it works On a schedule, the workflow reads a Google Sheet of screen names, fetches each account’s latest tweets, then likes and reposts them. A Limit node caps daily actions to respect rate limits and reduce risk. Every step includes Sticky notes: a yellow Overview (full description + safety notes) and white per-step notes (setup tips, filters, and expansion ideas). How to set up Add Credentials for X (Twitter) OAuth2 and Google Sheets (no hardcoded tokens). Point the Google Sheets node to your sheet (header アカウントID, screen names without @). Adjust the search query (e.g., -is:reply -is:retweet) and results per run. Set the Schedule Trigger cadence and Limit (start with 1–3). Test with a staging account, then enable scheduling. Requirements n8n 1.x+ X (Twitter) OAuth2 and Google Sheets OAuth2 credentials A Google Sheet with column アカウントID How to customize the workflow Add a dry-run flag (Set → IF) to skip actions in testing. Insert IF filters for NG words, language, or tweet age (created_at). Add a Wait node between Like and Repost for cooldowns. Append logs to another Google Sheet (status, URL, timestamp). Security & quality: Use Credentials only, avoid personal IDs in nodes, and keep actions modest to respect API limits.