Agent Access Control with Telegram & Airtable in n8n Automation

This n8n workflow automates secure access control by integrating Telegram and Airtable to check user permissions before running AI tools. It prevents unauthorized tool usage, saving time and ensuring compliance.
Telegram Trigger
Airtable
Agent
+11
Workflow Identifier: 1757
NODES in Use: Telegram Trigger, Airtable, Set, Agent, Code, Simple Memory, Telegram, OpenAI Chat Model, ToolCode, ToolCalculator, ToolWikipedia, ToolHttpRequest, ToolWorkflow, ExecuteWorkflowTrigger

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow controls who can use AI tools through Telegram. It stops people without permission from using certain tools. It checks user rights from Airtable and only allows allowed AI functions. People who are not allowed get clear messages telling them to ask their boss.

The workflow listens to Telegram messages from confirmed users. It looks up their roles and allowed tools in Airtable. Then it changes AI tools used by the session. Tools not allowed are turned off with a “not authorized” reply. User input goes to a smart assistant using only allowed tools. The workflow handles special tasks like weather info with a smaller, restricted agent. This system saves time by managing tool access automatically and stops mistakes.


Tools and Services Used

  • Telegram Bot API: Receives and sends user messages.
  • Airtable: Stores user roles and tool permissions.
  • OpenAI API: Runs AI agents responding to user queries.
  • n8n Platform: Automates the workflow; includes Langchain, Airtable, Telegram nodes.
  • HTTP Request Nodes: Used by sub-agents for external data like weather.

Workflow Inputs, Processing, and Outputs

Inputs

  • User messages sent to Telegram Bot.
  • Usernames extracted from Telegram messages.
  • Permissions data (roles, allowed tools) queried from Airtable.

Processing Steps

  • Telegram Trigger captures incoming messages.
  • Airtable node fetches user permissions by username.
  • If node checks if user data exists.
  • Unauthorized users receive a Telegram message denying access.
  • Set node formats permissions data for use.
  • Code node overrides unauthorized tools with a fixed message.
  • Agent nodes process user input using only allowed AI tools.
  • Memory nodes keep session context based on Telegram user ID.
  • Outputs sent back through Telegram node to user chat.

Outputs

  • AI assistant replies in Telegram chat tailored by user permissions.
  • Messages denying access if tools or users are unauthorized.

Beginner Step-by-Step: How to Use This Workflow in n8n Production

Step 1: Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Inside the n8n editor, choose “Import from File” to load the downloaded workflow.

Step 2: Configure Credentials and Settings

  1. Add your Telegram Bot API Key in the credentials section of the Telegram Trigger and Telegram reply nodes.
  2. Enter OpenAI API Key in relevant Agent nodes.
  3. Update Airtable Base ID, Table name, and API Key in the Airtable node to match your Airtable setup.
  4. Make sure Airtable fields for username, roles, and allowed tools exist and are named correctly.

Step 3: Review Code and Prompt Nodes

  1. Check the Code node named “Check permissions” for correct tool names matching your Airtable list.
  2. Look at text prompts in Agent nodes to customize messages if needed.

Step 4: Test the Workflow

  1. Send test messages in Telegram with authorized and unauthorized usernames.
  2. Confirm that users get allowed tools only and correct access-denied messages.

Step 5: Activate the Workflow for Production

  1. Turn the workflow “Active” in n8n to run on all Telegram messages.
  2. Monitor logs for errors and confirm expected behavior in Telegram responses.
  3. Consider exploring self-host n8n if hosting on your own server.

Common Problems and How This Workflow Handles Them

  • If a Telegram user does not exist in Airtable, the workflow sends a clear “unknown user” reply, stopping further actions.
  • If tool permissions are missing or tool names do not match, the Code node disables those tools and replies with “not authorized”.
  • If Telegram messages do not trigger the workflow, it often means missing API keys or webhook misconfiguration. The setup must be double-checked in all Telegram nodes.

How to Customize the Workflow

  • Change OpenAI models in Agent nodes for better speed or quality.
  • Add new AI tools in Langchain nodes, then update Airtable with users allowed to access them.
  • Modify Airtable permission fields for more detailed control and update the Code node accordingly.
  • Change Telegram reply node messages for richer formats like buttons or images.
  • Increase session memory by adjusting Simple Memory node settings or connect to external storage for long sessions.

Summary – What You Get from This Workflow

✓ Controls AI tool access via Telegram commands automatically.
✓ Stops unauthorized users and tools safely.
✓ Saves hours of manual permission checking.
✓ Keeps conversation memory per user.
✓ Supports customizing tools and adding sub-agents.
✓ Works smoothly inside n8n with Airtable permissions.


Frequently Asked Questions

The workflow queries Airtable using the Telegram username to get user roles and allowed tools.
The workflow sends an “unknown user” message in Telegram and blocks access to all AI tools.
A Code node disables unauthorized tools by returning fixed “not authorized” messages instead of running the tool.
Import the workflow file in n8n, configure Telegram, Airtable, and OpenAI API keys, test with sample Telegram messages, then activate the workflow.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free