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
Bot methods like sendMessage() can be called directly on the bot instance, outside of event handlers. This enables integration with external services.
External Webhooks
Integrate with external services like GitHub, Linear, Stripe, or custom APIs.
You can use this pattern with any service that has webhook integration. Alchemy, GitHub, Linear, etc.
Scheduled Tasks
Use intervals or cron jobs to send periodic updates.
Persistent Storage
In-memory storage (Map, Set) only works on always-on servers. Use a database for production.
Popular options:
- SQLite/Turso - Simple, serverless-compatible
- Redis - Fast caching and rate limiting
- PostgreSQL - Full-featured relational database
- Supabase - Managed PostgreSQL with APIs
Next Steps