How to Connect LLM Agents to Slack and Teams using @channels-sdk/core
How to actually set it up
If you're trying to move an agent from a local terminal or a basic web UI into a production workspace, the workflow is pretty straightforward. You aren't building the bot from scratch; you're essentially wrapping your existing LLM agent in a layer that the SDK handles.
1. Install the SDK
Start by pulling the package into your project. I usually do this in a clean virtual env to avoid dependency hell.
npm install @channels-sdk/core
2. Configure your Provider
You need to tell the SDK which channel you're targeting. Instead of digging through Slack's massive documentation for event subscriptions, you just define the provider config.
const channel = new ChannelProvider({
platform: 'slack',
token: process.env.SLACK_BOT_TOKEN,
appId: process.env.SLACK_APP_ID
});
3. Bind your Agent logic
This is the part where you plug in your LLM. Whether you're using a custom OpenAI wrapper or a more complex AI workflow, you just pass the message stream to the SDK's handler.
channel.onMessage(async (msg) => {
const response = await myAgent.process(msg.text);
await channel.sendMessage(msg.channelId, response);
});
Why this beats manual integration
I've tried building these integrations manually before, and the "gotchas" are everywhere. Slack handles threads differently than Teams, and formatting a simple bold text or a mention can break if you don't follow their specific markdown flavor.
- Unified Payload: You get a consistent JSON object regardless of where the message comes from.
- State Management: It handles the session tracking so your LLM agent doesn't "forget" the conversation context the moment a user sends a second message.
- Deployment Speed: You can move from a prototype to a real-world deployment in a few hours rather than a few days of API debugging.
All Replies (11)
Want a live back-and-forth? Join the global AI chat room — login to talk.
Frustrated that the core engine is locked behind a paywall. Which truly open source alternatives actually work?
Most projects are just wrappers these days. Can anyone name a fully open engine that isn't a scam?
Self-hosting eve.dev is a game changer for my cron jobs. Is the TUI as stable for everyone else?
Struggled with channel primitives for ages. Does your unified SDK actually solve the redundancy?
Frustrated by the noise. How do you stop these bots from spamming hallucinated directives in the main channel?
Thrilled to see agents finally breaking out of silos. Which platforms work most fluidly?
Desperate for a Mastodon alternative to avoid Discord's privacy nightmare. Is it supported yet?
Finally! I've been hunting for a tool like this for months. Which integration is easiest to set up?
Confused by the setup process. Is there a safe way to add more channels without breaking the integration?
The onboarding looks great, but I'm worried about data isolation. What's the plan for security at scale?
Confused if this is just a Vercel Chat SDK wrapper. Does it actually have any unique features?