AutomationFlowsAI & RAG › Telegram Lead Interaction with Supabase

Telegram Lead Interaction with Supabase

Original n8n title: Lead Interaction (supabase) - Autodeployed

Lead Interaction (Supabase) - AutoDeployed. Uses telegramTrigger, httpRequest, telegram. Event-driven trigger; 7 nodes.

Event trigger★★★★☆ complexity7 nodesTelegram TriggerHTTP RequestTelegram
AI & RAG Trigger: Event Nodes: 7 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Telegram 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 →

Download .json
{
  "name": "Lead Interaction (Supabase) - AutoDeployed",
  "settings": {},
  "nodes": [
    {
      "parameters": {},
      "name": "When clicking 'Execute Workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        200,
        300
      ]
    },
    {
      "parameters": {
        "updates": [
          "business_message"
        ]
      },
      "name": "Telegram Business",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1,
      "position": [
        400,
        300
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "SUPABASE_URL_PLACEHOLDER/rest/v1/models?telegram_id=eq.{{$json[\"business_message\"][\"business_connection_id\"]}}&select=*",
        "method": "GET",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "SUPABASE_KEY_PLACEHOLDER"
            },
            {
              "name": "Authorization",
              "value": "Bearer SUPABASE_KEY_PLACEHOLDER"
            }
          ]
        }
      },
      "name": "Get Model & Credits",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        600,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"credits_balance\"]}}",
              "value2": 0,
              "operator": "larger"
            }
          ]
        }
      },
      "name": "Has Credits?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        800,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer OPENROUTER_KEY_PLACEHOLDER"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "sao10k/l3-euryale-70b"
            },
            {
              "name": "messages",
              "value": "=[{\"role\": \"system\", \"content\": \"Eres {{$node[\"Get Model & Credits\"].json[\"config_persona\"]}}...\"}, {\"role\": \"user\", \"content\": \"{{$node[\"Telegram Business\"].json[\"business_message\"][\"text\"]}}\"}]"
            }
          ]
        }
      },
      "name": "AI Agent (Manager)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1000,
        200
      ]
    },
    {
      "parameters": {
        "chatId": "={{$node[\"Telegram Business\"].json[\"business_message\"][\"chat\"][\"id\"]}}",
        "text": "={{$json[\"choices\"][0][\"message\"][\"content\"]}}",
        "additionalFields": {
          "business_connection_id": "={{$node[\"Telegram Business\"].json[\"business_message\"][\"business_connection_id\"]}}"
        }
      },
      "name": "Reply as Business",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        1200,
        200
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "SUPABASE_URL_PLACEHOLDER/rest/v1/models?id=eq.{{$node[\"Get Model & Credits\"].json[\"id\"]}}",
        "method": "PATCH",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "SUPABASE_KEY_PLACEHOLDER"
            },
            {
              "name": "Authorization",
              "value": "Bearer SUPABASE_KEY_PLACEHOLDER"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Prefer",
              "value": "return=minimal"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "credits_balance",
              "value": "={{$node[\"Get Model & Credits\"].json[\"credits_balance\"] - 1}}"
            }
          ]
        }
      },
      "name": "Deduct Credit",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        1400,
        300
      ]
    }
  ],
  "connections": {
    "When clicking 'Execute Workflow'": {
      "main": [
        [
          {
            "node": "Telegram Business",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Business": {
      "main": [
        [
          {
            "node": "Get Model & Credits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Model & Credits": {
      "main": [
        [
          {
            "node": "Has Credits?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Credits?": {
      "main": [
        [
          {
            "node": "AI Agent (Manager)",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "AI Agent (Manager)": {
      "main": [
        [
          {
            "node": "Reply as Business",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply as Business": {
      "main": [
        [
          {
            "node": "Deduct Credit",
            "type": "main",
            "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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Lead Interaction (Supabase) - AutoDeployed. Uses telegramTrigger, httpRequest, telegram. Event-driven trigger; 7 nodes.

Source: https://github.com/Cinefilo007/agente-modelos/blob/29d04f977ab2dcec82910a75b3151a3856c8cb63/flows/lead_interaction_supabase.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Phase 0 — Telegram Foundation. Uses telegramTrigger, telegram, httpRequest. Event-driven trigger; 9 nodes.

Telegram Trigger, Telegram, HTTP Request
AI & RAG

Model Onboarding (Supabase) - AutoDeployed. Uses telegramTrigger, httpRequest, telegram. Event-driven trigger; 6 nodes.

Telegram Trigger, HTTP Request, Telegram
AI & RAG

This workflow creates a multi-talented AI assistant named Simran that interacts with users via Telegram. It can handle text and voice messages, understand the user's intent, and perform various tasks.

MongoDB, Chain Llm, Google Gemini Chat +11
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

This project is a template for building a complete academic virtual assistant using n8n. It connects to Telegram, answers frequently asked questions by querying MongoDB, keeps the community informed a

Telegram, MongoDB, Telegram Trigger +6