Socket
Book a DemoInstallSign in
Socket

@towns-protocol/bot

Package Overview
Dependencies
Maintainers
4
Versions
123
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.

latest
npmnpm
Version
0.0.402
Version published
Weekly downloads
1.1K
-12.46%
Maintainers
4
Weekly downloads
 
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 06 Nov 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