Connect Cue to Telegram
Chat with your Cue agent on Telegram — create a bot with BotFather and link it to Cue with copy-paste setup commands.
Use Telegram when you want the fastest DM-first setup for talking to your assistant from macOS or iPhone.
Cue and OpenClaw use separate Telegram config files. Cue reads ~/.cue/config.json or ~/.cue/agents/<agent>/agent.json. OpenClaw uses ~/.openclaw/.
Before You Start
- You need a Telegram account and access to
@BotFather. - Cue Telegram runtime currently runs in the background worker for the target agent.
- For first-time setup, start with DMs. Group setup is possible, but DM validation is shorter and easier to debug.
Fastest Setup
Replace <agent> with the agent you actually run.
If you already use a local dev agent such as main-localhost, use that same agent here.
export TELEGRAM_BOT_TOKEN='<BOT_TOKEN>'
cue --agent <agent> telegram setup \
--token-env TELEGRAM_BOT_TOKEN \
--dm-policy open \
--json
cue --agent <agent> client restart --json
cue --agent <agent> telegram status --validate --json
cue --agent <agent> channel status --provider telegram --jsonWhat you want to see:
telegram statusshowsenabled: truechannel statusshows Telegramrunning: true
Step 1: Create the Bot
In Telegram:
- Open
@BotFather. - Run
/newbot. - Pick a display name and username.
- Copy the bot token.
Treat the token like a password. Do not commit it or paste it into public docs.
Step 2: Configure Cue
The command above is the recommended setup path because it:
- validates the bot token with Telegram
- writes agent-scoped config
- stores the env var name, not the raw token
Non-Interactive CLI
Fastest first test:
cue --agent <agent> telegram setup \
--token-env TELEGRAM_BOT_TOKEN \
--dm-policy open \
--jsonSafer DM allowlist setup:
cue --agent <agent> telegram setup \
--token-env TELEGRAM_BOT_TOKEN \
--dm-policy allowlist \
--dm-user <YOUR_TELEGRAM_USER_ID> \
--jsonUseful follow-up commands:
cue --agent <agent> telegram status --validate --json
cue --agent <agent> channel status --provider telegram --json
cue --agent <agent> client restart --json
cue --agent <agent> telegram disable --jsonEquivalent agent.json
If you prefer to inspect or edit the config directly, Cue writes agent-scoped config into ~/.cue/agents/<agent>/agent.json.
Open DM test setup:
{
"channels": {
"telegram": {
"enabled": true,
"account": {
"botTokenEnv": "TELEGRAM_BOT_TOKEN"
},
"dm": {
"policy": "open"
}
}
}
}Safer allowlist setup:
{
"channels": {
"telegram": {
"enabled": true,
"account": {
"botTokenEnv": "TELEGRAM_BOT_TOKEN"
},
"dm": {
"policy": "allowlist",
"allowFrom": ["<YOUR_TELEGRAM_USER_ID>"]
}
}
}
}Important: enabled: true alone is not enough. dm.policy and group.policy default to disabled unless you set them.
Step 3: Send the First DM
Telegram bots cannot message you first.
You must open the bot chat yourself:
https://t.me/<bot_username>Then:
- Tap
Start - Send
hello
If Telegram search does not find the bot, the direct t.me link is the reliable path.
Step 4: Validate the Runtime
Use these checks:
cue --agent <agent> telegram status --validate --json
cue --agent <agent> channel status --provider telegram --jsonOptional outbound test:
- Send one DM to the bot first.
- Read the chat id from Telegram:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates"- Look for
message.chat.id, then send a test message:
cue --agent <agent> channel send --provider telegram --to <CHAT_ID> --text "telegram outbound test" --jsonGroup Setup
Start with DMs first. When that works:
- Add the bot to a Telegram group
- Enable group policy
- Restart the worker
cue --agent <agent> telegram setup \
--token-env TELEGRAM_BOT_TOKEN \
--dm-policy allowlist \
--dm-user <YOUR_TELEGRAM_USER_ID> \
--group-policy open \
--json
cue --agent <agent> client restart --jsonBy default, Cue requires group activation by:
- mentioning the bot with
@botusername, or - replying to one of the bot's messages
Troubleshooting
channel statussays the worker is unavailable: Runcue --agent <agent> client restart --json. If it still fails, checkcue --agent <agent> auth --json. Backend-connected agents need valid auth before the channel runtime can start.telegram statuslooks right butchannel statusis not running: The config is saved, but the background worker has not restarted with it yet.channel statusbriefly showsruntime_not_initializedright after restart: Wait a moment and runcue --agent <agent> channel status --provider telegram --jsonagain. The worker may still be starting the provider runtime.- Bot exists but you cannot message it:
Open the direct
https://t.me/<bot_username>link and tapStart. - Another tool already uses the same token: Telegram long polling and webhooks cannot both own the same bot token at the same time. Use one consumer only.
- DMs work but groups do not:
Check
group.policyand make sure you mentioned the bot or replied to a bot message.