@clavion/adapter-telegram) for interacting with ISCL Core through Telegram chat.
Overview
The Telegram bot is a Domain A adapter built with grammY. It provides a conversational interface for requesting crypto operations: transfers, swaps, approvals, and balance checks. The bot renders inline approval keyboards so the operator can approve or deny transactions directly in the chat.How it works
- Sends
approve-requestto ISCL Core (which blocks waiting for approval) - Polls
/v1/approvals/pendingto find the pending request ID - Renders an inline keyboard with Approve/Deny buttons
- On user tap, calls
/v1/approvals/:id/decide - The blocked
approve-requestresolves with an approval token - Calls
sign-and-sendwith the token
Prerequisites
- ISCL Core running with
ISCL_APPROVAL_MODE=web(required — the bot uses web approval) - A Telegram bot token from @BotFather
- A wallet address imported into the ISCL keystore
- Node.js 20+
Setup
/newbot and follow the prompts to name your bot7123456789:AAH1234567890abcdef...TELEGRAM_BOT_TOKENtransfer - Transfer ERC-20 tokens
send - Send native ETH
swap - Swap tokens via DEX
approve - Approve ERC-20 spending
balance - Check wallet balance
status - Check ISCL Core status
help - Show available commands
/start)https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates"chat": { "id": 123456789 } in the responseISCL_TELEGRAM_ALLOWED_CHATSTELEGRAM_BOT_TOKENISCL_WALLET_ADDRESSISCL_API_URLhttp://127.0.0.1:3100ISCL_CHAIN_ID8453 (Base)ISCL_TELEGRAM_ALLOWED_CHATSISCL_TIMEOUT_MS30000If
ISCL_TELEGRAM_ALLOWED_CHATS is empty, the bot accepts commands from any chat. Always set this in production.The Telegram bot requires web approval mode because it uses the HTTP approval API to submit decisions:
cd packages/adapter-telegram
TELEGRAM_BOT_TOKEN=7123456789:AAH1234... \
ISCL_WALLET_ADDRESS=0xYourWalletAddress \
ISCL_TELEGRAM_ALLOWED_CHATS=123456789 \
ISCL_CHAIN_ID=8453 \
npx tsx src/index.ts
Bot commands
/transfer
Transfer ERC-20 tokens.- Build a TxIntent with
action.type: "transfer" - Send to ISCL Core for approval
- Show an inline keyboard: [Approve] [Deny]
- On approval, sign and broadcast
- Report the transaction hash
/send
Transfer native ETH./swap
Swap tokens via DEX.ONEINCH_API_KEY is configured on Core).
/approve
Approve ERC-20 spending allowance./balance
Check wallet balance./status
Check ISCL Core status (health endpoint).Approval flow
When a transaction command is sent, the bot renders an inline keyboard:- Only the user who initiated the transaction can tap Approve/Deny (same-sender check)
- Each approval keyboard is tied to a specific request ID
- Expired requests (>300s TTL) cannot be approved
- Tapping Approve triggers
sign-and-send; Deny cancels the pipeline
Authentication
Allowed Chat IDs
SetISCL_TELEGRAM_ALLOWED_CHATS to restrict which chats can use the bot:
Same-Sender Enforcement
Callback queries (button taps) are verified against the original command sender. If user A sends/transfer and user B taps Approve, the bot rejects B’s tap with “Only the transaction initiator can decide.”
Running in Docker
Add the Telegram bot as a service in your Docker Compose:Multi-chain usage
SetISCL_CHAIN_ID to change the default chain:
| Chain | ID | Command |
|---|---|---|
| Ethereum | 1 | ISCL_CHAIN_ID=1 |
| Optimism | 10 | ISCL_CHAIN_ID=10 |
| Arbitrum | 42161 | ISCL_CHAIN_ID=42161 |
| Base | 8453 | ISCL_CHAIN_ID=8453 (default) |
ISCL_RPC_URL_{chainId} is configured on ISCL Core.
Troubleshooting
Bot doesn’t respond
- Check that
TELEGRAM_BOT_TOKENis correct (test withcurl https://api.telegram.org/bot<TOKEN>/getMe) - Check that your chat ID is in
ISCL_TELEGRAM_ALLOWED_CHATS - Check bot logs for errors
”Transaction expired or not found”
The approval TTL is 300 seconds. If you wait too long to tap Approve/Deny, the request expires. Submit the command again.ISCL Core connection errors
Verify Core is running and reachable:http://iscl-core:3100), not localhost.
”Only the transaction initiator can decide”
Someone other than the command sender tried to tap the approval button. Only the original sender can approve or deny.References
- Configuration Reference — All environment variables
- API Reference — Endpoints used by the bot
- Web Approval UI — Web-based approval dashboard
- Multi-Chain Operations — Chain configuration