
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@towns-protocol/bot
Advanced tools
A bot framework for Towns.
We suggest users to quickstart a project using our cli.
$ bunx towns-bot init
If you prefer to install manually:
$ bun add @towns-protocol/bot viem hono
With Node:
import { makeTownsBot } from "@towns-protocol/bot";
import { serve } from "@hono/node-server";
const app = new Hono();
const bot = await makeTownsBot("<app-private-data-base64>", "<jwt-secret>");
bot.onMessage((handler, { channelId, isMentioned }) => {
if (isMentioned) {
handler.sendMessage(channelId, "Hello, world!");
}
});
const { jwtMiddleware, handler } = bot.start();
app.post("/webhook", jwtMiddleware, handler);
serve({ fetch: app.fetch });
With Bun:
import { makeTownsBot } from "@towns-protocol/bot";
const app = new Hono();
const bot = await makeTownsBot("<app-private-data-base64>", "<jwt-secret>");
bot.onMessage((handler, { channelId, isMentioned }) => {
if (isMentioned) {
handler.sendMessage(channelId, "Hello, world!");
}
});
const { jwtMiddleware, handler } = bot.start();
app.post("/webhook", jwtMiddleware, handler);
export default app;
Bot framework uses debug package for logging.
You can enable by setting the DEBUG environment variable to csb:bot.
DEBUG=csb:bot node dist/bot.cjs
FAQs
A bot framework for Towns.
We found that @towns-protocol/bot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.