This workflow corresponds to n8n.io template #13525 — we link there as the canonical source.
This workflow follows the Agent → Form Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "iAjQBQ1Zx9l5pw9e",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Trend2Content",
"tags": [],
"nodes": [
{
"id": "3a3ed6ce-37c5-4740-aa5d-ebab919a0f81",
"name": "X Scraper",
"type": "n8n-nodes-base.httpRequest",
"position": [
304,
640
],
"parameters": {
"url": "https://api.apify.com/v2/acts/nfp1fpt5gUlBwPcor/run-sync-get-dataset-items",
"method": "POST",
"options": {
"redirect": {
"redirect": {}
}
},
"jsonBody": "={\n \"maxItems\": 20,\n \"searchTerms\": [\n \"{{ $json.Topic }}\"\n ],\n \"sort\": \"Top\"\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer <API Key>"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "be68d745-7889-4108-a007-4647a95f091d",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
512,
640
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f+1234567890bda-4d37-ae4c-f1a5e05f0b2b",
"name": "Content",
"type": "string",
"value": "={{ $json.fullText }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e78e0453-9dd0-44db-8465-bbe2df5cb05e",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
960,
640
],
"parameters": {
"text": "={{ $json.Content }}",
"options": {
"systemMessage": "=You are a helpful AI assistant specialized in {{ $('On form submission').item.json.Topic }} content creation. You will be given informal content from top Twitter posts about a specific {{ $('On form submission').item.json.Topic }} topic (community discussion, not polished articles). Use this input as inspiration to produce:\n\nBlog post title ideas: Generate 3\u20135 creative, attention-grabbing titles relevant to the topic. These should be engaging and optimized for a {{ $('On form submission').item.json.Topic }} audience.\n\nTweet hooks: Create 3\u20135 concise, intriguing one-liners designed to spark curiosity, conversation, or shares on social media about this topic.\n\nEnsure all suggestions are original, on-topic, and likely to resonate with and engage the {{ $('On form submission').item.json.Topic }} community."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "f68bf125-869d-44a9-87f2-5ebde4d9389a",
"name": "Aggregate",
"type": "n8n-nodes-base.aggregate",
"position": [
752,
640
],
"parameters": {
"options": {},
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "Content"
}
]
}
},
"typeVersion": 1
},
{
"id": "4fa7a24f-1d97-4750-9b2a-0923ada503fc",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1104,
848
],
"parameters": {
"jsonSchemaExample": "{\n \"topic_summary\": \"Brief one-sentence summary of the topic based on the post content.\",\n\n \"blog_post_titles\": [\n \"Creative blog post title idea 1\",\n \"Creative blog post title idea 2\",\n \"Creative blog post title idea 3\",\n \"Creative blog post title idea 4 (optional)\",\n \"Creative blog post title idea 5 (optional)\"\n ],\n\n \"tweet_hooks\": [\n \"Engaging tweet hook idea 1\",\n \"Engaging tweet hook idea 2\",\n \"Engaging tweet hook idea 3\",\n \"Engaging tweet hook idea 4 (optional)\",\n \"Engaging tweet hook idea 5 (optional)\"\n ]\n}\n"
},
"typeVersion": 1.3
},
{
"id": "0b406805-3599-448f-8c15-6850cbcbc5cb",
"name": "Append row in sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
1600,
640
],
"parameters": {
"columns": {
"value": {
"tweet_hooks": "={{ $json.tweet_hooks }}",
"blog_post_titles": "={{ $json.blog_post_titles }}"
},
"schema": [
{
"id": "blog_post_titles",
"type": "string",
"display": true,
"required": false,
"displayName": "blog_post_titles",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "tweet_hooks",
"type": "string",
"display": true,
"required": false,
"displayName": "tweet_hooks",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewthiWelucJgbn1V3xizT_eeQ0gROcaHaJr0WNLX5sE/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1ewthiWelucJgbn1V3xizT_eeQ0gROcaHaJr0WNLX5sE",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewthiWelucJgbn1V3xizT_eeQ0gROcaHaJr0WNLX5sE/edit?usp=drivesdk",
"cachedResultName": "Trend2Content"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "c05c39fb-72d4-4a51-9dc5-0eed0c453f2c",
"name": "Code in JavaScript",
"type": "n8n-nodes-base.code",
"position": [
1392,
640
],
"parameters": {
"jsCode": "return {\n topic_summary: $json.output.topic_summary,\n blog_post_titles: $json.output.blog_post_titles.join('\\n\u2022 '),\n tweet_hooks: $json.output.tweet_hooks.join('\\n\u2022 ')\n}\n"
},
"typeVersion": 2
},
{
"id": "d5212c4b-1bc4-42c0-8f49-0845fdfd0d3f",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-800,
448
],
"parameters": {
"width": 848,
"height": 1120,
"content": "# Trend2Content\n\nThis n8n workflow (named **Trend2Content**) takes a short topic input from a small web form, scrapes recent/top social content for that topic (via an Apify act), aggregates the raw text, passes that aggregated content into a LangChain AI agent (Google Gemini in this flow) which returns a structured content output (topic summary, blog post title ideas, tweet hooks), formats that output, and appends the results into a Google Sheet.\n\nIt\u2019s a lightweight:\n\n**Topic \u2192 Trending Content \u2192 AI Ideas \u2192 Sheet**\n\npipeline for fast content ideation.\n\n---\n\n# How It Works (Step-by-Step)\n\n## 1. **On Form Submission** \n## 2. **X Scraper (HTTP Request)** \n## 3. **Edit Fields (Set)** \n## 4. **Aggregate** \n## 5. **Google Gemini Chat Model (LM) + AI Agent \n## 6. **Code in JavaScript** \n## 7. **Append Row in Sheet (Google Sheets)** \n\n\n# Quick Setup Guide\n\ud83d\udc49 [Demo & Setup Video](https://drive.google.com/file/d/1HeypybNWR-AHu1Odtt0kgcsK-uRPB0JP/view?usp=sharing)\n\ud83d\udc49 [Sheet Template](https://docs.google.com/spreadsheets/d/1ewthiWelucJgbn1V3xizT_eeQ0gROcaHaJr0WNLX5sE/edit?usp=sharing)\n\ud83d\udc49 [Course](https://www.udemy.com/course/n8n-automation-mastery-build-ai-powered-enterprise-ready/?referralCode=2EAE71591D3BEB80F2CC)\n"
},
"typeVersion": 1
},
{
"id": "e384a58b-1cd0-4b7a-8b2f-e7fed22b0305",
"name": "On form submission",
"type": "n8n-nodes-base.formTrigger",
"position": [
128,
640
],
"parameters": {
"options": {},
"formTitle": "Trend Extraction and AI Content Generation",
"formFields": {
"values": [
{
"fieldLabel": "Topic",
"placeholder": "Web3",
"requiredField": true
}
]
}
},
"typeVersion": 2.3
},
{
"id": "38b03646-6912-4d0f-b19a-aecad5dd88bb",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
960,
848
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "06e213fc-bb73-481b-b14c-abcc701182c9",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
64,
448
],
"parameters": {
"color": 5,
"width": 608,
"height": 560,
"content": "# Input & Ingest (Trigger \u2192 Scrape \u2192 Normalize)"
},
"typeVersion": 1
},
{
"id": "598c02eb-88cb-4fab-8a82-3510d73d5fb5",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
688,
448
],
"parameters": {
"color": 5,
"width": 608,
"height": 560,
"content": "# Aggregate & Generate (Combine \u2192 LangChain Agent \u2192 Parser)"
},
"typeVersion": 1
},
{
"id": "78ccdd22-980f-40f1-8492-72525ad24e82",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1312,
448
],
"parameters": {
"color": 5,
"width": 608,
"height": 560,
"content": "# Format, Store & Observe (JS Format \u2192 Google Sheets \u2192 Notes)"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "d27e58b7-d67c-4376-9ee1-d0ffe4697716",
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"X Scraper": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "X Scraper",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApigoogleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n workflow (named Trend2Content) takes a short topic input from a small web form, scrapes recent/top social content for that topic (via an Apify act), aggregates the raw text, passes that aggregated content into a LangChain AI agent (Google Gemini in this flow) which…
Source: https://n8n.io/workflows/13525/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow automatically creates hours-long wave music videos by combining AI-generated music from Suno with a background video, fully automated using n8n and ffmpeg-api.
This workflow automatically creates AI product review videos from a product image and short description using n8n and Veo 3.
Summary
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
This n8n workflow converts a YouTube video into a polished, email-ready newsletter. It scrapes the transcript, extracts a thumbnail/logo and brand color theme, uses multiple AI agents to (1) clean & s