Skip to main content
Towns bots are built on Hono. While /webhook is reserved for Towns events, you can add custom routes for external webhooks, APIs, and scheduled tasks.

Using Bot Methods Anywhere

Important: Bot methods like sendMessage() can be called directly on the bot instance, outside of event handlers. This enables integration with external services, webhooks, and scheduled tasks.

GitHub Webhooks

Scheduled Tasks

Storing State

In-memory storage (Map, Set) only works on always-on servers. Free hosting tiers can restart your server, losing all in-memory data. Consider storing data in a external database.

SQLite (Drizzle)

Turso (Managed SQLite)

Free tier, perfect for bots on free hosting:

Redis

For caching and rate limiting:

Next Steps