Skip to content
Documentation
Documentation

Adapters

MUS doesn’t care where feedback goes. An adapter is the thing that decides. You configure it once — either as an env var for the Docker image, or as code in your own server — and every event flows through it automatically.


AdapterEnv var (Docker)Code import
SlackSLACK_BOT_TOKENslackAdapter
DiscordDISCORD_WEBHOOK_URLdiscordAdapter
Microsoft TeamsTEAMS_WEBHOOK_URLteamsAdapter
WebhookWEBHOOK_URLwebhookAdapter
Customimplement MusAdapter

If you’re using the mus-server Docker image, just set the env var. No code needed.

Terminal window
docker run -d -p 3001:3001 \
-e SLACK_BOT_TOKEN=xoxb-your-token \
ghcr.io/datachefhq/mus-server:latest

Set multiple env vars to fan out to several destinations at once:

Terminal window
docker run -d -p 3001:3001 \
-e SLACK_BOT_TOKEN=xoxb-your-token \
-e DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/... \
ghcr.io/datachefhq/mus-server:latest

Framework handlers (Next.js, Express, Fastify, Hono)

Section titled “Framework handlers (Next.js, Express, Fastify, Hono)”

Import createMusHandlers and pass whichever adapters you want:

import { createMusHandlers } from '@datachefhq/mus/server'
import { slackAdapter } from '@datachefhq/mus/adapters/slack'
export const { POST, POSTStandalone, POSTSupportChannel } = createMusHandlers({
adapter: slackAdapter({ token: process.env.SLACK_BOT_TOKEN! }),
})

Pass an array to run multiple adapters in parallel. A failure in one won’t block the others:

import { slackAdapter } from '@datachefhq/mus/adapters/slack'
import { discordAdapter } from '@datachefhq/mus/adapters/discord'
createMusHandlers({
adapter: [
slackAdapter({ token: process.env.SLACK_BOT_TOKEN! }),
discordAdapter({ webhookUrl: process.env.DISCORD_WEBHOOK_URL! }),
],
})

Every adapter implements this interface. Only the methods you define are called — unimplemented ones are silently skipped.

interface MusAdapter {
onVoiceUpload?(event: VoiceEvent): Promise<void>
onSupportRequest?(event: SupportEvent): Promise<{ channelId?: string }>
onStandaloneFeedback?(event: StandaloneEvent): Promise<void>
}

See Event Types for the full shape of each event.