Channels
The Agent Builder is part of the Mastra Enterprise Edition. Production deployments require a valid EE license. Contact sales for more information.
Channels let Builder-created agents reach users outside the Mastra server. Register a channel provider on Mastra.channels and the Builder exposes the channel as an integration option for every agent.
Slack is currently the only supported channel.
QuickstartDirect link to Quickstart
Install the Slack provider:
- npm
- pnpm
- Yarn
- Bun
npm install @mastra/slack
pnpm add @mastra/slack
yarn add @mastra/slack
bun add @mastra/slack
Register SlackProvider on Mastra.channels:
import { Mastra } from '@mastra/core/mastra'
import { MastraEditor } from '@mastra/editor'
import { createBuilderAgent } from '@mastra/editor/ee'
import { SlackProvider } from '@mastra/slack'
export const mastra = new Mastra({
storage,
channels: {
slack: new SlackProvider({
refreshToken: process.env.SLACK_APP_CONFIG_REFRESH_TOKEN,
baseUrl: process.env.SLACK_BASE_URL,
}),
},
agents: { builderAgent: createBuilderAgent() },
editor: new MastraEditor({
builder: { enabled: true },
}),
})
The Slack provider handles app creation, OAuth, slash commands, and message routing for every Builder-created agent that opts in.
ConfigurationDirect link to Configuration
SlackProvider requires one environment variable and accepts one optional override:
SLACK_APP_CONFIG_REFRESH_TOKEN(required): the refresh token from your Slack app configuration tokens, available under Your App Configuration Tokens on api.slack.com/apps. The refresh token does not expire, but the access tokens it issues rotate every 12 hours and are auto-persisted toMastra.storage.baseUrl(optional): the public URL Slack should send events and OAuth callbacks to. Defaults to the running Mastra server's host and port (for example,http://localhost:4111in local development). PassbaseUrlexplicitly when the public URL differs from the server's resolved address — typically a tunnel for local development (cloudflared tunnel --url http://localhost:4111) or a deployed URL in production.
Storage requirementDirect link to Storage requirement
SlackProvider requires a persistent storage backend on the Mastra instance. Without storage, rotated tokens and app installations are lost on restart.
RelatedDirect link to Related
- Deploying — set a public
baseUrlfor production deployments. - Configuration — wire channel toggles into the Builder UI.