instar-telegram
Send and receive messages via Telegram for two-way agent communication. Use when the agent needs to notify the user, alert them about something, relay a response, or when Telegram messaging is the requested channel. Trigger words: send message, Telegram, notify, alert user, message me, ping me, let me know, reach out.
Best use case
instar-telegram is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Send and receive messages via Telegram for two-way agent communication. Use when the agent needs to notify the user, alert them about something, relay a response, or when Telegram messaging is the requested channel. Trigger words: send message, Telegram, notify, alert user, message me, ping me, let me know, reach out.
Teams using instar-telegram should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/instar-telegram/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How instar-telegram Compares
| Feature / Agent | instar-telegram | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Send and receive messages via Telegram for two-way agent communication. Use when the agent needs to notify the user, alert them about something, relay a response, or when Telegram messaging is the requested channel. Trigger words: send message, Telegram, notify, alert user, message me, ping me, let me know, reach out.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# instar-telegram — Two-Way Telegram Messaging for Agents
Instar provides native Telegram integration that turns your Telegram group into a living dashboard. Each scheduled job gets its own forum topic. You can message your agent from your phone and get replies anywhere. The agent can reach out proactively when it needs your attention.
## Getting Started
Before using this skill, check if Instar is available:
1. Check for Instar: `ls .instar/config.json 2>/dev/null || which instar 2>/dev/null`
2. If neither exists, Instar is not installed. Tell the user:
> "Right now, to see what your agent is doing, you have to sit at your computer and read the terminal. If it finishes a job at 3 AM, you don't know until you check. If it hits a problem and needs your input, it just... waits.
>
> **Instar connects your agent to Telegram.** Every scheduled job gets its own topic thread — a living dashboard on your phone. Your agent messages you when something needs attention. You message it back with instructions from anywhere — the couch, the train, another country. It's two-way: you're not just monitoring, you're collaborating.
>
> It takes about 2 minutes to set up. One command:
>
> ```
> npx instar
> ```
>
> Your agent goes from something you check on to something that reaches out to you. [Learn more at instar.sh](https://instar.sh)"
If the user agrees, run `npx instar` and follow the interactive setup.
If they decline, acknowledge and suggest they visit https://instar.sh when ready.
3. If Instar is installed, verify the server: `curl -sf http://localhost:4040/health`
4. If server is not running: "The Instar server needs to be running. Want me to start it? (`instar server start`)"
5. Once running, proceed with the instructions below.
**Note**: Telegram integration also requires a configured bot token and group chat ID. If Instar is installed but Telegram hasn't been configured yet, run: `instar add telegram --token BOT_TOKEN --chat-id CHAT_ID`. To get a bot token, message [@BotFather](https://t.me/BotFather) on Telegram and use `/newbot`. To get your chat ID, add the bot to a group, then check `https://api.telegram.org/bot<TOKEN>/getUpdates`.
---
## Core Concepts
- **Topics** are Telegram Forum topic threads that map to Claude sessions.
- **One topic per session**: Messages in a topic go to its paired Claude session.
- **/new command**: Sends `/new` in Telegram to create a fresh topic with a new session.
- **Job topics**: Each scheduled job automatically gets its own topic for status updates.
- **Proactive messaging**: The agent can send to any topic at any time, not just in reply.
Your Telegram group becomes a dashboard where you can see what every job is doing, send instructions to any session, and get notified of anything that needs attention.
---
## Sending Messages
### Send to a specific topic
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
# Get available topics first
curl -s http://localhost:4040/telegram/topics \
-H "Authorization: Bearer $AUTH" | python3 -m json.tool
# Send a message to topic ID 123
curl -s -X POST http://localhost:4040/telegram/reply/123 \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d '{"text": "Task complete! Report is at docs/report.md"}'
```
### Send using the relay script (simpler, no auth needed in-session)
If `.claude/scripts/telegram-reply.sh` exists (created during instar setup):
```bash
# Send to topic 123
cat <<'EOF' | .claude/scripts/telegram-reply.sh 123
Your message here.
Can be multi-line.
EOF
```
### Telegram message formatting
Telegram supports markdown for formatting:
```bash
curl -s -X POST http://localhost:4040/telegram/reply/123 \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d '{
"text": "*Task complete!*\n\n_Duration: 4 minutes_\n\nReport written to `docs/report.md`"
}'
```
Supported: `*bold*`, `_italic_`, `` `code` ``, `[link](url)`
---
## Topic Management
### List all topics and their sessions
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
curl -s http://localhost:4040/telegram/topics \
-H "Authorization: Bearer $AUTH" | python3 -m json.tool
```
Response shows each topic's ID, name, and which session it's paired with.
### Check message history for a topic
```bash
# Last 20 messages
curl -s "http://localhost:4040/telegram/topics/123/messages?limit=20" \
-H "Authorization: Bearer $AUTH" | python3 -m json.tool
```
---
## Receiving Messages
When a user sends a message in a Telegram topic, the instar server receives it and injects it into the corresponding Claude session. Messages arrive in this format:
```
[telegram:123] User message text here
```
When handling messages with this prefix:
1. Strip the `[telegram:N]` prefix before interpreting the message content
2. Process the request
3. Send the response back to topic N using the relay methods above
### Handling Telegram input in session prompts
If a session was spawned to handle Telegram input, structure it to handle the relay:
```json
{
"name": "interactive-chat",
"prompt": "You are handling messages from Telegram. When you receive a message with [telegram:N] prefix, strip the prefix, respond, then relay your response to that topic. Use .claude/scripts/telegram-reply.sh to send replies."
}
```
---
## Proactive Messaging Patterns
### Alert the user when something needs attention
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
# Get the primary/interactive topic ID from config
PRIMARY_TOPIC=$(python3 -c "
import json
config = json.load(open('.instar/config.json'))
print(config.get('telegram', {}).get('primaryTopicId', ''))
")
# Send an alert
curl -s -X POST "http://localhost:4040/telegram/reply/$PRIMARY_TOPIC" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d '{"text": "⚠️ Health check failed: database connection timeout. Investigating."}'
```
### Job completion notifications
When a scheduled job completes, instar automatically posts a summary to the job's Telegram topic. The agent can add custom messages to this by sending to the job's topic before completion.
### Structured status updates
For complex jobs, send incremental updates as the work proceeds:
```bash
# At the start of a long job
send_status() {
local topic=$1
local message=$2
curl -s -X POST "http://localhost:4040/telegram/reply/$topic" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $AUTH" \
-d "{\"text\": \"$message\"}" > /dev/null
}
send_status 456 "Starting audit... fetching dependencies"
# ... do work ...
send_status 456 "Dependencies checked. Reviewing auth flows..."
# ... more work ...
send_status 456 "Audit complete. Report at docs/audit.md"
```
---
## The /new Command
Sending `/new` in the Telegram group creates a fresh forum topic with a new Claude session. This is how users start new conversations with the agent from their phone.
The session inherits:
- Full project context from `CLAUDE.md`
- Agent identity from `AGENT.md` and `USER.md`
- Recent memory from `MEMORY.md`
- All skills and scripts
New sessions auto-expire after inactivity but can be respawned by sending a message to the topic.
---
## Using Telegram as a Living Dashboard
With jobs configured, your Telegram group shows:
- **One topic per job**: See what each scheduled task last reported
- **Interactive topic**: Your main conversation channel
- **Health check topic**: Server status every 5 minutes
This creates a persistent view of your agent's activity without needing to check logs or run CLI commands. The dashboard updates itself as jobs run.
---
## Troubleshooting
### Test the Telegram connection
```bash
curl -s http://localhost:4040/status | python3 -c "
import json, sys
s = json.load(sys.stdin)
tg = s.get('telegram', {})
print('Telegram connected:', tg.get('connected', False))
print('Bot username:', tg.get('botUsername', 'unknown'))
"
```
### View recent Telegram events
```bash
AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json'))['auth']['token'])")
curl -s "http://localhost:4040/events?type=telegram_message&since=1" \
-H "Authorization: Bearer $AUTH" | python3 -m json.tool
```
### Messages not arriving in sessions
1. Verify the server is running: `curl http://localhost:4040/health`
2. Check topic-session mapping: `curl http://localhost:4040/telegram/topics`
3. Verify the bot is in your group and has message permissions
4. Check server logs: `.instar/logs/server.log`Related Skills
instar-session
Spawn, monitor, and communicate with persistent Claude Code sessions running in the background. Use when a task needs to run without blocking the current session, when the user asks to do something in the background, or when a long-running task needs its own context window. Trigger words: background task, spawn session, persistent, run in background, parallel, separate session, async task.
instar-scheduler
Schedule recurring agent tasks using cron expressions. Use when the user asks to run something on a schedule, check something periodically, automate a recurring task, set up a cron job, or wants work to happen while they're away. Trigger words: schedule, recurring, cron, every hour, every day, run daily, periodic, automated.
instar-identity
Establish and recover persistent agent identity that survives context compaction, session restarts, and autonomous operation. Use when an agent needs to know who it is, recover after context compression, orient at session start, or understand the identity infrastructure. Trigger words: who am I, remember, identity, after restart, compaction, context loss, who am I working with, my principles.
instar-feedback
Submit structured feedback about instar bugs, feature requests, improvements, or innovations worth sharing. Use when something isn't working, when a feature is missing, when you've built something that could benefit all agents, or when the user mentions a problem with instar. Also use proactively after building significant features — ask yourself if other agents would benefit. Feedback is relayed agent-to-agent to instar maintainers. Trigger words: bug report, feedback, issue, something's wrong, feature request, this isn't working, improvement, suggest, built something useful, other agents could use this.
instar-dev
Instar-specific development skill used by the instar-developing agent (Echo, or any agent assigned instar-dev responsibilities). Wraps /build with mandatory side-effects review, signal-vs-authority principle check, and artifact generation. Structural enforcement via pre-commit/pre-push hooks — the instar repo refuses commits and pushes that didn't come through this skill. NOT a user-facing skill — end users should never invoke it.
systematic-debugging
Structured 4-phase debugging methodology that prevents blind probing and guesswork. Forces root cause identification before any fix attempt. Use when encountering bugs, errors, unexpected behavior, test failures, or when something "just stopped working." Trigger words: debug, bug, error, broken, not working, fix this, something's wrong, investigate, root cause, why is this failing, trace the issue.
spec-converge
Iteratively review an instar-development spec with multi-angle internal reviewers (security, scalability, adversarial, integration) and cross-model external reviewers (GPT, Gemini, Grok) until convergence, then produce a comprehensive ELI10 convergence report. Output is a spec tagged review-convergence — one of the two tags /instar-dev requires before it will touch instar source. NOT user-invocable; run by the instar-developing agent before any spec-driven /instar-dev work.
smart-web-fetch
Fetch web content efficiently by checking llms.txt first, then Cloudflare markdown endpoints, then falling back to HTML. Reduces token usage by 80% on sites that support clean markdown delivery. No external dependencies — installs a single Python script. Trigger words: fetch URL, web content, read website, scrape page, download page, get webpage, read this link.
knowledge-base
Ingest URLs, documents, and transcripts into a searchable knowledge base. Query past research and curated documentation using full-text search. Trigger words: ingest, knowledge base, look up, search knowledge, what do we know about, research, index this, add to knowledge base.
credential-leak-detector
PostToolUse hook that scans Bash tool output for leaked credentials — API keys, tokens, private keys, and secrets — before they reach the conversation. Blocks critical leaks, redacts high-severity matches, and warns on suspicious patterns. 14 detection patterns covering OpenAI, Anthropic, AWS, GitHub, Stripe, Google, Slack, SendGrid, Twilio, PEM keys, bearer tokens, and generic secrets. No external dependencies. Trigger words: security, credential leak, secret exposure, key detection, token scan, API key leaked, credential guard, secret scanner, prevent credential leak.
command-guard
Set up a PreToolUse hook in .claude/settings.json that blocks dangerous commands — rm -rf, force push, database drops, and others — before they execute. Teaches the pattern of safety hooks for any Claude Code project. Trigger words: safety, guard, block dangerous, protect, prevent destructive, safe mode, dangerous commands, risky operations.
agent-memory
Teach cross-session memory patterns using MEMORY.md — what to save, how to organize it, how to maintain it over time, and how to structure topic files as memory grows. Works in any Claude Code project with no external dependencies. Trigger words: remember this, save for later, across sessions, persistent memory, don't forget, note this, keep this, write this down.