Discord Adapter
The Discord adapter posts feedback to a Discord channel using an incoming webhook. Voice files are uploaded as attachments.
import { createMusHandlers } from '@datachef/mus/server'import { discordAdapter } from '@datachef/mus/adapters/discord'
export const { POST, POSTStandalone, POSTSupportChannel } = createMusHandlers({ adapter: discordAdapter({ webhookUrl: process.env.DISCORD_WEBHOOK_URL!, }),})DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...How to get a webhook URL
Section titled “How to get a webhook URL”- Open Discord → Server Settings → Integrations → Webhooks
- Click New Webhook
- Choose the channel and give it a name
- Copy the webhook URL
Message formatting
Section titled “Message formatting”discordAdapter({ webhookUrl: process.env.DISCORD_WEBHOOK_URL!, format: (event) => ({ embeds: [{ title: `${event.type} — ${event.section.name}`, description: event.note, color: event.type === 'thumbs-up' ? 0x41a148 : 0xdc2626, fields: [ { name: 'User', value: event.user.name, inline: true }, { name: 'Email', value: event.user.email, inline: true }, ], timestamp: event.timestamp, }], }),})