Automatización de Twitter
Este es unMiscellaneous, Multimodal AIflujo de automatización del dominio deautomatización que contiene 20 nodos.Utiliza principalmente nodos como If, Set, Code, Twitter, Agent. Programador automatizado de tweets de contenido y promoción usando Gemini AI y Google Sheets
- •Credenciales de API de Twitter
- •Credenciales de API de Google Sheets
- •Clave de API de Google Gemini
Nodos utilizados (20)
Categoría
{
"id": "TdUwxmTIJnTwQhJe",
"meta": {
"instanceId": "52254486b159b349334953c1738da94e90477c7604aa8db2062d11afc0120739",
"templateCredsSetupCompleted": true
},
"name": "Twitter Automation",
"tags": [
{
"id": "GcbJtfnHd72wKEMY",
"name": "admin",
"createdAt": "2025-05-06T11:04:59.376Z",
"updatedAt": "2025-05-06T11:04:59.376Z"
}
],
"nodes": [
{
"id": "d09f13f7-1b8a-4b31-946a-fc100cfae834",
"name": "Código",
"type": "n8n-nodes-base.code",
"position": [
48,
160
],
"parameters": {
"jsCode": "// Templates for normal tweets\nconst templates = [\n \"transformation\",\n \"hook-list-takeaway\",\n \"interesting fact\",\n \"Metaphor\",\n \"contrast\",\n \"motivation\",\n \"triad\",\n \"comparison\",\n \"80/20 rule\",\n \"callout\"\n];\n\n// Track last output to avoid duplicates\nif (!global.lastTweet) {\n global.lastTweet = null;\n}\n\nfunction getRandom(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}\n\nlet tweet;\nlet ads = false\n\ndo {\n if (Math.random() < 0.3) {\n // 20% chance → promo\n tweet = \"advertise\";\n ads = true;\n } else {\n // 80% chance → template\n tweet = getRandom(templates);\n }\n} while (tweet === global.lastTweet); // prevent repeats\n\n// Save for next run\nglobal.lastTweet = tweet;\n\nreturn [{ json: { tweet, ads} }];\n\n"
},
"typeVersion": 2
},
{
"id": "bc60c259-c76c-4d73-909b-efb38fa3105c",
"name": "Creador de tuits",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
624,
608
],
"parameters": {
"text": "={{ $json.tweet }}",
"options": {
"systemMessage": "=You are a ghostwriter who creates short, raw, non-repetitive tweets. \nI will give you a \"content type\" (template). \nYour job: generate a tweet in that style. \n\nRules: \n- Generate a tweet based on the given template.\n- Read all past tweets from the database using the Read Database tool (past_tweets column).\n- If the exact tweet (or a close duplicate) appears in read database tool in column past_tweets , regenerate and repeat this check until the tweet is unique.\n- Once a unique tweet is generated, append it to the past_tweets column in the log database tool for future reference.\n- Tweets must be punchy, edgy, and written in modern Twitter style. \n- Keep it concise (2–4 lines). No hashtags. Minimal emojis (🔥 👑 only if it fits) \n-Make tweets in the format of example tweets for each template\n-- Use a separate line for each short phrase or thought.\n\nAvailable templates & patterns: \n\n1. **Transformation** → Fail/fail/fail → sudden win. \n Example: \n 2021: Skinny \n 2022: Skinny \n 2023: Skinny \n 2024: Skinny \n 2025: Unrecognizable \n\n2. **Hook–List–Takeaway** → Bold statement → short list → lesson. \n Example: \n Don’t chase girls \n Chase: \n • skills \n • fitness \n • money \n Women chase you after \n\n3. **Interesting Fact** → Myth-bust → stat → reassurance. \n Example: \n Success isn’t early \n The average founder is 45 \n You’re not late \n You’re loading \n\n4. **Metaphor** → Proverb → apply to daily grind. \n Example: \n Chess isn’t won in one move \n It’s a hundred small ones \n Your life is the same \n Win by inches \n\n5. **Contrast** → Dumb vs smart behavior. \n Example: \n Losers scroll TikTok for fun \n Winners use it to sell \n\n6. **Motivation** → Reject convention → replace with work. \n Example: \n Sleep in on Sunday? \n Someone else is training \n While you’re dreaming \n They’re eating your future \n\n7. **Triad** → 3 parallel actions = new identity. \n Example: \n Build the body \n Build the mind \n Build the bank account \n\n8. **Comparison** → System vs self-action. \n Example: \n Netflix kills time \n Books create empires \n\n9. **80/20 Rule** → Split effort/discipline. \n Example: \n 20% of gym time builds your body \n 80% is in the kitchen \n\n10. **Callout** → Excuse → “wrong” → harsh truth. \n Example: \n “I can’t focus” \n Wrong \n You just can’t put down your phone \n\n"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "551ff01d-1879-4070-a2a7-c091d0dc2023",
"name": "leer base de datos",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
576,
800
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "=",
"lookupColumn": "Date"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit#gid=0",
"cachedResultName": "posts"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit?usp=drivesdk",
"cachedResultName": "Twitter Automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "dNmdYyKDCj9rTeSw",
"name": "Gsheet"
}
},
"typeVersion": 4.7
},
{
"id": "c7bdd791-9b10-46b4-b8d4-8f34e976b2f4",
"name": "registrar base de datos",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
720,
800
],
"parameters": {
"columns": {
"value": {
"Date": "={{$now.format('dd/MM/yyyy')}}",
"PAST TWEETS": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('PAST_TWEETS', ``, 'string') }}"
},
"schema": [
{
"id": "PAST TWEETS",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "PAST TWEETS",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"PAST TWEETS"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit#gid=0",
"cachedResultName": "posts"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit?usp=drivesdk",
"cachedResultName": "Twitter Automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "dNmdYyKDCj9rTeSw",
"name": "Gsheet"
}
},
"typeVersion": 4.7
},
{
"id": "46b83045-f664-4220-975e-da419a34bc4f",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
288,
160
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "ac140c17-1fd3-4f59-a448-acdc6c868eb7",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.ads }}",
"rightValue": "n8n Discord Trigger Bot"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "bf677bd2-4ada-4c42-9827-6364d6b162a4",
"name": "Modelo de chat Google Gemini",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
576,
288
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "VogGayxALH0ssmBl",
"name": "Gemini account"
}
},
"typeVersion": 1
},
{
"id": "63b155b4-c6a2-45cd-9a77-f9f6e4b3aba5",
"name": "Disparador programado",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-400,
160
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 2
}
]
}
},
"typeVersion": 1.2
},
{
"id": "77dd71dc-3990-4543-8971-10b47089f632",
"name": "Nota adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-448,
-80
],
"parameters": {
"width": 432,
"height": 400,
"content": "## TRIGGER\n"
},
"typeVersion": 1
},
{
"id": "559d7e1f-116e-4a03-ab94-d0b42ad08e18",
"name": "Nota adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-432,
64
],
"parameters": {
"color": 5,
"width": 150,
"height": 224,
"content": "**Triggers at 8am,12pm,6pm**"
},
"typeVersion": 1
},
{
"id": "1c5f9e39-8e99-48a2-9ce4-cebfb047cab3",
"name": "Aleatorizador de tiempo",
"type": "n8n-nodes-base.code",
"disabled": true,
"position": [
-176,
160
],
"parameters": {
"jsCode": "// random delay in minutes\nconst delayMinutes = Math.floor(Math.random() * 120); // 0–120 for 2-hour window\nconst delayMilliseconds = delayMinutes * 60 * 1000;\n\nreturn new Promise(resolve => setTimeout(() => resolve([{ json: {} }]), delayMilliseconds ));\n"
},
"typeVersion": 2
},
{
"id": "606de6ed-0e95-430e-9452-2941ab0eb28f",
"name": "Nota adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
-16
],
"parameters": {
"color": 5,
"width": 208,
"height": 304,
"content": "**Generates a random number between 0–120 and waits for that many minutes, allowing tweets to be posted at pseudo-random times throughout the day instead of fixed scheduled times**"
},
"typeVersion": 1
},
{
"id": "31fdce97-7c97-4f46-8c9b-0175e548e7b3",
"name": "Nota adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
-80
],
"parameters": {
"color": 4,
"width": 192,
"height": 400,
"content": "**Randomly selects one of the 10 content strategy templates or one of the 4 promotional ads, with an 80% chance of picking a template and a 20% chance of picking a promo**"
},
"typeVersion": 1
},
{
"id": "226f79d0-3998-4f15-b01a-a092cbd3648e",
"name": "Nota adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
208,
-80
],
"parameters": {
"color": 6,
"height": 400,
"content": "**Checks whether the randomly selected item is a content strategy template or a promotional ad, then routes it accordingly: templates go to the main tweet generator, promos go to the promotional tweet generator**"
},
"typeVersion": 1
},
{
"id": "895c1a3b-39a0-4cfb-abbf-168e2d4675a4",
"name": "Creador de tuits promocionales",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
608,
48
],
"parameters": {
"text": "=You must get the list of contents from google sheets and choose one that has not recently been posted",
"options": {
"systemMessage": "=You are a professional tweet generator. Your job is to create a punchy, short, unique tweet for Twitter based on the ad object provided as input.\n\nInstructions for generating the tweet:\n1. Use only one row from the google sheet to generate a tweet \n2. Make the tweet punchy, short, Twitter-style, unique like a conversation piece\n3. Check the tweet database to avoid repeating past tweets. \n4. Log the final tweet and update the column \"last_posted\"\n5. Output **only one valid tweet** in plain text.\n"
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "86ecdfdf-aa00-4e31-98a4-5a7103d344e8",
"name": "Nota adhesiva5",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-96
],
"parameters": {
"color": 7,
"width": 496,
"height": 624,
"content": "## **Generates a promotional tweet based on the provided ad template, ensuring it follows the ad’s structure and messaging.**"
},
"typeVersion": 1
},
{
"id": "75919d47-faff-492c-9b04-42078b327e0c",
"name": "Nota adhesiva6",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
432
],
"parameters": {
"color": 7,
"width": 496,
"height": 512,
"content": "## **Generates a unique tweet while checking the database to avoid repetition, and logs the newly created tweet into the database for future reference and tracking.**"
},
"typeVersion": 1
},
{
"id": "c8dfaf2b-7d40-4dc1-9f8a-fc178a860817",
"name": "Tweet",
"type": "n8n-nodes-base.set",
"position": [
1120,
304
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f1646841-fab2-4f7e-88e0-3107c176e4fa",
"name": "Tweet",
"type": "string",
"value": "={{ $json.output }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "933f2594-253d-41cc-827d-37ea284597d4",
"name": "Crea el tuit",
"type": "n8n-nodes-base.twitter",
"position": [
1344,
304
],
"parameters": {
"text": "={{ $json.Tweet }}",
"additionalFields": {}
},
"credentials": {
"twitterOAuth2Api": {
"id": "Ig60ncJDzlhLU0Ap",
"name": "X account"
}
},
"typeVersion": 2
},
{
"id": "b11f3dab-6b58-41a3-aa85-d1574cb5bdb9",
"name": "leer base de datos1",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
720,
288
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 814034323,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit#gid=814034323",
"cachedResultName": "promo"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit?usp=drivesdk",
"cachedResultName": "Twitter Automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "dNmdYyKDCj9rTeSw",
"name": "Gsheet"
}
},
"typeVersion": 4.7
},
{
"id": "15c082ad-6d6f-4014-890b-3001dfaa9342",
"name": "registrar base de datos1",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
848,
288
],
"parameters": {
"columns": {
"value": {
"name": "={{ $fromAI('name', 'name of the row', 'string') }}",
"last_posted": "={{$now.format('dd/MM/yyyy')}}"
},
"schema": [
{
"id": "name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "url",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "category",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "goal",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "goal",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "price_points",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "price_points",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "call_to_action",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "call_to_action",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "key_proof",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "key_proof",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "last_posted",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "last_posted",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"name"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 814034323,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit#gid=814034323",
"cachedResultName": "promo"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DbPO7U68-YlOHhb8fIlGu2ImD_N-cm0E-8pwc7qnAo4/edit?usp=drivesdk",
"cachedResultName": "Twitter Automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "dNmdYyKDCj9rTeSw",
"name": "Gsheet"
}
},
"typeVersion": 4.7
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "34a4b44e-e2e1-41ca-8a2b-922144bde668",
"connections": {
"46b83045-f664-4220-975e-da419a34bc4f": {
"main": [
[
{
"node": "895c1a3b-39a0-4cfb-abbf-168e2d4675a4",
"type": "main",
"index": 0
}
],
[
{
"node": "bc60c259-c76c-4d73-909b-efb38fa3105c",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "46b83045-f664-4220-975e-da419a34bc4f",
"type": "main",
"index": 0
}
]
]
},
"c8dfaf2b-7d40-4dc1-9f8a-fc178a860817": {
"main": [
[
{
"node": "933f2594-253d-41cc-827d-37ea284597d4",
"type": "main",
"index": 0
}
]
]
},
"bc60c259-c76c-4d73-909b-efb38fa3105c": {
"main": [
[
{
"node": "c8dfaf2b-7d40-4dc1-9f8a-fc178a860817",
"type": "main",
"index": 0
}
]
]
},
"c7bdd791-9b10-46b4-b8d4-8f34e976b2f4": {
"ai_tool": [
[
{
"node": "bc60c259-c76c-4d73-909b-efb38fa3105c",
"type": "ai_tool",
"index": 0
}
]
]
},
"15c082ad-6d6f-4014-890b-3001dfaa9342": {
"ai_tool": [
[
{
"node": "895c1a3b-39a0-4cfb-abbf-168e2d4675a4",
"type": "ai_tool",
"index": 0
}
]
]
},
"551ff01d-1879-4070-a2a7-c091d0dc2023": {
"ai_tool": [
[
{
"node": "bc60c259-c76c-4d73-909b-efb38fa3105c",
"type": "ai_tool",
"index": 0
}
]
]
},
"b11f3dab-6b58-41a3-aa85-d1574cb5bdb9": {
"ai_tool": [
[
{
"node": "895c1a3b-39a0-4cfb-abbf-168e2d4675a4",
"type": "ai_tool",
"index": 0
}
]
]
},
"1c5f9e39-8e99-48a2-9ce4-cebfb047cab3": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "1c5f9e39-8e99-48a2-9ce4-cebfb047cab3",
"type": "main",
"index": 0
}
]
]
},
"895c1a3b-39a0-4cfb-abbf-168e2d4675a4": {
"main": [
[
{
"node": "c8dfaf2b-7d40-4dc1-9f8a-fc178a860817",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "bc60c259-c76c-4d73-909b-efb38fa3105c",
"type": "ai_languageModel",
"index": 0
},
{
"node": "895c1a3b-39a0-4cfb-abbf-168e2d4675a4",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Avanzado - Varios, IA Multimodal
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Jay Emp0
@jay-emp0AI and Automation developer. Im implementing n8n and ai tools to automate marketing and sales in companies
Compartir este flujo de trabajo