templates/template-slack-agent/README.md
A Mastra template for building Slack bots powered by AI agents with streaming responses and thread-based conversation memory. Each agent gets its own Slack app and webhook route. Built with Mastra.
Connecting AI agents to Slack is one of the most common integration patterns — whether for internal tools, customer support, or team automation. This template shows how to wire up Mastra agents to Slack with proper streaming, thread memory, and multi-agent support. It includes two demo agents (reverse, caps) to demonstrate the pattern, so you can swap in your own agents and be up and running quickly.
npx create-mastra@latest --template slack-agent to scaffold the project locally..env.example to .env and fill in your OpenAI API key and Slack credentials.app_mentions:read, channels:history, chat:write, im:history. Copy the Bot User OAuth Token to .env.https://your-server.com/slack/{agentName}/events.app_mention, message.im..env.ngrok http 4111 to get a public URL, then npm run dev and open localhost:4111 to try it out.This template is a starting point. Here are some ideas to make it your own:
src/mastra/slack/routes.ts and the corresponding env vars.src/mastra/slack/streaming.ts.Mastra templates are ready-to-use projects that show off what you can build — clone one, poke around, and make it yours. They live in the Mastra monorepo and are automatically synced to standalone repositories for easier cloning.
Want to contribute? See CONTRIBUTING.md.