Features
- ✅ WebSocket long connection (no public IP required)
- ✅ App ID and App Secret authentication
- ✅ Open ID-based access control
- ✅ Private and group message support
- ✅ Optional encryption and verification
Setup
Create a Feishu bot
- Visit Feishu Open Platform
- Click Create App (创建应用)
- Choose Custom App (自建应用)
- Fill in app name and description
- Enable Bot capability (机器人)
Configure permissions
In Permissions & Scopes (权限管理):Add these permissions:
im:message— Send messages (发送消息)im:message.p2p_msg:readonly— Receive private messages (接收私聊消息)
Configure event subscription
In Event Subscriptions (事件订阅):
- Add event:
im.message.receive_v1(接收消息) - Important: Select Long Connection mode (长连接模式)
- Save configuration
Long Connection requires nanobot to be running before events can be received
Get credentials
In Credentials & Basic Info (凭证与基础信息):Copy:
- App ID (format:
cli_xxx) - App Secret
- Encrypt Key (加密密钥)
- Verification Token (验证令牌)
Publish the app
- Go to Version Management & Release (版本管理与发布)
- Create a version and submit for review
- Or publish to internal users only (员工可见)
Configure nanobot
Edit
~/.nanobot/config.json:encryptKey and verificationToken are optional for Long Connection modeConfiguration Options
Enable the Feishu channel
App ID from Feishu Open Platform (format:
cli_xxx)App Secret from Feishu Open Platform
Encrypt Key for message encryption (optional for Long Connection mode)
Verification Token for webhook validation (optional for Long Connection mode)
List of Feishu Open IDs allowed to interact with the botExamples:
- Single user:
["ou_abc123"] - Multiple users:
["ou_abc123", "ou_def456"] - All users:
["*"](not recommended for production)
Find Open IDs in nanobot logs when users message the bot
WebSocket vs Webhook
Understanding connection modes
Understanding connection modes
Feishu supports two ways to receive events:
Long Connection (WebSocket) — Recommended
- ✅ No public IP required
- ✅ No SSL certificate needed
- ✅ Works behind firewall/NAT
- ✅ Simpler setup
- This is what nanobot uses by default
Webhook (HTTP)
- ❌ Requires public IP
- ❌ Requires HTTPS with valid certificate
- ❌ More complex setup
- Only use if you have specific webhook requirements
Troubleshooting
Bot doesn't respond
Bot doesn't respond
- Check permissions: Verify
im:messageandim:message.p2p_msg:readonlyare approved - Check Open ID: Ensure your Open ID is in
allowFrom - Check event subscription: Must be set to Long Connection mode
- Check app status: App must be published (at least to internal users)
- Check logs: Run
nanobot gateway -vfor detailed logs
WebSocket connection fails
WebSocket connection fails
- Verify App ID and App Secret are correct
- Check internet connectivity
- Ensure no firewall blocks WebSocket connections
- Try restarting gateway:
nanobot gateway - Check Feishu Open Platform status
Permission denied errors
Permission denied errors
If you see permission errors:
- Go to Feishu Open Platform → Your App → Permissions
- Verify all required permissions are added and approved
- Some permissions require admin approval
- Wait for approval, then restart gateway
Cannot find Open ID
Cannot find Open ID
To get your Open ID:
- Temporarily set
allowFrom: ["*"] - Restart gateway
- Send a message to the bot
- Check logs — Open ID will be displayed
- Copy the Open ID and add it to
allowFrom - Remove
"*"and restart gateway
Event subscription not working
Event subscription not working
Common issues:
- Webhook mode selected: Change to Long Connection in event settings
- Gateway not running: Start gateway before events can be received
- Event not added: Ensure
im.message.receive_v1is added - App not published: Publish app to at least internal users
Complete Example
Full configuration with all options:Related Pages
Configuration Overview
Learn about channel configuration
Security Settings
Set up access control