This workflow follows the Agent → Execute Workflow 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 →
{
"name": "TextAi",
"nodes": [
{
"parameters": {
"promptType": "define",
"text": "={{ $json.content }}",
"options": {
"systemMessage": "={{ $json.systemMessage }}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
1056,
-400
],
"id": "a973c7f2-7c33-414c-bd63-43994fd337cd",
"name": "AI Agent"
},
{
"parameters": {
"modelName": "models/gemini-2.5-flash-lite",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
1056,
-240
],
"id": "1f9886b4-90f7-4dff-997c-4eb5a450dbab",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const rawText = $input.first().json.output;;\n\n// 2. Use a regular expression to find the JSON content.\n// This regex looks for either:\n// - Content inside a ```json ... ``` block (match[1])\n// - A raw object starting with { and ending with } (match[2])\nconst match = rawText.match(/```json\\s*([\\s\\S]*?)\\s*```|({[\\s\\S]*})/);\n\n// 3. Get the actual JSON string (whichever part matched).\n// We prioritize the markdown-wrapped content (match[1]) if it exists.\nconst jsonString = match[1] || match[2];\n\n// 4. Check if we actually found any JSON.\nif (!jsonString) {\n throw new Error(\"Could not find any JSON content in the AI output.\");\n}\n\n// 5. Parse the *clean* JSON string.\nconst parsedJson = JSON.parse(jsonString);\n\n// 6. Return the data, nested under an 'output' field\n// so you can access it as $json.output.content\nreturn [{ json: { output: parsedJson } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1408,
-400
],
"id": "a3e5b58f-8419-43e3-8044-647c62f4d3dc",
"name": "Code in JavaScript"
},
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "content",
"type": "any"
},
{
"name": "systemMessage",
"type": "any"
}
]
}
},
"id": "cba18b13-6b12-4cde-bef9-eac7fe75a650",
"typeVersion": 1.1,
"name": "Start",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
832,
-400
]
}
],
"connections": {
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Start": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c760ea88-74e2-429c-b673-39643d2c8905",
"id": "w3q9u9lBl8416dkl",
"tags": []
}
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.
googlePalmApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
TextAi. Uses agent, lmChatGoogleGemini, executeWorkflowTrigger. Event-driven trigger; 4 nodes.
Source: https://github.com/memo1918/ImageToAnki-n8nAutomation/blob/428dd50a0c9778efd26a1c3b09b474731da403fa/workflows/TextAi.json — 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.
How it Works
> AI-powered nutrition assistant for Telegram — log meals, set goals, and get personalized daily reports with Google Sheets integration.
This workflow is designed for marketers, content creators, agencies, and solo founders who want to publish long‑form posts with visuals on autopilot using n8n and AI agents.
Main. Uses httpRequest, agent, lmChatGoogleGemini, outputParserStructured. Event-driven trigger; 57 nodes.
Overview