Skip to main content

Control AI agent tool access with Port RBAC and Slack mentions

Workflow preview

Workflow preview
100%
Control AI agent tool access with Port RBAC and Slack mentions preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

RBAC for AI agents with n8n and Port This workflow implements role based access control for AI agent tools using Port as the single source of truth for permissions. Different users get access to di...

Best for

  • Internal Wiki automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.code, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.toolcalculator, n8n-nodes-base.if, n8n-nodes-base.stickynote, n8n-nodes-base.slacktrigger, n8n-nodes-base.slack

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Port IO.

Original n8n.io source

1.1 Workflow description

Title
Control AI agent tool access with Port RBAC and Slack mentions
Workflow name
Control AI agent tool access with Port RBAC and Slack mentions

RBAC for AI agents with n8n and Port

This workflow implements role-based access control for AI agent tools using Port as the single source of truth for permissions. Different users get access to different tools based on their roles, without needing a separate permission database.

For example, developers might have access to PagerDuty and AWS S3, while support staff only gets Wikipedia and a calculator. The workflow checks each user's permissions in Port before letting the agent use any tools.

For the full guide with blueprint setup and detailed configuration, see RBAC for AI Agents with n8n and Port in the Port documentation.

How it works

The n8n workflow orchestrates the following steps:

  • Slack trigger — Listens for @mentions and extracts the user ID from the message.
  • Get user profile — Fetches the user's Slack profile to get their email address.
  • Port authentication — Requests an access token from the Port API using client credentials.
  • Permission lookup — Queries Port for the user entity (by email) and reads their allowed_tools array.
  • Unknown user check — If the user doesn't exist in Port, sends an error message and stops.
  • Permission filtering — The "Check permissions" node compares each connected tool against allowed_tools and replaces unauthorized ones with a stub that returns "You are not authorized to use this tool."
  • AI agent — Runs with only permitted tools, using GPT-4 and chat memory.
  • Response — Posts the agent output back to the Slack channel.

Setup

  • Connect your Slack account and set the channel ID in the trigger node
  • Add your OpenAI API key
  • Register for free on Port.io
  • Create the rbacUser blueprint in Port (see full guide for blueprint setup)
  • Add user entities using email as the identifier
  • Replace YOUR_PORT_CLIENT_ID and YOUR_PORT_CLIENT_SECRET in the "Get Port access token" node
  • Connect credentials for any tools you want to use (PagerDuty, AWS, etc.)
  • Update the channel ID in the Slack nodes
  • Invite the bot to your Slack channel
  • You should be good to go!

Prerequisites

  • You have a Port account and have completed the onboarding process.
  • You have a working n8n instance (self-hosted) with LangChain nodes available.
  • Slack workspace with bot permissions to receive mentions and post messages.
  • OpenAI API key for the LangChain agent.
  • Port client ID and secret for API authentication.
  • (Optional) PagerDuty, AWS, or other service credentials for tools you want to control.

⚠️ This template is intended for Self-Hosted instances only.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 2 - Check permissions

Type / Role
@n8n/n8n-nodes-langchain.code - code
Config choices
Version 1

Block 3 - Set input

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 4 - calculator

Type / Role
@n8n/n8n-nodes-langchain.toolCalculator - toolCalculator
Config choices
Version 1

Block 5 - Unknown user

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 6 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note11

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note12

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Slack Trigger

Type / Role
n8n-nodes-base.slackTrigger - slackTrigger
Config choices
Version 1

Block 12 - Send a message

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 13 - Get user permission from Port

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 14 - Wikipedia

Type / Role
@n8n/n8n-nodes-langchain.toolWikipedia - toolWikipedia
Config choices
Version 1

Block 15 - Create an incident in PagerDuty

Type / Role
n8n-nodes-base.pagerDutyTool - pagerDutyTool
Config choices
Version 1

Block 16 - Create a bucket in AWS S3

Type / Role
n8n-nodes-base.awsS3Tool - awsS3Tool
Config choices
Version 2

Block 17 - Get user's slack profile

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 18 - Get Port access token

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 19 - Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 20 - Send output message

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 21 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 23 - Get Regions from Port

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

3. Summary Table

Workflow Control AI agent tool access with Port RBAC and Slack mentions
Complexity advanced
Nodes 23
Categories Internal Wiki, AI Chatbot
Author Port IO
Published 23 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/12062/12062.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Control AI agent tool access with Port RBAC and Slack mentions do?

RBAC for AI agents with n8n and Port This workflow implements role based access control for AI agent tools using Port as the single source of truth for permissions. Different users get access to di...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI Chatbot use case.