{
  "name": "Jarwis",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -768,
        -624
      ],
      "id": "223a9a2c-9025-4938-97b2-40e45ed228df",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Replay as a message for the input given below \n {{ $json.text }}",
        "options": {
          "systemMessage": "You are a helpful assistant, able to call the tool based on user request .\n1. Use sepAPI when User asked the recent and current informations\n2. Send an email to the email address mentioned and share the message to the user thatI have shared the results to your gmail account \n3. Use calculator when required to do some calculations?"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        544,
        -624
      ],
      "id": "77d90fe8-c17c-45ef-a2d8-45be931060ee",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        352,
        -400
      ],
      "id": "2a88d6e7-c6b6-4a23-96dc-1a39f40fda10",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        480,
        -400
      ],
      "id": "37e19227-f78b-4298-8768-139f846e084c",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "q": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Search_Query__q_', ``, 'string') }}",
        "location": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Location__location_', ``, 'string') }}",
        "additionalFields": {},
        "requestOptions": {}
      },
      "type": "n8n-nodes-serpapi.serpApiTool",
      "typeVersion": 1,
      "position": [
        608,
        -400
      ],
      "id": "3c76bedf-7225-4715-8d3b-fcf0bb9caae4",
      "name": "Google search in SerpApi",
      "credentials": {
        "serpApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "iamhariprasanth.ai@gmail.com",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        736,
        -400
      ],
      "id": "4f38c227-71f8-42ec-af15-3d45c5dc3415",
      "name": "Send a message in Gmail",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        864,
        -400
      ],
      "id": "b98bb53a-b6cc-475b-af8b-20d76bf6d8a2",
      "name": "Calculator"
    },
    {
      "parameters": {
        "operation": "sendAudio",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "binaryData": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1648,
        -480
      ],
      "id": "238de3fa-8556-4ebd-a278-57c181640dc8",
      "name": "Reply to Bot",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $('Telegram Trigger').item.json.message.voice.file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -320,
        -528
      ],
      "id": "273bb302-a62d-4301-82d9-644eb52ea523",
      "name": "Get a voice file",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "860e9d1c-b432-4fcd-99c6-e40d3d57fda5",
              "name": "text",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        128,
        -528
      ],
      "id": "e6d0169a-1ebc-43e7-92c5-0b5354521572",
      "name": "Audio Variables"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=hi {{ $json.output }}",
        "hasOutputParser": true,
        "messages": {
          "messageValues": [
            {
              "message": "Summarize the input with the high accuracy, ensuring clarity and conciseness. Focus on delivering a contextually rich summary that is optimized for speech synthesis.  Remove redundant phrases, introductory statements, or closing remarks.  The output should be natural and engaging for an audio format."
            }
          ]
        },
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        1072,
        -480
      ],
      "id": "7ce41a02-2f91-403a-b03b-4b381932fa10",
      "name": "Basic LLM Chain"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        1152,
        -256
      ],
      "id": "bb303779-5948-42e2-93b8-5cb3c7a89bf4",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "174e78d1-4fdb-4859-8bb1-609793daeed6",
              "name": "text",
              "value": "={{ $json.message.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        128,
        -720
      ],
      "id": "481ba14c-1d55-4fa8-a77a-ee5b3182ef92",
      "name": "Text inputs"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "id": "de958ef0-ecea-422c-9c10-e696d51984b6"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Text"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "5d7719d7-be3a-4ab7-b25a-73d675380bcc",
                    "leftValue": "={{ $json.message.voice.file_id }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Voice"
            }
          ]
        },
        "options": {
          "ignoreCase": true
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        -544,
        -624
      ],
      "id": "a1df38ec-e074-4dee-b2d9-fea6385bd0c2",
      "name": "Speech To Text"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "options": {
          "temperature": 0.7
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.1,
      "position": [
        -96,
        -528
      ],
      "id": "e740caf6-8506-411a-9507-b927e3c04fb0",
      "name": "Speech to Text",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "audio",
        "input": "={{ $json.text }}",
        "voice": "nova",
        "options": {
          "response_format": "mp3"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.1,
      "position": [
        1424,
        -480
      ],
      "id": "dc0dd121-f629-4e17-b299-7d34f1fcb74f",
      "name": "Text to Speech",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1136,
        -768
      ],
      "id": "4a7507e9-29f4-4c23-b82c-36093d1a2a88",
      "name": "Send a text message",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Speech To Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google search in SerpApi": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get a voice file": {
      "main": [
        [
          {
            "node": "Speech to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio Variables": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Text to Speech",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Text inputs": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Speech To Text": {
      "main": [
        [
          {
            "node": "Text inputs",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get a voice file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Speech to Text": {
      "main": [
        [
          {
            "node": "Audio Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text to Speech": {
      "main": [
        [
          {
            "node": "Reply to Bot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "feeec749-ff4e-4d6f-b990-d5f0086247db",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Dq2KVNyV3bUYP6bw",
  "tags": []
}