{
  "nodes": [
    {
      "id": "8d91665e-aaff-4142-bcb9-3d379a87618d",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        760,
        240
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dde5b325-66a3-414e-996b-09135814d7dd",
      "name": "Create Employee AI Agent tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        420,
        840
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "uOrbNX2DcYJ0iAyv",
          "cachedResultName": "employee database management"
        },
        "description": "Create Employee AI Agent tool\nCall this tool if user requested to create new employee",
        "workflowInputs": {
          "value": {
            "query": "={{ $json.message.text }}",
            "action": "=create"
          },
          "schema": [
            {
              "id": "query",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "query",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "action",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "action",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "query"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b7165659-3e7a-4bde-91ad-2143224477d5",
      "name": "Get departments data from airtable tool",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        900,
        840
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblB0xec7TL36pDgC",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblB0xec7TL36pDgC",
          "cachedResultName": "Departments"
        },
        "options": {
          "fields": [
            "Department Name",
            "Department Description"
          ]
        },
        "operation": "search",
        "descriptionType": "manual",
        "filterByFormula": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_By_Formula', ``, 'string') }}",
        "toolDescription": "Get departments data from airtable tool"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c19de0c1-cf62-4515-93fd-3313b81d9626",
      "name": "Get job titles data from airtable tool",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        1060,
        840
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblnyWkG6BTpxjMzo",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblnyWkG6BTpxjMzo",
          "cachedResultName": "Job Titles"
        },
        "options": {
          "fields": [
            "Job Title",
            "Job Description"
          ]
        },
        "operation": "search",
        "descriptionType": "manual",
        "filterByFormula": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_By_Formula', ``, 'string') }}",
        "toolDescription": "Get job titles data from airtable tool"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "bc37498b-5b89-4140-9a26-ec1f55fa298d",
      "name": "Get employees data from airtable tool",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        1220,
        840
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblGIVbpACRwWzzlp",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblGIVbpACRwWzzlp",
          "cachedResultName": "Employees"
        },
        "options": {
          "fields": [
            "Full Name",
            "Email",
            "Phone Number",
            "Job Title (from Job Titles)",
            "Reports To (from Employees)",
            "Department Name (from Department)",
            "Employee Status"
          ]
        },
        "operation": "search",
        "descriptionType": "manual",
        "filterByFormula": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_By_Formula', ``, 'string') }}",
        "toolDescription": "Get employees data from airtable tool"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "821c13e2-a1c5-421a-9d57-f28960b561ae",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        400,
        480
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c5a26dac-f55b-4a61-9236-133d9f67f07b",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        440,
        620
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b849b536-788d-40c1-84e8-2e5d6c45a3b8",
      "name": "Send Message to User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1060,
        500
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3782507d-3270-470d-993d-6b3bd2959b2a",
      "name": "Create Department Tool",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        580,
        840
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblB0xec7TL36pDgC",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblB0xec7TL36pDgC",
          "cachedResultName": "Departments"
        },
        "columns": {
          "value": {
            "Department Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Department_Name', ``, 'string') }}",
            "Department Description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Department_Description', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Department Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Department Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department Description",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Department Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department Head",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Department Head",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Titles",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Job Titles",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employees",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employees",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Department Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "typecast": true
        },
        "operation": "create",
        "descriptionType": "manual",
        "toolDescription": "Create department tool"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f4aa10b4-8c66-45b2-80da-740f1045aaed",
      "name": "Create Job Title Tool",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        740,
        840
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblnyWkG6BTpxjMzo",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblnyWkG6BTpxjMzo",
          "cachedResultName": "Job Titles"
        },
        "columns": {
          "value": {
            "Job Title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Job_Title', ``, 'string') }}",
            "Job Description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Job_Description', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Job Title",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Description",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Job Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department associated with the job title",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Department associated with the job title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employees",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employees",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Job Title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "typecast": true
        },
        "operation": "create",
        "descriptionType": "manual",
        "toolDescription": "Create job title tool"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a87618cd-10ec-4e43-ad71-12cd3ee13c76",
      "name": "Delete employee tool",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        1400,
        840
      ],
      "parameters": {
        "id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Record_ID', ``, 'string') }}",
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblGIVbpACRwWzzlp",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblGIVbpACRwWzzlp",
          "cachedResultName": "Employees"
        },
        "operation": "deleteRecord",
        "descriptionType": "manual",
        "toolDescription": "Delete employee tool"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a687d442-126f-43dd-9519-f213d21b8428",
      "name": "Employee Management AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        660,
        500
      ],
      "parameters": {
        "text": "=User Request:\n{{ $json.message.text }}",
        "options": {
          "systemMessage": "=You are employee database management specialist\n\nCall the right tools based on the request:\n\n//\nUser wants to create new employee:\ncall Create Employee AI Agent tool\n//\n\n//\nUser wants to delete:\nPass the employee id to Delete employee tool\nrun Delete employee tool\n//\n\n//\nUser wants to create department data:\ncall \"Create department tool\"\n//\n\n//\nUser wants to create job title data:\ncall \"Create Job Title tool\"\n//\n\n//\nUser wants get department data:\ncall Get departments data from airtable tool\n//\n\n//\nUser wants get employee data:\ncall Get employees data from airtable tool\n//\n\nImportant notes:\nOnly call 1 tool max, choose the most suitable tool\nFor getting data, no need to output the airtable id, example for getting department data => show only name and description (without id)"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "cfc30862-5069-4550-85b4-357edc875eae",
      "name": "Get departments data from airtable",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        680,
        1400
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "limit": 1,
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblB0xec7TL36pDgC",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblB0xec7TL36pDgC",
          "cachedResultName": "Departments"
        },
        "options": {},
        "operation": "search",
        "returnAll": false,
        "descriptionType": "manual",
        "filterByFormula": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_By_Formula', ``, 'string') }}",
        "toolDescription": "Get departments data from airtable"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "47509e6e-8694-45ec-b29e-4006bec17bfc",
      "name": "Get job titles data from airtable",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        840,
        1400
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "limit": 1,
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblnyWkG6BTpxjMzo",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblnyWkG6BTpxjMzo",
          "cachedResultName": "Job Titles"
        },
        "options": {},
        "operation": "search",
        "returnAll": false,
        "descriptionType": "manual",
        "filterByFormula": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_By_Formula', ``, 'string') }}",
        "toolDescription": "Get job titles data from airtable"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "efdf756b-7a03-424d-a6c3-26f08b88b660",
      "name": "Create Employee AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        740,
        1040
      ],
      "parameters": {
        "text": "=User message:\n{{ $json.query }}",
        "options": {
          "systemMessage": "=```\nYou are an airtable database management agent\n\nthe exact column name on airtable is:\nDepartment name\nJob title\n\ndont use any other name combination like underscore\n\nfirst check if {Department name} and {job title} exist\n\nif department name and job title doesnt exist:\ncreate new department and job title then output the airtable id\nif end\n\nif department name and job title exist:\noutput the department and job title existing airtable id\nif end\n\nCall the create employee tools and pass the job_title_id and department_id\n\nOutput in json format:\n{\n  \"department_id\":\"recxxxxxxx\",\n  \"job_title_id\":\"recxxxxxxx\",\n  \"new_employee_id\": \"recxxxxxxx\"\n}\n\n\n```\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "9b79d409-5064-4bd3-bf70-1b60fc4ff391",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        500,
        1040
      ],
      "parameters": {
        "inputSource": "jsonExample",
        "jsonExample": "{\n  \"query\":\"test\",\n  \"action\":\"create\"\n}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "38d2ffff-daf4-49dd-8378-a7e138d723e9",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1480,
        1400
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"department_id\":\"recxxxxxxx\",\n  \"job_title_id\":\"recxxxxxxx\",\n  \"new_employee_id\": \"recxxxxxxx\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "781120f2-eb69-4f85-9b90-1dbfe74af02f",
      "name": "Create Department",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        1000,
        1400
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblB0xec7TL36pDgC",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblB0xec7TL36pDgC",
          "cachedResultName": "Departments"
        },
        "columns": {
          "value": {
            "Department Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Department_Name', ``, 'string') }}",
            "Department Description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Department_Description', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Department Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Department Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department Description",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Department Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department Head",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Department Head",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Titles",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Job Titles",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employees",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employees",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "typecast": true
        },
        "operation": "create",
        "descriptionType": "manual",
        "toolDescription": "Create department"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fd13d5bd-1553-440c-bf8d-0811d18a73bb",
      "name": "Create Job Title",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        1160,
        1400
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblnyWkG6BTpxjMzo",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblnyWkG6BTpxjMzo",
          "cachedResultName": "Job Titles"
        },
        "columns": {
          "value": {
            "Job Title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Job_Title', ``, 'string') }}",
            "Job Description": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Job_Description', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Job Title",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Description",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Job Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department associated with the job title",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Department associated with the job title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employees",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employees",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "typecast": true
        },
        "operation": "create",
        "descriptionType": "manual",
        "toolDescription": "Create job title"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4c241fba-7e3f-4582-ba96-79e8bc773fde",
      "name": "Create employee",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        1320,
        1400
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblGIVbpACRwWzzlp",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblGIVbpACRwWzzlp",
          "cachedResultName": "Employees"
        },
        "columns": {
          "value": {
            "Email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email', ``, 'string') }}",
            "Full Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Full_Name', ``, 'string') }}",
            "Phone Number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone_Number', ``, 'string') }}",
            "job_title_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('job_title_id', ``, 'string') }}",
            "department_id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('department_id', ``, 'string') }}",
            "Employee Status": "Active"
          },
          "schema": [
            {
              "id": "Full Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Full Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employee Type",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Employee",
                  "value": "Employee"
                },
                {
                  "name": "Manager",
                  "value": "Manager"
                }
              ],
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employee Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reports To",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Reports To",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title (from Job Titles)",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Job Title (from Job Titles)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reports To (from Employees)",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Reports To (from Employees)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Department",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department Name (from Department)",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Department Name (from Department)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employee Type Text",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employee Type Text",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employee Status",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Active",
                  "value": "Active"
                },
                {
                  "name": "On Leave",
                  "value": "On Leave"
                },
                {
                  "name": "Inactive",
                  "value": "Inactive"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Employee Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "job_title_id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "job_title_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "department_id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "department_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Head of Department",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Head of Department",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "typecast": true
        },
        "operation": "create",
        "descriptionType": "manual",
        "toolDescription": "Create employee"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "44c1ef1d-0847-4eb6-85ff-4a478f80bfab",
      "name": "Update Employee Data",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1120,
        1040
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appgVjZcaRP8BsKf0",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0",
          "cachedResultName": "HR Database"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblGIVbpACRwWzzlp",
          "cachedResultUrl": "https://airtable.com/appgVjZcaRP8BsKf0/tblGIVbpACRwWzzlp",
          "cachedResultName": "Employees"
        },
        "columns": {
          "value": {
            "id": "={{ $json.output.new_employee_id }}",
            "Job Title": "=[\"{{ $json.output.job_title_id }}\"]",
            "Department": "=[\"{{ $json.output.department_id }}\"]"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "Full Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Full Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title",
              "type": "array",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employee Type",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Employee",
                  "value": "Employee"
                },
                {
                  "name": "Manager",
                  "value": "Manager"
                }
              ],
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employee Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reports To",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Reports To",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title (from Job Titles)",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Job Title (from Job Titles)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reports To (from Employees)",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Reports To (from Employees)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department",
              "type": "array",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Department",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Department Name (from Department)",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Department Name (from Department)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employee Type Text",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employee Type Text",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Employee Status",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Active",
                  "value": "Active"
                },
                {
                  "name": "On Leave",
                  "value": "On Leave"
                },
                {
                  "name": "Inactive",
                  "value": "Inactive"
                }
              ],
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Employee Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "job_title_id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "job_title_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "department_id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "department_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Head of Department",
              "type": "array",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Head of Department",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "163bfe25-0024-414e-9bb5-23a5d2ce4cbe",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        520,
        1400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "70c33091-adb5-4bf2-bae3-67830d91b68f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -120
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 460,
        "content": "## \ud83e\udd16 AI-Powered Employee Database Management via Telegram using OpenAI and Airtable\n\n**What This Template Does:**\n- Provides an HR assistant chatbot interface through Telegram\n- Uses GPT-4 to interpret natural language requests (e.g., \u201cShow me all employees\u201d or \u201cCreate employee Sarah\u2026\u201d)\n- Performs Airtable operations to manage Employees, Departments, and Job Titles\n- Supports dynamic record creation and linking (e.g., if department doesn't exist, it will be created)\n- Maintains conversation memory per Telegram chat for smooth back-and-forth interaction\n- Splits logic into a main router workflow and a sub-workflow for employee creation"
      },
      "typeVersion": 1
    },
    {
      "id": "ea7867df-2d10-4ad5-a4ec-b98905374e44",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        -120
      ],
      "parameters": {
        "color": 5,
        "width": 500,
        "height": 460,
        "content": "## \ud83d\udccb WORKFLOW PROCESS OVERVIEW  \nStep 1: \ud83d\udcac Telegram Trigger receives natural language command from HR user  \nStep 2: \ud83e\udde0 AI Agent (OpenA) interprets intent (view, create, delete, etc.)  \nStep 3: \ud83d\udd00 Router decides workflow path based on user intent  \nStep 4: \ud83d\udcc4 Get Employees fetches employee records from Airtable (if viewing)  \nStep 5: \ud83d\udee0\ufe0f Create Employee Tool triggers sub-workflow for new employee creation  \nStep 6: \ud83c\udfe2 Create/Find Department checks Airtable for department or creates it  \nStep 7: \ud83d\udc54 Create/Find Job Title checks Airtable for job title or creates it  \nStep 8: \ud83d\udcbe Create Employee saves employee record in Airtable with linked fields  \nStep 9: \ud83d\uddd1\ufe0f Delete Employee removes employee record by ID (if requested)  \nStep 10: \ud83d\udd01 Return Response sends formatted reply back to Telegram user\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7c257782-6d13-4c7b-b594-af8a4b721e40",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 320,
        "content": "## SETUP REQUIRED  \n**Author:** [Billy Christi](https://n8n.io/creators/billy/)\n\nAirtable Base Structure:  \n[Copy this Airtable Base](https://airtable.com/appgVjZcaRP8BsKf0/shrQAqQ2JUW50EEyW)\n\nRequired Credentials:  \n\u2022 Airtable API Key  \n\u2022 OpenAI API Key\n\u2022 Telegram Bot Token\n"
      },
      "typeVersion": 1
    },
    {
      "id": "dd0eb916-f358-4b15-b7e2-1afabfd7754f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1540,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 760,
        "content": "# \ud83d\udc4b Hi, I\u2019m Billy\n![My Photo](https://i.ibb.co/Gvn63Bzc/Billy-Christi-AI-Automation.jpg)\nI help businesses build **n8n workflows** & **AI automation projects**.  \nNeed help with n8n or AI Automation projects? \nContact me and let\u2019s build your automation together.\n\n\ud83d\udce9 **Email:** billychartanto@gmail.com  \n\ud83e\udd1d **n8n Creator:** [n8n.io/creators/billy](https://n8n.io/creators/billy/)\n\ud83c\udf10 **My n8n Projects:** [billychristi.com/n8n](https://www.billychristi.com/n8n)  \n\n\n\n---\n\ud83d\udca1 Feel free to get in touch if you\u2019d like help on your next automation project or if you have any feedback or thoughts to share.\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Create employee": {
      "ai_tool": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Job Title": {
      "ai_tool": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Department": {
      "ai_tool": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Delete employee tool": {
      "ai_tool": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Job Title Tool": {
      "ai_tool": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Department Tool": {
      "ai_tool": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Employee AI Agent": {
      "main": [
        [
          {
            "node": "Update Employee Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Employee Management AI Agent": {
      "main": [
        [
          {
            "node": "Send Message to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Employee AI Agent tool": {
      "ai_tool": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get job titles data from airtable": {
      "ai_tool": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get departments data from airtable": {
      "ai_tool": [
        [
          {
            "node": "Create Employee AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get employees data from airtable tool": {
      "ai_tool": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get job titles data from airtable tool": {
      "ai_tool": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get departments data from airtable tool": {
      "ai_tool": [
        [
          {
            "node": "Employee Management AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}