- Create a bot in Towns
- Set up your development environment
- Deploy to Render.com
- Configure your bot in Towns
Prerequisites
Before you begin, make sure you have:- Bun installed
- A GitHub account
Create a Bot
- Visit the Developer Portal Go to app.towns.com/developer
- Create New Bot Fill in the details and click “Create Bot”.
- 
Save Your Credentials
After creation, you’ll receive two critical values:
- APP_PRIVATE_DATA- Your bot’s private key and encryption device (base64 encoded string)
- JWT_SECRET- Used to verify webhook requests from Towns servers
 
Store these securely - you’ll need them for deployment.
Develop Your Bot
Now let’s set up your bot development environment.Initialize Your Project
Create a new bot project using the Towns bot CLI:Install Dependencies
Configure Environment
Copy the.env.sample file in your project root:
Push to GitHub
Create a new repository on GitHub, follow their instructions, commit all your changes and push your bot code to it.Deploy Your Bot
We’ll deploy to Render.com, which offers a generous free tier perfect for bot hosting.- Sign up for Render Go to render.com and create an account (can use GitHub login)
- 
Create New Web Service
- Click “New +” → “Web Service”
- Connect your GitHub account if prompted
- Select your bot repository
 
- 
Configure the Service
Fill in the deployment settings:
Setting Value Name my-bot(or any name you prefer)Environment NodeBuild Command bun installStart Command bun run start
- 
Add Environment Variables
In the “Environment” section, you can either paste your .envfile contents or add each variable manually.Key Value APP_PRIVATE_DATAYour app private data from bot creation JWT_SECRETYour JWT secret from bot creation 
- 
Deploy
Click “Create Web Service”. Render will:
- Clone your repository
- Run bun installto build your bot
- Start your bot with bun run start
 
Free tier services on Render may spin down after 15 minutes of inactivity. The first request after spin-down may take 30-60 seconds. Consider upgrading to a paid plan for production bots.
Configure in Towns
Now that your bot is deployed and publicly accessible, connect it to Towns.Set Webhook URL
- Go back to app.towns.com/developer
- Click on your bot
- 
Under “Webhook URL”, enter:
Don’t forget the/webhookpath at the end!
- Click “Save”
Configure Forwarding Settings
In the bot settings page, under “Forwarding Settings”, choose which messages your bot receives.- 
All Messages - Bot receives every event in channels it’s in
- All event handlers available. See Events for more information.
- Use for: AI agents, moderation bots, analytics, or when you need tip/membership events
 
- 
Mentions, Commands, Replies & Reactions (Default) - Bot only receives:
- Direct @mentions, replies to bot’s messages, reactions, and slash commands
- Available handlers: onMessage(filtered),onSlashCommand,onReaction,onMessageEdit,onRedaction
- NOT available: onTip,onChannelJoin,onChannelLeave,onEventRevoke
- Use for: Most interactive bots
 
- 
No Messages - Bot receives no message events
- Use for: External-only bots (e.g., GitHub webhooks, scheduled tasks)
 
Install Bot to a Space
Finally, install your bot to a space to start using it:- In Towns app, go to a space you own or admin
- Go to Space Settings → Bots
- Search for your bot by username
- Click “Install”
- Grant permissions as needed
Testing Your Bot
Try these to verify everything works: In the channel you installed your bot to, mention your bot:Next Steps
Now that your bot is running, explore more capabilities:- Local development - Learn how to develop bots locally to fast iterate
- Learn about event handlers - Handle different event types
- Add slash commands - Create custom /help,/poll, etc.
- External interactions - Timers, webhooks, custom APIs