AI-first Telegram bot for NEAR Intents flows with approval-gated actions in chat. Bolton is a trading assistant: it reads balances/market context, prepares actions, and executes only after explicit user approval in Telegram.
- Node.js 20+
- pnpm 9+
- A Telegram bot token from BotFather
- A funded NEAR keypair for bot wallet operations
pnpm installThe bot reads env from .env (via dotenv/config).
BOT_TOKEN- Telegram bot token.
WALLET_PRIVATE_KEY- NEAR ed25519 private key string (
ed25519:...).
- NEAR ed25519 private key string (
- One allowlist setting is required:
TELEGRAM_USER_ID(single user), orTELEGRAM_USER_IDS(comma-separated users)
AI_PROVIDER= one of:openaianthropicgooglexainear
- Model selection (at least one is required):
- Generic:
AI_MODEL - Provider-specific (preferred):
AI_OPENAI_MODELAI_ANTHROPIC_MODELAI_GOOGLE_MODELAI_XAI_MODELAI_NEAR_MODEL
- Generic:
- Provider API key for the selected
AI_PROVIDER:OPENAI_API_KEYforopenaiANTHROPIC_API_KEYforanthropicGEMINI_API_KEYforgoogleXAI_API_KEYforxaiNEAR_AI_KEYfornear
DEFUSE_JWT_TOKEN- Optional auth token for OneClick API client configuration.
- If not set, SDK runs without explicit token injection.
BOT_TOKEN=...
WALLET_PRIVATE_KEY=ed25519:...
TELEGRAM_USER_IDS=123456789,987654321
DEFUSE_JWT_TOKEN=...
AI_PROVIDER=openai
AI_OPENAI_MODEL=gpt-5-mini
OPENAI_API_KEY=...pnpm devpnpm typecheckpnpm buildpnpm build && pnpm startpnpm start runs node dist/bot.mjs.
Bolton exposes these slash commands:
/start- welcome and quickstart guide/new- start a new chat and clear AI conversation context/balances- show wallet balances/help- show command help
All other actions should be requested in natural language (for example: "swap 10 USDC to ETH").
- Use
TELEGRAM_USER_IDSinstead of a public bot to keep access restricted. - Use provider-specific model env var (for clarity) instead of only
AI_MODEL. - Keep one dedicated wallet key per environment (dev/stage/prod).
- Rotate secrets if they were ever committed or shared.
- Action tools (swap/withdraw/transfer/DCA create/stop) require user approval in chat.
- View tools (balances/tokens/deposit address/DCA list) execute directly.