@novu/framework. Call generate() in onMessage and return the text. Novu delivers the reply on Slack. The same handler works on other providers after you link them.
There is no @novu/framework/mastra adapter yet. Use the base Framework package and return text from onMessage (or call ctx.reply()).
Starting from scratch? See Scaffold with the CLI.
Prerequisites
- A Novu account
- Node.js 22+
- An existing app with a Mastra agent
- A Slack workspace where you can install apps
- An
OPENAI_API_KEY(or another model key Mastra supports)
Connect an existing app
1
Create the agent and connect Slack
In the Novu dashboard:- Go to Agents → Create agent.
- Under Custom code, pick Custom code (Mastra uses the base Framework path).
- Set Agent name and Identifier.
- Select Slack, generate a Slack App Configuration Token, paste it, and finish the install / Allow flow.
npx novu connect, choose Custom code and Slack, and skip creating a starter project when prompted.2
3
Add the Mastra agent and Novu handler
agent('...') to the dashboard Identifier. Export the Novu agent from your agents index.4
5
Run locally and message Slack
Tool approval
For sensitive tools, usectx.toolApproval.request() from Tool approval so the turn pauses for Approve / Deny before execution.
Scaffold with the CLI
@mastra/core, and replace the demo handler with the code above.
For an existing codebase, use Connect an existing app instead.
FAQ
Which channels work with a Mastra agent?
Which channels work with a Mastra agent?
Slack, Microsoft Teams, WhatsApp, Telegram, and email. See Channels overview.
Does Novu have a Mastra adapter?
Does Novu have a Mastra adapter?
Not yet. Use
@novu/framework and return text from onMessage. AI SDK and LangChain have dedicated adapters if you prefer those stacks.Where is the generic Framework API documented?
Where is the generic Framework API documented?
Other frameworks for patterns without a dedicated adapter.
Set this up with an AI assistant
Connect my Mastra agent to Slack with Novu
Next steps
Other frameworks
Framework patterns without a dedicated adapter.
Slack
Slack capabilities and setup links.
Going to production
Deploy the bridge and disable local tunneling.
Connect AI SDK
Same flow with @novu/framework/ai-sdk.