telegram-send

Telegram DM sending from CSV, rate limiting, idempotency

33 stars

Best use case

telegram-send is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Telegram DM sending from CSV, rate limiting, idempotency

Teams using telegram-send 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

$curl -o ~/.claude/skills/telegram-send/SKILL.md --create-dirs "https://raw.githubusercontent.com/aAAaqwq/AGI-Super-Team/main/skills/telegram-send/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/telegram-send/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How telegram-send Compares

Feature / Agenttelegram-sendStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Telegram DM sending from CSV, rate limiting, idempotency

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

# Telegram Send

> Sending messages via Telegram (Telethon) with CSV input

## When to use

- "send via telegram"
- "message everyone through telegram"
- "telegram campaign"
- When `preferred_channel = Telegram` in data

## Dependencies

- Python 3, Telethon, python-dotenv
- Active Telegram session

## Paths

| What | Path |
|------|------|
| Tool | `$TG_TOOLS_PATH/tools/tg_send.py` |
| Shared lib | `$TG_TOOLS_PATH/tg_utils/` |
| Telegram Session | `$SALES_PATH/telegram/sessions/telegram_session.session` |
| ENV | `$SALES_PATH/.env` |
| Send Log | `$TG_TOOLS_PATH/data/send_log.json` |

## How to run

### Step 1: Prepare CSV

Claude prepares CSV with recipients. Minimum columns:

```csv
key,name,phone,username,message
p-001,Alice,+380XXXXXXXXX,,Hello Alice! Message text.
p-002,Ruslan,,,Nizami_ua,Hello Ruslan!
```

Or without the `message` column -- then use the `--message` template.

### Step 2: Dry-run (verification)

```bash
python3 $TG_TOOLS_PATH/tools/tg_send.py \
    --input contacts.csv --dry-run
```

Or with a template:
```bash
python3 $TG_TOOLS_PATH/tools/tg_send.py \
    --input contacts.csv --message "Hello, {name}! Text." --dry-run
```

### Step 3: Send

```bash
python3 $TG_TOOLS_PATH/tools/tg_send.py \
    --input contacts.csv --send

# Or test on the first contact:
python3 $TG_TOOLS_PATH/tools/tg_send.py \
    --input contacts.csv --send --test 1
```

## Parameters

| Parameter | Description | Default |
|-----------|-------------|---------|
| `--input FILE` | CSV file (or `-` for stdin) | required |
| `--message TMPL` | Message template with `{name}` | - |
| `--message-file FILE` | Template from file | - |
| `--dry-run` | Preview only | true (default) |
| `--send` | Actual sending | false |
| `--test N` | Send only to first N | - |
| `--max N` | Max number of messages | - |
| `--cold` | Limits for cold outreach (5/day, batch pauses) | false |
| `--delay MIN MAX` | Override delay (sec) | 20 60 |
| `--status` | Show send log | - |
| `--reset-log` | Reset log | - |
| `--reset-cooldown` | Reset flood cooldown | - |
| `--key-col NAME` | Column for idempotency | key |
| `--name-col NAME` | Column for name | name |
| `--phone-col NAME` | Column for phone | phone |
| `--user-col NAME` | Column for username | username |
| `--msg-col NAME` | Column for message | message |

## Architecture

**Claude (LLM) is responsible for:** selecting recipients, composing text, generating CSV, interpreting results, updating CRM.

**tg-send is responsible for:** Telegram session, phone normalization, message delivery, rate limiting, idempotency, flood handling.

### Shared library (`tg_utils/`)

| Module | Purpose |
|--------|---------|
| `auth.py` | Connecting to Telegram, loading credentials |
| `phone.py` | Phone normalization (UA/PL/IE/US) |
| `rate_limit.py` | Delays, batch pauses, flood cooldown |
| `send_log.py` | Send log (idempotency) |
| `contacts.py` | Entity resolution (username/phone), ImportContactsRequest |
| `output.py` | JSON-line output for composition |

## Rate Limiting

| Mode | Delay | Limit/day | Batch pause |
|------|-------|-----------|-------------|
| Warm (default) | 20-60s | 35 | - |
| Cold (`--cold`) | 30-60s | 5 | 30min every 3 |

## Output

Stdout: JSON lines (for pipe/composition):
```json
{"event":"send","status":"ok","key":"p-001","target":"@user","name":"Alice","ts":"..."}
{"event":"summary","sent":5,"failed":1,"skipped":2,"ts":"..."}
```

Stderr: human-readable progress.

## Limitations

- Not all phone numbers are registered on Telegram
- Privacy settings can block (UserPrivacyRestrictedError)
- FloodWaitError = 24h cooldown, PeerFloodError = 48h cooldown
- Temporary contacts are automatically removed after sending

## Troubleshooting

| Problem | Solution |
|---------|----------|
| FloodWaitError | Automatic 24h cooldown. `--reset-cooldown` to reset |
| PeerFloodError | 48h cooldown. Wait or `--reset-cooldown` |
| SessionExpired | `telegram-session` |
| UserPrivacyRestrictedError | Person has blocked DMs |
| "Not authorized" | Need QR login via `tg-auth` |

## Related skills

- `telegram-check` -- checking replies
- `telegram-session` -- if session is broken
- `email-send-direct` -- single email
- `email-send-bulk` -- mass email sending
- `whatsapp-send` -- alternative channel

## Related tools

All Telegram tools: `$TG_TOOLS_PATH/tools/`
- `tg-auth` -- session, QR login
- `tg-contacts` -- export/import contacts, lookup
- `tg-groups` -- groups, posting, members
- `tg-scrape` -- channel search, scraping

Related Skills

whatsapp-send

33
from aAAaqwq/AGI-Super-Team

Baileys WhatsApp message sending

video-merge-send

33
from aAAaqwq/AGI-Super-Team

合并多个分段视频为一个完整视频,并发送到飞书。使用ffmpeg拼接视频片段,支持淡入淡出转场。触发场景:用户需要合并视频片段、拼接分镜视频、视频合并后发飞书、把多个短视频合成一个、分段视频合并发送。配合 jimeng-storyboard skill 使用,完成数字人视频全流程。

telegram-session

33
from aAAaqwq/AGI-Super-Team

Create/update Telethon session

telegram-scraper-run

33
from aAAaqwq/AGI-Super-Team

Automatic Telegram scraping

telegram-scrape

33
from aAAaqwq/AGI-Super-Team

Search Telegram channels, read posts, ad contacts

telegram-push

33
from aAAaqwq/AGI-Super-Team

通过独立 Telegram Bot 向群聊或私聊推送消息,适合不依赖 OpenClaw channel 配置的通知场景。

telegram-inbound-run

33
from aAAaqwq/AGI-Super-Team

Automatic inbound Telegram message processing

telegram-groups

33
from aAAaqwq/AGI-Super-Team

Posting, members, Telegram group management

telegram-contacts

33
from aAAaqwq/AGI-Super-Team

Export/import/lookup Telegram contacts

telegram-check

33
from aAAaqwq/AGI-Super-Team

Check inbound Telegram messages

telegram-automation

33
from aAAaqwq/AGI-Super-Team

Automate Telegram tasks via Rube MCP (Composio): send messages, manage chats, share photos/documents, and handle bot commands. Always search tools first for current schemas.

sendgrid-automation

33
from aAAaqwq/AGI-Super-Team

Automate SendGrid email operations including sending emails, managing contacts/lists, sender identities, templates, and analytics via Rube MCP (Composio). Always search tools first for current schemas.