🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@towns-protocol/bot

Package Overview
Dependencies
Maintainers
4
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@towns-protocol/bot

A bot framework for Towns.

npmnpm
Version
0.0.392
Version published
Maintainers
4
Created
Source

@towns-protocol/bot

A bot framework for Towns.

Installing

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

Usage

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;

Debug Logging

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

Package last updated on 31 Oct 2025

Did you know?

Socket

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.

Install

Related posts