Parameters
required
Returns
RouterDocumentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
spectrum(options: SpectrumPluginOptions): Router
import express from "express";
import { Spectrum } from "spectrum-ts";
import { spectrum } from "@spectrum-ts/express";
const app = await Spectrum({ ..., webhookSecret: process.env.SPECTRUM_WEBHOOK_SECRET });
const server = express();
server.use(spectrum({ // mount before any global express.json()
app,
onMessage: async (space, message) => {
if (message.content.type === "text") await space.send(`echo: ${message.content.text}`);
},
}));
server.listen(3000);
RouterWas this page helpful?