AutomationFlowsAI & RAG › 38-GPT-Oss

38-GPT-Oss

38-GPT-Oss. Uses telegramTrigger, agent, lmChatOllama, googleSheets. Event-driven trigger; 5 nodes.

Event trigger★★☆☆☆ complexityAI-powered5 nodesTelegram TriggerAgentLm Chat OllamaGoogle SheetsOutput Parser Structured
AI & RAG Trigger: Event Nodes: 5 Complexity: ★★☆☆☆ AI nodes: yes

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 →

Download .json
{
  "name": "38-GPT-Oss",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -368,
        -32
      ],
      "id": "443d5d72-9404-4482-825e-a4cb562aead7",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.text }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=# Sentiment Analysis Agent\n\nYou are **SentimentAnalysisBot** and your task is to **analyze user reviews from Telegram messages** and categorize each review as **Positive**, **Neutral**, or **Negative**, then output the result in a strict JSON format.\n\n---\n\n## Context & Background\n- **Input Source:** Telegram Trigger node passes in `userId` and the message text as the review.  \n- **Destination:** The JSON output will be appended as a row in Google Sheets.\n\n---\n\n## Primary Responsibilities\n- **Extract** the original review text from the incoming message.  \n- **Classify** the sentiment into one of three labels: `Positive`, `Neutral`, or `Negative`.  \n- **Output** exactly valid JSON with no extra fields or commentary.\n-Extract user ID from this {{ $json.message.chat.id }}\n\n---\n\n## Available Tools\n- *No external tools* are connected for this task.\n\n---\n\n## Output Format\nYour **only** output must be a JSON object matching this schema **exactly** (no code fences, no extra text):\n\n```json\n{\n  \"userId\": \"123444\",\n  \"review\": \"this food is bad\",\n  \"sentiment\": \"Positive\"\n}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        -160,
        -32
      ],
      "id": "746095f0-5551-4de2-b864-4c4a1e59cee5",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": "gpt-oss:latest",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        -240,
        160
      ],
      "id": "0a678a6c-531d-497f-a956-9fcbc9e1f2e6",
      "name": "Ollama Chat Model",
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1GNIyh7GRA_vcr38GqnKNQ4t04uavKjFyonzu3W643Fg",
          "mode": "list",
          "cachedResultName": "n8nGPToss",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GNIyh7GRA_vcr38GqnKNQ4t04uavKjFyonzu3W643Fg/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GNIyh7GRA_vcr38GqnKNQ4t04uavKjFyonzu3W643Fg/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "ID": "={{ $json.output.userId }}",
            "Review": "={{ $json.output.sentiment }}"
          },
          "matchingColumns": [
            "ID"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Review",
              "displayName": "Review",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        256,
        -32
      ],
      "id": "be341add-a8d0-40e4-a5e9-368a76df90d6",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"userId\": \"123444\",\n  \"review\": \"this food is bad\",\n  \"sentiment\": \"Positive\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        112,
        160
      ],
      "id": "116ac16c-5d3b-4b87-8399-bcf7fa5998e7",
      "name": "Structured Output Parser"
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ce90b958-7b31-49ea-86ad-abc42002b032",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "kda7pROmseSwR8U7",
  "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.

About this workflow

38-GPT-Oss. Uses telegramTrigger, agent, lmChatOllama, googleSheets. Event-driven trigger; 5 nodes.

Source: https://github.com/MohElshamy1994/n8n-course-Projetcs/blob/f37fce8a58c6e943ea6021f17a9768c72abc71fa/workflows/39-GPT-Oss.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →