@spectrum-ts/express
v9.3.1
Published
Express webhook adapter for spectrum-ts.
Readme
@spectrum-ts/express
Express webhook adapter for spectrum-ts.
Install
bun add spectrum-ts @spectrum-ts/express expressUse
import { Spectrum } from "spectrum-ts";
import { spectrum } from "@spectrum-ts/express";
import express from "express";
const app = await Spectrum({
webhookSecret: process.env.SPECTRUM_WEBHOOK_SECRET,
});
const server = express();
// Mount before any global express.json() — the plugin needs the raw body.
server.use(
spectrum({
app,
onMessage: async (space, message) => {
if (message.content.type === "text") {
await space.send(`echo: ${message.content.text}`);
}
},
})
);
server.listen(3000);See the spectrum-ts documentation for the full guide.
