Vibe‑Code Your
Towns Bot
Build production‑ready bots using AI assistance. No coding experience required—just follow the steps, paste the code, and deploy to the world.
Your Journey to Bot Mastery
Follow these 7 simple steps to build and deploy your first Towns bot
Get the Bot Starter Template
Clone the starter template with AI or manually
Prime Cursor AI
Load knowledge base files into Cursor
Customize with AI
Add features using AI assistance
Create Bot Account
Register bot in Towns Developer Portal
Push to GitHub & Deploy to Render
Push your code to GitHub and deploy it live
Configure Webhook in Towns
Connect your deployed bot to Towns Protocol
Install Bot
Install your bot in a Towns space and verify it works
Step 1: Get the Bot Starter Template
Choose your preferred method to get started - both work perfectly!
Option A: Pure Vibe Coding ✨
EASIESTLet AI clone it for you - Zero effort!
Just copy this prompt and paste into Cursor/Codex AI:
Run this install command for me: bunx towns-bot init my-towns-bot Please: 1. if bun isn't installed, install it using instructions here: https://bun.sh/docs/installation 2. follow the instructions to install dependences 3. Confirm when it's ready Let me know if you need any permissions or have questions!
🎯 True vibe coding: AI handles git, install, everything. You just approve when it asks!
Option B: Terminal
For developers who prefer CLI
Run these commands in your terminal:
bunx towns-bot init my-towns-bot
cd my-towns-bot
bun install
Then open the folder in Cursor: File → Open Folder → select `my-towns-bot`
Step 2: Prime Cursor AI
Ask Cursor to read the project rules and docs so it follows them automatically.
Open the Cursor chat (Cmd/Ctrl + K), paste the prompt below, and press Enter. Cursor will read the files that already live in the repo—no copying required.
You are my Towns Protocol bot partner. Before changing any code, READ (don't summarize) these files in this workspace: - .cursorrules - README.md - AGENTS.md - src/index.ts - src/commands.ts Confirm when you've loaded them and let me know you're ready.
Those files contain Bot SDK knowledge and best practices:
- •
.cursorrules- AI coding rules (what's allowed, what to avoid) - •
AGENTS.md- AI agent patterns and architecture - •
README.md- Deployment workflow and troubleshooting
With all that knowledge loaded, simply ask Cursor to add features in plain English:
- • "Add a response when users say 'wagmi'"
- • "Create a verification system with ✅ reactions"
- • "Build a points system with leaderboard command"
- • "Add moderation for bad words"
Cursor will use the knowledge base to write correct, production-ready code!
Step 3: Customize with AI
Add features before deploying your bot
Your bot template is ready! Now use the AI prompts from Step 2 to add any features you want BEFORE deploying. This way you deploy once with everything you need.
Popular Features to Add:
- • Custom word responses (WAGMI, moon, etc.)
- • User points and leaderboards
- • Welcome verification system
- • Joke and fun commands
- • Moderation and spam protection
Advanced Features:
- • Database integration for user data
- • Reaction-based interactions
- • Thread conversation handling
- • Admin-only commands
- • Integration with external APIs
Save your changes in Cursor, then move to Step 4 to create your bot account and deploy your fully customized bot to production!
Step 4: Create Bot Account
Register your bot in the Towns Developer Portal
Two critical credentials that connect your bot to the Towns Protocol network. Keep these safe - they're like your bot's passport!
- 1
Go to app.towns.com/developer
Complete bot details and click "Create Bot"
- !
Save your credentials
APP_PRIVATE_DATAYour bot's private key and encryption device.
JWT_SECRETUsed to verify webhook requests from Towns servers
Do not share these with anyone. They are very sensitive and can be used to impersonate your bot.
Step 5: Push to GitHub & Deploy to Render
Push your code to GitHub and deploy it live
You need a GitHub account and Render account (both free). Create them if you haven't already.
Part A: Push to GitHub
Ask Cursor to help you push to GitHub. Copy this prompt:
Help me push my Towns bot to GitHub. I need to: 1. Initialize git in this project 2. Create a new repository on GitHub 3. Push all my code to GitHub Guide me through each step.
The AI will guide you through creating a GitHub repository and pushing your code. Follow its instructions!
Part B: Deploy on Render
- 1
Go to render.com
Create a Render account and connect it with your GitHub
- 2
Create a new Web Service
Click "New" → "Web Service" and connect your GitHub repository
- 3
Configure deployment settings:
Name:
my-botEnvironment:
NodeBuild Command:
bun installStart Command:
bun run start - 4
Add environment variables (click "Advanced"):
APP_PRIVATE_DATA= Your saved credentialJWT_SECRET= Your saved credential - 5
Click "Create Web Service" and wait for deployment
Note: After deployment, you'll get a URL like https://my-bot.onrender.com. Save this URL - you'll need it in the next step!
Free tier note: Free Render services may experience 30-60 second delays after inactivity while the service spins up.
Step 6: Configure Webhook in Towns
Connect your deployed bot to Towns Protocol
A webhook tells Towns where to send messages so your bot can respond. It's like giving Towns your bot's phone number!
- 1
Go to Towns Developer Portal
Find your bot and click "Edit"
- 2
Enter your webhook URL:
https://my-bot.onrender.com/webhookImportant: Add
/webhookto the end of your Render URL! - 3
Configure message forwarding preferences:
All Messages
Bot receives all messages
Mentions, Replies, Reactions, Slash Commands
Recommended. Bot only receives messages when directly mentioned or replied to.
No Messages
Bot only receives status checks (not recommended for interactive bots)
- 4
Click "Save Changes" to activate your bot
Step 7: Install Bot
Install your bot in a Towns space and verify it works
Time to see your bot come alive in Towns. If everything worked, your bot will respond to messages!
Install Your Bot
- 1
Go to your space in Towns app
Navigate to Space Settings → Bots
- 2
Install your bot to the space
Find your bot and click install. Choose which channels it can access.
Test Your Bot
Go to a channel where your bot is installed and mention it:
@mybot helloExpected response:
Hello there! 👋🎉 Congratulations!
You've built, customized, and deployed your first Towns Protocol bot!
Your bot is now live and responding in Towns. Keep customizing with AI to add more features!
🔧 Troubleshooting
Bot not responding?
- • Check Render logs for errors
- • Verify environment variables are set correctly
- • Make sure webhook URL ends with /webhook
- • Check bot permissions in Developer Portal
Deployment failed?
- • Check build logs in Render dashboard
- • Verify package.json has correct scripts
- • Make sure all files are committed to GitHub
- • Try redeploying from Render dashboard
Need help?
Join the Towns Developer Town for support, or check the complete documentation in your template's README.md file.
📚 Learn More
Level up your bot building skills with comprehensive courses and tutorials
Now that you've built your first bot, explore the Towns Academy to dive deeper into advanced bot development, learn best practices, and discover new ways to leverage the Towns Protocol.