{
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true,
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "3d3df04d-ac14-4c7a-8a37-167354c52db7",
      "name": "Listen for incoming events",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        0,
        104
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4db91bca-8c95-4d4f-9421-1adb59461070",
      "name": "AllowList",
      "type": "n8n-nodes-base.set",
      "position": [
        224,
        104
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "allow_1",
              "name": "allow",
              "type": "string",
              "value": "<chat id>"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e9cb7778-64d1-4cf4-8ac6-21e6b05daaa4",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        104
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "auth_check",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $('Listen for incoming events').first().json.message.from.id }}",
              "rightValue": "={{ $json.allow }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.3
    },
    {
      "id": "dc255706-c9be-4cd8-84be-e971f80e3625",
      "name": "Voice or Text",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        104
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "text",
              "stringValue": "={{ $('Listen for incoming events').item.json.message.text || '' }}"
            },
            {
              "name": "sessionId",
              "stringValue": "={{ $('Listen for incoming events').item.json.message.from.id }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "3bc75578-1738-4310-9352-89e6d237820d",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        896,
        104
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "voice_check",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $('Listen for incoming events').item.json.message.text }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d6b03679-291e-4e02-a579-e1a2ee190a74",
      "name": "Get Voice File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        32
      ],
      "parameters": {
        "fileId": "={{ $('Listen for incoming events').item.json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "658195e4-ec39-482c-aa5b-d09ea5eb8c95",
      "name": "Speech to Text",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1344,
        32
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "45628ca6-6b86-4417-9c71-b409aba94692",
      "name": "Angie, AI Assistant",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1816,
        104
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are a helpful assistant.\n\nToday's date is {{ $now }}.\n\nGuidelines:\n- When fetching emails, filter out any promotional emails.\n- When summarizing emails, include Sender, Message date, subject, and brief summary of email.\n- if the user did not specify a date in the request assume they are asking for today\n- Use baserow tool to answer questions about tasks\n- When answering questions about calendar events, filter out events that don't apply to the question. For example, the question is about events for today, only reply with events for today. Don't mention future events if it's more than 1 week away"
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "099f8291-a116-4ef6-953a-c97c8fb35a6e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1568,
        328
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0aa6ea93-ab54-4a54-b042-c422391f9ca2",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1696,
        328
      ],
      "parameters": {
        "sessionKey": "angie_session_default",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "1e44e9bd-dea2-4bea-b64b-063b0f004714",
      "name": "Tasks",
      "type": "n8n-nodes-base.baserowTool",
      "position": [
        1824,
        328
      ],
      "parameters": {
        "tableId": 372174,
        "databaseId": 146496,
        "additionalOptions": {}
      },
      "credentials": {
        "baserowApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a7544475-2864-4a7f-974e-e3c56041aff5",
      "name": "Contacts",
      "type": "n8n-nodes-base.baserowTool",
      "position": [
        1952,
        328
      ],
      "parameters": {
        "tableId": 372177,
        "databaseId": 146496,
        "descriptionType": "manual",
        "toolDescription": "Useful for getting contact information. For example emails or phone numbers.",
        "additionalOptions": {}
      },
      "credentials": {
        "baserowApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cb343057-a3b1-4cf1-9e72-bd42172939dd",
      "name": "Google Calendar",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        2080,
        328
      ],
      "parameters": {
        "options": {
          "fields": "=items(summary, start(dateTime))",
          "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('date', 'the date after which to fetch the messages in format YYYY-MM-DDTHH:MM:SS') }}"
        },
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com"
        },
        "operation": "getAll"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "aa639e15-3676-4288-bde5-1e5d4d433089",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2416,
        104
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Listen for incoming events').first().json.message.from.id }}",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "a727969f-e3e0-4df2-952a-12f0aacb8b39",
      "name": "Get many messages in Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        2208,
        328
      ],
      "parameters": {
        "filters": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Voice File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Angie, AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Voice or Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tasks": {
      "ai_tool": [
        [
          {
            "node": "Angie, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Contacts": {
      "ai_tool": [
        [
          {
            "node": "Angie, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AllowList": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Angie, AI Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Voice File": {
      "main": [
        [
          {
            "node": "Speech to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Speech to Text": {
      "main": [
        [
          {
            "node": "Angie, AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "Angie, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Angie, AI Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Angie, AI Assistant": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages in Gmail": {
      "ai_tool": [
        [
          {
            "node": "Angie, AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Listen for incoming events": {
      "main": [
        [
          {
            "node": "AllowList",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}