๐งโ๐ป Description
This workflow integrates Slack with an OpenAI Chat Agent to create a fully interactive chatbot inside your Slack workspace.
It works in a bidirectional loop:
- A user sends a message in Slack.
- The workflow captures the message and logs it back into Slack (so you can monitor whatโs being passed into the agent).
- The message is sent to an OpenAI-powered agent (e.g., GPT-4o).
- The agent generates a response.
- The response is formatted and posted back to Slack in the same channel or DM thread.
This allows you to monitor, test, and interact with the agent directly from Slack.
๐ Use Cases
- Team Support Bot: Provide quick AI-generated answers to FAQs in Slack.
- E-commerce Example: The default prompt makes the bot act like a store assistant, but you can swap in your own domain knowledge.
- Conversation Monitoring: Log both user and agent messages in Slack for visibility and review.
- Custom AI Agents: Extend with RAG, external APIs, or workflow automations for specialized tasks.
โ๏ธ Setup Instructions
1๏ธโฃ OpenAI Setup
- Sign up at OpenAI.
- Generate an API key from the API Keys page.
- In n8n โ Credentials โ New โ OpenAI โ paste your key and save.
- In the OpenAI Chat node, select your credential and configure the system prompt.
- Example included: โYou are an ecommerce bot. Help the user as if you were working for a mock store.โ
- You can edit this prompt to fit your use case (support bot, HR assistant, knowledge retriever, etc.).
2๏ธโฃ Slack Setup
- Go to Slack API Apps โ click Create New App.
- Under OAuth & Permissions, add the following scopes:
- Read:
channels:history, groups:history, im:history, mpim:history, channels:read, groups:read, users:read.
- Write:
chat:write.
- Install the app to your workspace โ copy the Bot User OAuth Token.
- In n8n โ Credentials โ New โ Slack OAuth2 API โ paste the token and save.
- In the Slack nodes (e.g., Send User Message in Slack, Send Agentโs Response in Slack), select your credential and specify the Channel ID or User ID to send/receive messages.
๐๏ธ Customization Guidance
- Change Agent Behavior: Update the system message in the Chat Agent node.
- Filter Channels: Limit listening to a specific channel by adjusting the Slack nodeโs Channel ID.
- Format Responses: The Format Response node shows how to structure agent replies before posting back to Slack.
- Extend Workflows: Add integrations with databases, CRMs, or APIs for dynamic data-driven responses.
๐ Workflow Flow (Simplified)
Slack User Message โ Send User Message in Slack โ Chat Agent โ Format Response โ Send Agent Response in Slack
๐ฌ Contact
Need help customizing this workflow (e.g., multi-channel listening, advanced AI logic, or external integrations)?
๐ง [email protected]
๐ Robert Breen
๐ ynteractive.com