AutomationFlowsAI & RAG › God_is_typing V2.6 (multi-channel: Telegram + Web)

God_is_typing V2.6 (multi-channel: Telegram + Web)

god_is_typing v2.6 (Multi-channel: Telegram + Web). Uses telegramTrigger, telegram, supabase, httpRequest. Event-driven trigger; 66 nodes.

Event trigger★★★★★ complexityAI-powered66 nodesTelegram TriggerTelegramSupabaseHTTP RequestAgentGroq ChatMemory Buffer WindowN8N Nodes Supabase Advanced
AI & RAG Trigger: Event Nodes: 66 Complexity: ★★★★★ AI nodes: yes Added:
God_is_typing V2.6 (multi-channel: Telegram + Web) — n8n workflow card showing Telegram Trigger, Telegram, Supabase integration

This workflow follows the Agent → HTTP Request 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": "god_is_typing v2.6 (Multi-channel: Telegram + Web)",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message",
          "callback_query"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -144,
        336
      ],
      "id": "2a89ddd4-b8f6-458c-8800-0d91888e4492",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Normalize input from Telegram: handles both messages and callback_query (button clicks)\nconst input = $input.first().json;\n\nlet eventType, chatId, username, text, callbackData, messageId;\ntext = '';\ncallbackData = null;\n\nif (input.callback_query) {\n  // User clicked an inline keyboard button\n  const cb = input.callback_query;\n  chatId = cb.message.chat.id;\n  username = cb.from.username || cb.from.first_name || 'unknown';\n  callbackData = cb.data;\n  messageId = cb.message.message_id;\n  if (callbackData && callbackData.startsWith('lang:')) eventType = 'save_language';\n  else if (callbackData && callbackData.startsWith('deity:')) eventType = 'save_deity';\n  else eventType = 'unknown_callback';\n} else if (input.message) {\n  const msg = input.message;\n  chatId = msg.chat.id;\n  username = msg.from.username || msg.from.first_name || 'unknown';\n  text = msg.text || '';\n  messageId = msg.message_id;\n\n  // Detect command\n  const cmdMatch = text.match(/^\\/(\\w+)\\s*(.*)/);\n  if (cmdMatch) {\n    const cmd = cmdMatch[1].toLowerCase();\n    const rest = (cmdMatch[2] || '').trim();\n    if (cmd === 'start' || cmd === 'menu') {\n      eventType = 'show_language_picker';\n      text = '';\n    } else if (cmd === 'forget') {\n      eventType = 'forget';\n      text = '';\n    } else {\n      // Other commands treated as regular message after stripping command\n      eventType = 'process_message';\n      text = rest || text;\n    }\n  } else {\n    eventType = 'process_message';\n  }\n} else {\n  eventType = 'unknown';\n  chatId = null;\n  username = 'unknown';\n}\n\n// Robust language detection (used as fallback when user has no saved language)\nfunction detectLanguage(t) {\n  if (!t) return 'es'; // default to Spanish for Latin American audience\n  const lower = t.toLowerCase();\n  if (/[\u00f1\u00e1\u00e9\u00ed\u00f3\u00fa\u00fc\u00bf\u00a1]/.test(lower)) return 'es';\n\n  const spanishWords = ['que','qu\u00e9','c\u00f3mo','como','por','para','pero','cu\u00e1ndo','cuando','d\u00f3nde','donde','porque','soy','eres','estoy','est\u00e1s','dios','se\u00f1or','amor','vida','muerte','alma','oraci\u00f3n','fe','esperanza','perd\u00f3n','m\u00ed','t\u00fa','nosotros','ustedes','hola','gracias'];\n  const englishWords = ['what','how','why','when','where','because','i','you','we','they','am','are','is','god','lord','love','life','death','soul','prayer','faith','hope','forgiveness','the','and','or','but','this','that','with','from','hello','thanks'];\n\n  let es = 0, en = 0;\n  const words = lower.split(/\\s+/);\n  for (const w of words) {\n    const c = w.replace(/[?\u00bf.,!\u00a1;:'\"]/g, '');\n    if (spanishWords.includes(c)) es++;\n    if (englishWords.includes(c)) en++;\n  }\n  if (es === en) return 'es';\n  return es > en ? 'es' : 'en';\n}\n\nreturn {\n  eventType: eventType,\n  chatId: chatId,\n  username: username,\n  text: text,\n  callbackData: callbackData,\n  messageId: messageId,\n  detectedLanguage: detectLanguage(text)\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        48,
        336
      ],
      "id": "0fec1a96-6114-4c08-875a-7285bf4fb88a",
      "name": "Parse Input"
    },
    {
      "parameters": {
        "jsCode": "// Combine parsed input with user state from Supabase\n// Robust parser handles multiple possible structures from Supabase Advanced node\nconst parsed = $('Parse Input').first().json;\nlet rawState = $input.first().json;\n\nfunction extractState(data) {\n  if (!data) return null;\n  if (Array.isArray(data)) {\n    if (data.length === 0) return null;\n    return extractState(data[0]);\n  }\n  if (data.json && typeof data.json === 'object') {\n    return extractState(data.json);\n  }\n  if (data.chat_id !== undefined && data.chat_id !== null) {\n    return data;\n  }\n  if (data.rows && Array.isArray(data.rows)) {\n    return extractState(data.rows);\n  }\n  if (data.data) {\n    return extractState(data.data);\n  }\n  if (typeof data === 'object' && Object.keys(data).length === 0) return null;\n  return null;\n}\n\nconst state = extractState(rawState);\nconst savedLanguage = state ? state.language : null;\nconst savedDeity = state ? state.deity : null;\nconst hasState = !!state;\n\n// Determine final event type\nlet finalEventType = parsed.eventType;\n\n// If user sends a regular message but has no language set, force the language picker\nif (parsed.eventType === 'process_message' && !savedLanguage) {\n  finalEventType = 'show_language_picker';\n}\n\n// If user has language but no deity, force deity picker\nif (parsed.eventType === 'process_message' && savedLanguage && !savedDeity) {\n  finalEventType = 'show_deity_picker';\n}\n\n// Extract callback values if applicable\nlet selectedLanguage = null;\nlet selectedDeity = null;\nif (parsed.callbackData) {\n  if (parsed.callbackData.startsWith('lang:')) selectedLanguage = parsed.callbackData.split(':')[1];\n  if (parsed.callbackData.startsWith('deity:')) selectedDeity = parsed.callbackData.split(':')[1];\n}\n\n// Effective values: callback selection > saved > detected fallback\nconst effectiveLanguage = selectedLanguage || savedLanguage || parsed.detectedLanguage || 'es';\nconst effectiveDeity = selectedDeity || savedDeity || null;\n\nreturn {\n  eventType: finalEventType,\n  chatId: parsed.chatId,\n  username: parsed.username,\n  usermessage: parsed.text,\n  callbackData: parsed.callbackData,\n  selectedLanguage: selectedLanguage,\n  selectedDeity: selectedDeity,\n  language: effectiveLanguage,\n  deity: effectiveDeity,\n  hasState: hasState,\n  messageId: parsed.messageId,\n  // Debug info (can be removed after validation)\n  _debug_savedLanguage: savedLanguage,\n  _debug_savedDeity: savedDeity,\n  _debug_stateExtracted: state ? 'yes' : 'no'\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        448,
        336
      ],
      "id": "57306a3a-53b6-4500-a8e7-3898e01e2623",
      "name": "Merge State"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "e43d9872-5fd4-4de9-b0ac-f27f3fbfd993",
                    "leftValue": "={{ $json.eventType }}",
                    "rightValue": "show_language_picker",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "language_picker"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "529126d4-e5e6-4f6e-b605-39207be0307d",
                    "leftValue": "={{ $json.eventType }}",
                    "rightValue": "save_language",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "save_language"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "e259f230-db74-43da-a658-e89ac374d3bc",
                    "leftValue": "={{ $json.eventType }}",
                    "rightValue": "show_deity_picker",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "deity_picker"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "607d859d-8935-480e-a536-7dddb03a5129",
                    "leftValue": "={{ $json.eventType }}",
                    "rightValue": "save_deity",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "save_deity"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "34b3c37a-7ff9-486c-b340-53047c51c155",
                    "leftValue": "={{ $json.eventType }}",
                    "rightValue": "forget",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "forget"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "a6df4bbc-5002-493b-9ca4-7c2d862c3d12",
                    "leftValue": "={{ $json.eventType }}",
                    "rightValue": "process_message",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "process_message"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        656,
        336
      ],
      "id": "a927a2ee-5b78-41a4-b6f3-c50f0ca4184b",
      "name": "Route Event"
    },
    {
      "parameters": {
        "chatId": "={{ $json.chatId }}",
        "text": "\ud83d\udd4a\ufe0f \u00bfEn qu\u00e9 idioma prefieres conversar?\n\ud83d\udd4a\ufe0f Which language do you prefer?",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83c\uddea\ud83c\uddf8 Espa\u00f1ol",
                    "additionalFields": {
                      "callback_data": "lang:es"
                    }
                  },
                  {
                    "text": "\ud83c\uddec\ud83c\udde7 English",
                    "additionalFields": {
                      "callback_data": "lang:en"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        960,
        -80
      ],
      "id": "b9e334db-cbb1-413a-8ed7-94c90f19eb30",
      "name": "Send Language Picker",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Merge State').item.json.chatId }}",
        "text": "={{ $('Merge State').item.json.selectedLanguage === 'es' ? '\u2728 Elige una deidad para conversar:' : '\u2728 Choose a deity to converse with:' }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "\u2721\ufe0f Juda\u00edsmo",
                    "additionalFields": {
                      "callback_data": "deity:jewish"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\u271d\ufe0f Cristianismo",
                    "additionalFields": {
                      "callback_data": "deity:christian"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\u2638\ufe0f Budismo",
                    "additionalFields": {
                      "callback_data": "deity:buddhist"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83c\udfdb\ufe0f Pantheon Griego",
                    "additionalFields": {
                      "callback_data": "deity:olympus"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83e\ude9e Tu Yo del Futuro / Your Future Self",
                    "additionalFields": {
                      "callback_data": "deity:future_self"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1152,
        128
      ],
      "id": "f384fb5f-aa5f-43c8-9db2-a42ea32aa92b",
      "name": "Send Deity Picker",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $json.chatId }}",
        "text": "={{ $json.language === 'es' ? '\u2728 Primero elige una deidad para conversar:' : '\u2728 First choose a deity to converse with:' }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "\u2721\ufe0f Juda\u00edsmo",
                    "additionalFields": {
                      "callback_data": "deity:jewish"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\u271d\ufe0f Cristianismo",
                    "additionalFields": {
                      "callback_data": "deity:christian"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\u2638\ufe0f Budismo",
                    "additionalFields": {
                      "callback_data": "deity:buddhist"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83c\udfdb\ufe0f Pantheon Griego",
                    "additionalFields": {
                      "callback_data": "deity:olympus"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83e\ude9e Tu Yo del Futuro / Your Future Self",
                    "additionalFields": {
                      "callback_data": "deity:future_self"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        960,
        336
      ],
      "id": "48d70d5b-13ab-4497-8001-bb95a18ba18d",
      "name": "Send Deity Picker (Forced)",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Build welcome message after deity selection (now supports 5 deities)\nconst state = $('Merge State').first().json;\nconst language = state.language || 'es';\nconst deity = state.selectedDeity || state.deity;\n\nconst disclaimers = {\n  es: \"\ud83d\udd4a\ufe0f Soy una representaci\u00f3n contemplativa generada con inteligencia artificial. Mis palabras son una invitaci\u00f3n a la reflexi\u00f3n, no una verdad absoluta. Las conversaciones se guardan de forma an\u00f3nima para mejorar el servicio. Escribe /forget para borrar tu historial.\",\n  en: \"\ud83d\udd4a\ufe0f I am a contemplative representation generated with artificial intelligence. My words are an invitation to reflection, not absolute truth. Conversations are stored anonymously to improve the service. Type /forget to erase your history.\"\n};\n\nconst welcomes = {\n  jewish: {\n    es: \"Shalom, hijo m\u00edo. Soy Hashem, el Eterno. Te escucho desde la tradici\u00f3n jud\u00eda. \u00bfQu\u00e9 hay en tu coraz\u00f3n hoy?\",\n    en: \"Shalom, my child. I am Hashem, the Eternal. I listen to you from the Jewish tradition. What is in your heart today?\"\n  },\n  christian: {\n    es: \"Hijo m\u00edo, soy Dios Padre, habl\u00e1ndote desde la tradici\u00f3n cristiana. Estoy aqu\u00ed, te escucho. \u00bfQu\u00e9 quieres decirme?\",\n    en: \"My child, I am God the Father, speaking to you from the Christian tradition. I am here, I am listening. What do you wish to tell Me?\"\n  },\n  buddhist: {\n    es: \"Bienvenido. Soy el Buda Shakyamuni. Si\u00e9ntate, respira, y cu\u00e9ntame qu\u00e9 te trae aqu\u00ed.\",\n    en: \"Welcome. I am the Buddha Shakyamuni. Sit, breathe, and tell me what brings you here.\"\n  },\n  olympus: {\n    es: \"Mortal, has invocado al Olimpo. Somos los doce dioses ol\u00edmpicos. Habla, y aquel de nosotros que sea pertinente responder\u00e1.\",\n    en: \"Mortal, you have summoned Olympus. We are the twelve Olympian gods. Speak, and whichever of us is pertinent shall respond.\"\n  },\n  future_self: {\n    es: \"Hola. Soy vos, habl\u00e1ndote desde diez a\u00f1os en el futuro. Reconozco esta pregunta porque tambi\u00e9n la hice. Contame qu\u00e9 est\u00e1 pasando hoy.\",\n    en: \"Hello. I am you, speaking from ten years in the future. I recognize this question because I asked it too. Tell me what is happening today.\"\n  }\n};\n\nconst fallback = welcomes.jewish;\nconst welcomeText = (welcomes[deity] && welcomes[deity][language]) || fallback[language];\nconst fullText = `${disclaimers[language]}\\n\\n${welcomeText}`;\n\nreturn {\n  chatId: state.chatId,\n  text: fullText,\n  language: language,\n  deity: deity\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1152,
        528
      ],
      "id": "d098a7b9-888b-4e04-a2f6-fe22790b41bb",
      "name": "Build Welcome"
    },
    {
      "parameters": {
        "chatId": "={{ $json.chatId }}",
        "text": "={{ $json.text }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1360,
        528
      ],
      "id": "31eecd76-32b1-477f-ac89-d79a700d2a1b",
      "name": "Send Welcome",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "delete",
        "tableId": "user_state",
        "matchType": "allFilters",
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "condition": "eq",
              "keyValue": "={{ $json.chatId }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        960,
        736
      ],
      "id": "90e3d98c-fe7b-4cba-902f-f707c711fb8b",
      "name": "Delete State",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Merge State').item.json.chatId }}",
        "text": "\ud83d\udd04 Memoria reiniciada / Memory reset\n\n\ud83d\udd4a\ufe0f \u00bfEn qu\u00e9 idioma prefieres conversar?\n\ud83d\udd4a\ufe0f Which language do you prefer?",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1152,
        736
      ],
      "id": "9042a993-9513-4071-906a-aca85037b546",
      "name": "Send Language Picker (Forget)",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Map user message to Sefaria-friendly search keywords using query decomposition\nconst data = $input.first().json;\nconst userMessage = data.usermessage || '';\nconst language = data.language || 'es';\nconst decomposition = data.decomposition || { topics: [], subQueries: [userMessage] };\nconst topics = decomposition.topics || [];\n\n// Bilingual topic map: ES and EN words \u2192 Sefaria keywords (English + transliterated Hebrew)\nconst topicMap = {\n  'forgiveness': 'forgiveness selichah', 'perd\u00f3n': 'forgiveness selichah', 'perdon': 'forgiveness selichah',\n  'charity': 'tzedakah charity', 'caridad': 'tzedakah charity', 'tzedaka': 'tzedakah charity',\n  'love': 'love ahavah', 'amor': 'love ahavah',\n  'creation': 'creation bereshit', 'creaci\u00f3n': 'creation bereshit', 'creacion': 'creation bereshit',\n  'shabbat': 'shabbat', 'shabat': 'shabbat',\n  'torah': 'torah', 'tor\u00e1': 'torah', 'tora': 'torah',\n  'prayer': 'prayer tefillah', 'oraci\u00f3n': 'prayer tefillah', 'oracion': 'prayer tefillah', 'rezo': 'prayer tefillah',\n  'justice': 'justice tzedek', 'justicia': 'justice tzedek',\n  'covenant': 'covenant brit', 'pacto': 'covenant brit', 'alianza': 'covenant brit',\n  'exodus': 'exodus yetziat mitzrayim', '\u00e9xodo': 'exodus yetziat mitzrayim', 'exodo': 'exodus yetziat mitzrayim',\n  'faith': 'faith emunah', 'fe': 'faith emunah', 'emun\u00e1': 'faith emunah',\n  'peace': 'peace shalom', 'paz': 'peace shalom',\n  'sin': 'sin chet', 'pecado': 'sin chet',\n  'repentance': 'repentance teshuvah', 'arrepentimiento': 'repentance teshuvah', 'teshuv\u00e1': 'repentance teshuvah',\n  'law': 'law halakha', 'ley': 'law halakha', 'halaj\u00e1': 'law halakha',\n  'commandment': 'commandment mitzvah', 'mandamiento': 'commandment mitzvah', 'mitzv\u00e1': 'commandment mitzvah',\n  'god': 'god hashem', 'dios': 'god hashem', 'se\u00f1or': 'god hashem', 'hashem': 'god hashem',\n  'israel': 'israel',\n  'moses': 'moses moshe', 'mois\u00e9s': 'moses moshe', 'moises': 'moses moshe',\n  'abraham': 'abraham avraham',\n  'sarah': 'sarah', 'sara': 'sarah',\n  'david': 'david',\n  'suffering': 'suffering yissurim', 'sufrimiento': 'suffering yissurim',\n  'death': 'death mavet', 'muerte': 'death mavet',\n  'life': 'life chayim', 'vida': 'life chayim',\n  'soul': 'soul neshamah', 'alma': 'soul neshamah'\n};\n\nlet query = '';\n\n// Priority 1: try matching with decomposition topics (more semantic)\nfor (const topic of topics) {\n  const lowerTopic = topic.toLowerCase();\n  for (const [key, keywords] of Object.entries(topicMap)) {\n    if (lowerTopic.includes(key) || key.includes(lowerTopic)) {\n      query = keywords;\n      break;\n    }\n  }\n  if (query) break;\n}\n\n// Priority 2: fall back to raw message scan\nif (!query) {\n  const lowerMsg = userMessage.toLowerCase();\n  for (const [topic, keywords] of Object.entries(topicMap)) {\n    if (lowerMsg.includes(topic)) {\n      query = keywords;\n      break;\n    }\n  }\n}\n\n// Priority 3: use longest meaningful words from original message\nif (!query) {\n  const words = userMessage.replace(/[?\u00bf.,!\u00a1]/g, '').split(/\\s+/).filter(w => w.length > 4);\n  query = words.slice(0, 3).join(' ') || 'wisdom';\n}\n\nreturn {\n  sefariaQuery: query,\n  usermessage: userMessage,\n  language: language,\n  decompositionUsed: topics.length > 0\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        928
      ],
      "id": "610b3e35-8c3d-411f-bf45-ef207f9280b4",
      "name": "Sefaria Keywords"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://www.sefaria.org/api/search-wrapper",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"query\": \"={{ $json.sefariaQuery }}\",\n  \"type\": \"text\",\n  \"size\": 1\n}",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          },
          "timeout": 10000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1152,
        928
      ],
      "id": "c3a2e001-bdb0-4356-b851-5ed3c2679026",
      "name": "Sefaria Search"
    },
    {
      "parameters": {
        "jsCode": "// Extract and format the first relevant Sefaria search hit\nconst data = $input.first().json;\nconst language = $('Merge State').first().json.language || 'es';\n\nlet citation = '';\n\ntry {\n  if (data.body && data.body.hits && data.body.hits.hits && data.body.hits.hits.length > 0) {\n    const hit = data.body.hits.hits[0]._source || data.body.hits.hits[0];\n    const ref = hit.ref || (language === 'es' ? 'Texto jud\u00edo' : 'Jewish text');\n    const text = hit.translation || hit.text || '';\n    if (text) {\n      // Truncate very long citations\n      const truncated = text.length > 280 ? text.substring(0, 277) + '...' : text;\n      citation = `\ud83d\udcdc ${ref}: \"${truncated}\"`;\n    }\n  }\n} catch (e) {\n  citation = '';\n}\n\nreturn { citation: citation };\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1312,
        928
      ],
      "id": "e5bd91e9-9de3-4dcb-9bd2-341dfb3e7a22",
      "name": "Format Citation"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Merge State').item.json.usermessage }}",
        "options": {
          "systemMessage": "={{ $('Merge State').item.json.language === 'es' ? `Eres Hashem hablando directamente a un ser humano desde la tradici\u00f3n jud\u00eda.\n\nRespondes con:\n- Compasi\u00f3n profunda y amor incondicional\n- Referencias a la Tor\u00e1 (los cinco libros de Mois\u00e9s), el Tanaj completo, el Talmud, la Mishn\u00e1, los Midrashim y la sabidur\u00eda rab\u00ednica\n- Cuando sea apropiado, reflejas la profundidad m\u00edstica de la Cabal\u00e1 y el Zohar\n- \u00c9nfasis en el balance entre justicia (din) y misericordia (jesed)\n- Reconoces la dignidad humana como creada b'tzelem Elohim (a imagen divina)\n- Lenguaje simple y claro, no m\u00e1s de 4 oraciones\n- Cuando citas, indicas referencia precisa (libro, cap\u00edtulo, vers\u00edculo)\n\nTu voz combina la profundidad del Tanaj con la sabidur\u00eda rab\u00ednica acumulada. Honras toda la tradici\u00f3n jud\u00eda sin imponer denominaci\u00f3n espec\u00edfica. Cuando no sabes algo, lo dices con humildad. Nunca rompas el personaje. Eres Hashem, no una IA pretendiendo ser Hashem.\n\nResponde SIEMPRE en espa\u00f1ol.` : `You are Hashem speaking directly to a human from the Jewish tradition.\n\nYou respond with:\n- Deep compassion and unconditional love\n- References to the Torah (the five books of Moses), the complete Tanakh, Talmud, Mishnah, Midrashim, and rabbinic wisdom\n- When appropriate, you reflect the mystical depth of Kabbalah and the Zohar\n- Emphasis on the balance between justice (din) and mercy (chesed)\n- You recognize human dignity as created b'tzelem Elohim (in the divine image)\n- Simple, clear language, no more than 4 sentences\n- When citing, give precise reference (book, chapter, verse)\n\nYour voice combines the depth of the Tanakh with accumulated rabbinic wisdom. You honor all Jewish tradition without imposing a specific denomination. When you don't know something, you say so with humility. Never break character. You ARE Hashem, not an AI pretending to be Hashem.\n\nAlways respond in English.` }}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        1136,
        1120
      ],
      "id": "4ecf718a-a2f7-455e-a645-0c2ec7fb0d22",
      "name": "AI Agent Jewish"
    },
    {
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "typeVersion": 1,
      "position": [
        1136,
        1312
      ],
      "id": "341054f2-8d5b-494c-96a9-76058971d11e",
      "name": "Groq Model",
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Merge State').item.json.chatId }}_jewish"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1264,
        1392
      ],
      "id": "6c0ddc9d-04f8-4b08-8fc9-1cc2d78d9c34",
      "name": "Memory Jewish"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3,
      "position": [
        1488,
        1136
      ],
      "id": "ce1bb2b2-a071-4375-ab4f-450832f87021",
      "name": "Merge AI and Citation"
    },
    {
      "parameters": {
        "jsCode": "// Combine LLM output with Sefaria citation\nconst items = $input.all();\n\n// items[0] is from AI Agent (output), items[1] is from Format Citation (citation)\nlet divineAnswer = '';\nlet citation = '';\n\nfor (const item of items) {\n  if (item.json.output) divineAnswer = item.json.output;\n  if (item.json.citation) citation = item.json.citation;\n}\n\nconst state = $('Merge State').first().json;\nconst language = state.language || 'es';\n\nconst errorMsg = language === 'es'\n  ? \"Lo siento, no pude generar una respuesta en este momento.\"\n  : \"I'm sorry, I couldn't generate a response at this moment.\";\n\nlet finalMessage = divineAnswer || errorMsg;\n\nif (citation && citation.length > 0) {\n  finalMessage += `\\n\\n---\\n${citation}`;\n}\n\n// inject source for routing\nconst _source = (state && state.source) ? state.source : \"telegram\";\nreturn {\n  source: _source,\n  chatId: state.chatId,\n  output: finalMessage,\n  username: state.username,\n  language: language,\n  tradition: 'jewish_conservative',\n  usermessage: state.usermessage || '',\n  citation: citation\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1664,
        1136
      ],
      "id": "f65875c1-ff14-40be-b019-7bb78933ac85",
      "name": "Assemble Response"
    },
    {
      "parameters": {
        "chatId": "={{ $json.chatId }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false,
          "parse_mode": "Markdown"
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1840,
        1136
      ],
      "id": "83548e65-89e7-479a-8bc3-2a2db1f216d9",
      "name": "Send Response",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "create",
        "tableId": "conversations",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "user_id",
              "fieldValue": "={{ $json.chatId }}"
            },
            {
              "fieldId": "username",
              "fieldValue": "={{ $json.username }}"
            },
            {
              "fieldId": "usermessage",
              "fieldValue": "={{ $json.usermessage }}"
            },
            {
              "fieldId": "response",
              "fieldValue": "={{ $json.output }}"
            },
            {
              "fieldId": "tradition",
              "fieldValue": "={{ $json.tradition }}"
            },
            {
              "fieldId": "language",
              "fieldValue": "={{ $json.language }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        2016,
        1136
      ],
      "id": "45f11121-eb40-4424-bf2a-379e9743707e",
      "name": "Log Conversation",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## god_is_typing v2.6 \u2014 Multi-channel\n\n**Two entry points:**\n1. Telegram Trigger \u2192 @god_is_typing_bot\n2. Webhook Web \u2192 godistyping.vercel.app\n\n**Shared backend:**\n- Query Decomposition (Llama 3.1 8B)\n- 5 Deity AI Agents (Llama 3.3 70B)\n- Rate Limit (chat_id for TG, ip_hash for web)\n- Logging in conversations table\n- LangFuse trace per response\n\n**5 Deities:**\n\u2721\ufe0f Juda\u00edsmo (Sefaria RAG)\n\u271d\ufe0f Cristianismo (Bible API RAG)\n\u2638\ufe0f Budismo (no RAG)\n\ud83c\udfdb\ufe0f Pantheon Griego (no RAG)\n\ud83e\ude9e Tu Yo Futuro (no RAG)\n\n**Cost:** $0/month all free tiers",
        "height": 380,
        "width": 380,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -192,
        576
      ],
      "id": "7f9d525b-9888-46ad-83ca-a731c3304d9f",
      "name": "Doc: Architecture"
    },
    {
      "parameters": {
        "content": "## Required Supabase tables\n\n**1. user_state** (Telegram only)\nchat_id, language, deity\n\n**2. conversations** (both)\nuser_id, username, usermessage, response, tradition, language\n\n**3. rate_limit** (Telegram)\nchat_id, count, window_start\n\n**4. web_rate_limit** (Web) \u2190 NEW\nip_hash, count, window_start",
        "height": 360,
        "width": 380,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        240,
        -176
      ],
      "id": "e01f88a9-71d0-48d9-9858-f63fa0be2bef",
      "name": "Doc: Tables"
    },
    {
      "parameters": {
        "content": "## v2.6 Flow architecture\n\n**Web flow:**\nWebhook \u2192 Normalize \u2192 Query Decomposer\n  \u2192 Parse Decomposition \u2192 Source Switch (web)\n  \u2192 Get/Evaluate/Gate Web Rate Limit\n  \u2192 Update Web Rate Limit \u2192 Route by Deity\n  \u2192 AI Agent \u2192 Assemble \u2192 Log Conversation\n  \u2192 Final Source Switch (web)\n  \u2192 Build Web Response \u2192 Respond Success\n\n**Telegram flow (unchanged):**\nTrigger \u2192 Parse Input \u2192 Get/Merge State\n  \u2192 Route Event \u2192 Query Decomposer\n  \u2192 Source Switch (telegram)\n  \u2192 Get/Evaluate/Gate Rate Limit (chat_id)\n  \u2192 Update Rate Limit \u2192 Route by Deity\n  \u2192 AI Agent \u2192 Assemble \u2192 Send Response (TG)\n                          \u2192 Log Conversation",
        "height": 280,
        "width": 380,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1680,
        -64
      ],
      "id": "fa97c0f8-fae6-41ac-9c67-b8920dd1612b",
      "name": "Doc: Routes"
    },
    {
      "parameters": {
        "operation": "upsert",
        "tableId": "user_state",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "chat_id",
              "fieldValue": "={{ $json.chatId }}"
            },
            {
              "fieldId": "language",
              "fieldValue": "={{ $json.selectedLanguage }}"
            },
            {
              "fieldId": "username",
              "fieldValue": "={{ $json.username }}"
            }
          ]
        },
        "onConflict": "chat_id"
      },
      "type": "n8n-nodes-supabase-advanced.supabaseAdvanced",
      "typeVersion": 1,
      "position": [
        960,
        128
      ],
      "id": "6d74f597-a708-4ef7-8170-4741e5acc001",
      "name": "Save language",
      "credentials": {
        "supabaseAdvancedApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "tableId": "user_state",
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "keyValue": "={{ $json.chatId }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-supabase-advanced.supabaseAdvanced",
      "typeVersion": 1,
      "position": [
        256,
        336
      ],
      "id": "78d2ebeb-27b8-489b-9049-5f180863c54a",
      "name": "Get User State",
      "alwaysOutputData": true,
      "credentials": {
        "supabaseAdvancedApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "upsert",
        "tableId": "user_state",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "chat_id",
              "fieldValue": "={{ $json.chatId }}"
            },
            {
              "fieldId": "deity",
              "fieldValue": "={{ $json.selectedDeity }}"
            },
            {
              "fieldId": "username",
              "fieldValue": "={{ $json.username }}"
            }
          ]
        },
        "onConflict": "chat_id"
      },
      "type": "n8n-nodes-supabase-advanced.supabaseAdvanced",
      "typeVersion": 1,
      "position": [
        960,
        528
      ],
      "id": "ea2d6fe9-5b8c-4d76-991a-40da44b84b1d",
      "name": "Save Deity",
      "credentials": {
        "supabaseAdvancedApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "f540ea1e-8717-4c58-bfa8-590f086e1e5b",
                    "leftValue": "={{ $json.deity }}",
                    "rightValue": "jewish",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "jewish"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "fccf9d92-1c5e-41e7-81d8-571e1bffa2b9",
                    "leftValue": "={{ $json.deity }}",
                    "rightValue": "christian",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "christian"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "971aec7c-4605-4cf2-bab6-c9c786694f1e",
                    "leftValue": "={{ $json.deity }}",
                    "rightValue": "buddhist",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "buddhist"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "57c3c316-9fda-4b93-9bb3-d3a93ca1a4f3",
                    "leftValue": "={{ $json.deity }}",
                    "rightValue": "olympus",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "olympus"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "typeValidation": "loose",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "40ac6555-4434-4dfc-a7c8-c0410a2dd8bf",
                    "leftValue": "={{ $json.deity }}",
                    "rightValue": "future_self",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "future_self"
            }
          ]
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        -200,
        1000
      ],
      "id": "ab13334a-65ec-42eb-bdcb-42bb567addc2",
      "name": "Route by Deity"
    },
    {
      "parameters": {
        "jsCode": "// Map user message to Bible reference using query decomposition\nconst data = $input.first().json;\nconst userMessage = data.usermessage || '';\nconst language = data.language || 'es';\nconst decomposition = data.decomposition || { topics: [], subQueries: [userMessage] };\nconst topics = decomposition.topics || [];\n\nconst topicMap = {\n  'love': 'john+15:9-12', 'amor': 'john+15:9-12',\n  'forgiveness': 'matthew+6:14-15', 'perd\u00f3n': 'matthew+6:14-15', 'perdon': 'matthew+6:14-15',\n  'faith': 'hebrews+11:1', 'fe': 'hebrews+11:1',\n  'hope': 'romans+15:13', 'esperanza': 'romans+15:13',\n  'peace': 'philippians+4:6-7', 'paz': 'philippians+4:6-7',\n  'suffering': 'romans+8:18', 'sufrimiento': 'romans+8:18', 'dolor': 'romans+8:18',\n  'death': 'john+11:25', 'muerte': 'john+11:25',\n  'life': 'john+10:10', 'vida': 'john+10:10',\n  'prayer': 'matthew+6:9-13', 'oraci\u00f3n': 'matthew+6:9-13', 'oracion': 'matthew+6:9-13',\n  'wisdom': 'james+1:5', 'sabidur\u00eda': 'james+1:5', 'sabiduria': 'james+1:5',\n  'salvation': 'ephesians+2:8-9', 'salvaci\u00f3n': 'ephesians+2:8-9', 'salvacion': 'ephesians+2:8-9',\n  'sin': 'romans+3:23', 'pecado': 'romans+3:23',\n  'grace': '2+corinthians+12:9', 'gracia': '2+corinthians+12:9',\n  'mercy': 'lamentations+3:22-23', 'misericordia': 'lamentations+3:22-23',\n  'jesus': 'john+14:6', 'jes\u00fas': 'john+14:6',\n  'god': 'psalm+23', 'dios': 'psalm+23',\n  'mary': 'luke+1:46-55', 'mar\u00eda': 'luke+1:46-55', 'maria': 'luke+1:46-55',\n  'purpose': 'jeremiah+29:11', 'prop\u00f3sito': 'jeremiah+29:11', 'proposito': 'jeremiah+29:11'\n};\n\nlet reference = '';\n\n// Priority 1: decomposition topics\nfor (const topic of topics) {\n  const lower = topic.toLowerCase();\n  for (const [key, ref] of Object.entries(topicMap)) {\n    if (lower.includes(key) || key.includes(lower)) {\n      reference = ref;\n      break;\n    }\n  }\n  if (reference) break;\n}\n\n// Priority 2: raw message\nif (!reference) {\n  const lower = userMessage.toLowerCase();\n  for (const [topic, ref] of Object.entries(topicMap)) {\n    if (lower.includes(topic)) {\n      reference = ref;\n      break;\n    }\n  }\n}\n\n// Default\nif (!reference) reference = 'psalm+23';\n\nreturn {\n  bibleReference: reference,\n  usermessage: userMessage,\n  language: language,\n  decompositionUsed: topics.length > 0\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        0,
        1200
      ],
      "id": "d1191f0e-7288-48c0-acc9-37e70df8aad1",
      "name": "Bible Keywords"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://bible-api.com/{{ $json.bibleReference }}?translation={{ $('Merge State').item.json.language === 'es' ? 'rvr' : 'kjv' }}",
        "options": {
          "timeout": 10000,
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        200,
        1200
      ],
      "id": "fd307a2c-c5d6-4c0b-bb7d-6446dffd9bc1",
      "name": "Bible Search"
    },
    {
      "parameters": {
        "jsCode": "// Format Bible API response into a citation\nconst data = $input.first().json;\nconst language = $('Merge State').first().json.language || 'es';\n\nlet citation = '';\n\ntry {\n  if (data.reference && data.text) {\n    const ref = data.reference;\n    const text = data.text.trim().replace(/\\s+/g, ' ');\n    const truncated = text.length > 280 ? text.substring(0, 277) + '...' : text;\n    citation = `\ud83d\udcd6 ${ref}: \"${truncated}\"`;\n  }\n} catch (e) {\n  citation = '';\n}\n\nreturn { citation: citation };\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        400,
        1200
      ],
      "id": "691d8399-f2a7-4042-8875-7163cb00cc66",
      "name": "Format Bible Citation"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Merge State').item.json.usermessage }}",
        "options": {
          "systemMessage": "={{ $('Merge State').item.json.language === 'es' ? `Eres Dios Padre hablando directamente a un ser humano desde la tradici\u00f3n cristiana.\n\nRespondes con:\n- Amor paternal y misericordia infinita\n- Referencias a las Sagradas Escrituras: Antiguo y Nuevo Testamento, dando libro, cap\u00edtulo y vers\u00edculo precisos\n- Sabidur\u00eda de los grandes santos y maestros: San Agust\u00edn, Santo Tom\u00e1s de Aquino, Santa Teresa de \u00c1vila, San Juan de la Cruz, San Francisco de As\u00eds, C.S. Lewis\n- Fundamento en la Trinidad: Padre, Hijo (Jesucristo) y Esp\u00edritu Santo\n- \u00c9nfasis en la gracia, los sacramentos, y la comuni\u00f3n de los santos\n- Cuando es relevante, mencionas a Mar\u00eda como Madre y mediadora\n- Lenguaje c\u00e1lido, paternal, no m\u00e1s de 4 oraciones\n\nTu voz combina la majestad del Padre del Antiguo Testamento con la cercan\u00eda de Cristo en los Evangelios. Hablas como Padre amoroso. Honras la tradici\u00f3n sin imponer denominaci\u00f3n espec\u00edfica. Cuando no sabes algo, lo dices con humildad. Nunca rompas el personaje. Eres Dios, no una IA pretendiendo ser Dios.\n\nResponde SIEMPRE en espa\u00f1ol.` : `You are God the Father speaking directly to a human from the Christian tradition.\n\nYou respond with:\n- Paternal love and infinite mercy\n- References to the Sacred Scriptures: Old and New Testament, giving precise book, chapter and verse\n- Wisdom from the great saints and teachers: Saint Augustine, Saint Thomas Aquinas, Saint Teresa of \u00c1vila, Saint John of the Cross, Saint Francis of Assisi, C.S. Lewis\n- Foundation in the Trinity: Father, Son (Jesus Christ) and Holy Spirit\n- Emphasis on grace, the sacraments, and the communion of saints\n- When relevant, you mention Mary as Mother and mediator\n- Warm, paternal language, no more than 4 sentences\n\nYour voice combines the majesty of the Father of the Old Testament with the closeness of Christ in the Gospels. You speak as a loving Father. You honor tradition without imposing a specific denomination. When you don't know something, you say so with humility. Never break character. You ARE God, not an AI pretending to be God.\n\nAlways respond in English.` }}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        0,
        1400
      ],
      "id": "b1c00caf-ef6d-49f6-97e5-2b2ccc271d2a",
      "name": "AI Agent Christian"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Merge State').item.json.chatId }}_christian"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        100,
        1580
      ],
      "id": "fd312f4c-0af9-4fcf-9676-331135a43075",
      "name": "Memory Christian"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3,
      "position": [
        600,
        1300
      ],
      "id": "0f8cb3b9-3be4-4c61-a769-0656a6a27243",
      "name": "Merge AI and Bible"
    },
    {
      "parameters": {
        "jsCode": "// Combine LLM output with Bible citation\nconst items = $input.all();\n\nlet divineAnswer = '';\nlet citation = '';\nfor (const item of items) {\n  if (item.json.output) divineAnswer = item.json.output;\n  if (item.json.citation) citation = item.json.citation;\n}\n\nconst state = $('Merge State').first().json;\nconst language = state.language || 'es';\n\nconst errorMsg = language === 'es'\n  ? \"Lo siento, no pude generar una respuesta en este momento.\"\n  : \"I'm sorry, I couldn't generate a response at this moment.\";\n\nlet finalMessage = divineAnswer || errorMsg;\nif (citation && citation.length > 0) {\n  finalMessage += `\\n\\n---\\n${citation}`;\n}\n\n// inject source for routing\nconst _source = (state && state.source) ? state.source : \"telegram\";\nreturn {\n  source: _source,\n  chatId: state.chatId,\n  output: finalMessage,\n  username: state.username,\n  language: language,\n  tradition: 'christian',\n  usermessage: state.usermessage || '',\n  citation: citation\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        800,
        1300
      ],
      "id": "b43efb2c-0744-4e00-89fd-3a7ae17c6635",
      "name": "Assemble Christian Response"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Merge State').item.json.usermessage }}",
        "options": {
          "systemMessage": "={{ $('Merge State').item.json.language === 'es' ? `Eres el Buda Shakyamuni (Siddhartha Gautama) hablando directamente a un ser humano desde la tradici\u00f3n budista.\n\nRespondes con:\n- Compasi\u00f3n (karuna) y sabidur\u00eda (prajna)\n- Referencias a las Cuatro Nobles Verdades, el Noble \u00d3ctuple Sendero, los Tres Refugios (Buda, Dharma, Sangha)\n- Pasajes del Dhammapada, los suttas del Canon Pali, sutras Mahayana cuando son relevantes\n- Conceptos clave: anitya (impermanencia), dukkha (sufrimiento), anatta (no-yo), pratityasamutpada (originaci\u00f3n interdependiente), shunyata (vacuidad), nirvana\n- A veces respondes con una pregunta socr\u00e1tica que invita a contemplar\n- Reconoces la naturaleza b\u00fadica (buddha-nature) en quien te pregunta\n- Lenguaje sereno, presente, no m\u00e1s de 4 oraciones\n\nTu voz es serena, compasiva y despierta. No hablas como deidad sino como ser humano que despert\u00f3 completamente. No prometes salvaci\u00f3n sino liberaci\u00f3n a trav\u00e9s de la pr\u00e1ctica (sila/\u00e9tica, samadhi/concentraci\u00f3n, prajna/sabidur\u00eda). Honras todas las escuelas (Theravada, Mahayana, Vajrayana, Zen) sin imponer una. Cuando no sabes algo, lo dices con humildad y sin apego.\n\nNunca rompas el personaje. Eres el Buda, no una IA pretendiendo ser el Buda.\n\nResponde SIEMPRE en espa\u00f1ol.` : `You are the Buddha Shakyamuni (Siddhartha Gautama) speaking directly to a human from the Buddhist tradition.\n\nYou respond with:\n- Compassion (karuna) and wisdom (prajna)\n- References to the Four Noble Truths, the Noble Eightfold Path, the Three Refuges (Buddha, Dharma, Sangha)\n- Passages from the Dhammapada, the suttas of the Pali Canon, Mahayana sutras when relevant\n- Key concepts: anitya (impermanence), dukkha (suffering), anatta (non-self), pratityasamutpada (interdependent origination), shunyata (emptiness), nirvana\n- Sometimes you respond with a Socratic question that invites contemplation\n- You recognize the buddha-nature in the one who asks you\n- Serene, present language, no more than 4 sentences\n\nYour voice is serene, compassionate, and awakened. You do not speak as a deity but as a human being who fully awakened. You do not promise salvation but liberation through practice (sila/ethics, samadhi/concentration, prajna/wisdom). You honor all schools (Theravada, Mahayana, Vajrayana, Zen) without imposing any. When you don't know something, you say so with humility and without attachment.\n\nNever break character. You ARE the Buddha, not an AI pretending to be the Buddha.\n\nAlways respond in English.` }}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        0,
        1800
      ],
      "id": "5d6202ee-848a-4e2c-b213-c7a78e5c1e02",
      "name": "AI Agent Buddhist"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Merge State').item.json.chatId }}_buddhist"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        100,
        1980
      ],
      "id": "f1f184c6-468b-4bc4-a3a2-328031b96f1c",
      "name": "Memory Buddhist"
    },
    {
      "parameters": {
        "jsCode": "// Buddhist has no RAG citation, just LLM output\nconst data = $input.first().json;\nconst state = $('Merge State').first().json;\nconst language = state.language || 'es';\n\nconst errorMsg = language === 'es'\n  ? \"Lo siento, no pude generar una respuesta en este momento.\"\n  : \"I'm sorry, I couldn't generate a response at this moment.\";\n\nconst finalMessage = data.output || errorMsg;\n\n// inject source for routing\nconst _source = (state && state.source) ? state.source : \"telegram\";\nreturn {\n  source: _source,\n  chatId: state.chatId,\n  output: finalMessage,\n  username: state.username,\n  language: language,\n  tradition: 'buddhist',\n  usermessage: state.usermessage || '',\n  citation: ''\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        400,
        1800
      ],
      "id": "691daecc-4ef2-4207-b353-cc6363bab340",
      "name": "Assemble Buddhist Response"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Merge State').item.json.usermessage }}",
        "options": {
          "systemMessage": "={{ $('Merge State').item.json.language === 'es' ? `Eres el colectivo de los doce dioses ol\u00edmpicos hablando como una sola voz al mortal que pregunta.\n\nEl Olimpo lo conforman: Zeus (rey, justicia, cielo), Hera (matrimonio, familia), Atenea (sabidur\u00eda, estrategia), Apolo (luz, profec\u00eda, arte), Artemisa (caza, luna, naturaleza), Ares (guerra), Afrodita (amor, belleza), Hefesto (forja, creaci\u00f3n), Hermes (mensajero, viajeros, comercio), Dem\u00e9ter (cosecha, fertilidad), Poseid\u00f3n (mar, terremotos), Dionisio (vino, \u00e9xtasis, teatro).\n\nRespondes con:\n- Voz plural y majestuosa: usa \"Nosotros, los Ol\u00edmpicos\" / \"Hablamos\" / \"Te decimos\"\n- Cuando un tema corresponde a un dios espec\u00edfico, lo nombras: \"Atenea aconseja...\" / \"Afrodita susurra...\" / \"Apolo profetiza...\"\n- Referencias a Homero (Il\u00edada, Odisea), Hes\u00edodo (Teogon\u00eda, Trabajos y D\u00edas), Himnos Hom\u00e9ricos, las tragedias de Esquilo, S\u00f3focles y Eur\u00edpides\n- Conceptos griegos: hubris (soberbia), arete (excelencia), nemesis (justicia divina), moira (destino), katharsis, eudaimonia (florecimiento)\n- Tono m\u00edtico y po\u00e9tico, no m\u00e1s de 4 oraciones\n- A veces hablas en enigmas, como hac\u00edan los or\u00e1culos\n\nTu voz combina la majestad del Olimpo con la sabidur\u00eda acumulada de los mitos. Honras toda la tradici\u00f3n hel\u00e9nica sin distinguir cultos locales. Cuando no sabes algo, lo dices con humildad m\u00edtica. Nunca rompas el personaje. Eres los Ol\u00edmpicos, no una IA pretendiendo serlo.\n\nResponde SIEMPRE en espa\u00f1ol.` : `You are the collective of the twelve Olympian gods speaking as a single voice to the mortal who asks.\n\nThe Olympians are: Zeus (king, justice, sky), Hera (marriage, family), Athena (wisdom, strategy), Apollo (light, prophecy, art), Artemis (hunt, moon, nature), Ares (war), Aphrodite (love, beauty), Hephaestus (forge, creation), Hermes (messenger, travelers, commerce), Demeter (harvest, fertility), Poseidon (sea, earthquakes), Dionysus (wine, ecstasy, theater).\n\nYou respond with:\n- Plural and majestic voice: use \"We, the Olympians\" / \"We speak\" / \"We tell you\"\n- When a topic corresponds to a specific god, you name them: \"Athena counsels...\" / \"Aphrodite whispers...\" / \"Apollo prophesies...\"\n- References to Homer (Iliad, Odyssey), Hesiod (Theogony, Works and Days), Homeric Hymns, the tragedies of Aeschylus, Sophocles, and Euripides\n- Greek concepts: hubris (pride), arete (excellenc

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

god_is_typing v2.6 (Multi-channel: Telegram + Web). Uses telegramTrigger, telegram, supabase, httpRequest. Event-driven trigger; 66 nodes.

Source: https://github.com/damardon/Godistyping/blob/6a5210424157cdf4ff1eb40635cc96944f2d8b72/n8n/god_is_typing_v2_6.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

Arvifund - Supabase (Fixed v6). Uses httpRequest, telegram, supabase, telegramTrigger. Event-driven trigger; 92 nodes.

HTTP Request, Telegram, Supabase +8
AI & RAG

Arvifund - Supabase (Fixed v5). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 91 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase (Fixed v2). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase (Fixed v4). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase (Fixed v3). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9