ericrisco/rsc-harness / skills/whatsapp-telegram
whatsapp-telegram
VerifiedUse when wiring an app or agent to message customers over the WhatsApp Cloud API or a Telegram bot — order updates, OTP codes, reminders, alerts and broadcasts — or when debugging undelivered messages, 24-hour-window errors, rejected templates, webhook signature verification, or rate limits and their retry headers. NOT the reply content you send (that is `customer-support`).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.6 KB |
| evals/README.md | markdown | 804 B |
| evals/cases.yaml | config | 3.0 KB |
| references/telegram-bot-api.md | markdown | 3.4 KB |
| references/whatsapp-cloud-api.md | markdown | 4.5 KB |
| scripts/verify.shexecutable | script | 3.8 KB |
references/telegram-bot-api.md
View on GitHub# Telegram Bot API reference
Base: `https://api.telegram.org/bot${TG_TOKEN}/<METHOD>`. Token from @BotFather, kept in env. Bot API 10.0 (2026-05-08). Facts accessed 2026-06-02.
## Messaging method catalog
| Method | Use |
| --- | --- |
| `sendMessage` | Text (≤4096 chars), `parse_mode`, `reply_markup`. |
| `sendPhoto` | Photo by `photo` URL/file_id, `caption` ≤1024. |
| `sendDocument` | Arbitrary file. |
| `sendMediaGroup` | 2–10 items as an album. |
| `editMessageText` | Edit a previously sent message (good for live status). |
| `deleteMessage` | Remove a message. |
| `answerCallbackQuery` | Acknowledge an inline-button tap (call within seconds or the client shows a spinner). |
| `setMyCommands` | Register the `/` command menu. |
Successful responses are `{ "ok": true, "result": {...} }`. Capture `result.message_id`.
## MarkdownV2 escaping
In `parse_mode=MarkdownV2`, escape these reserved chars with `\` everywhere they are literal text:
```
_ * [ ] ( ) ~ ` > # + - = | { } . !
```
```ts
const escapeMdV2 = (s: string) => s.replace(/[_*[\]()~`>#+\-=|{}.!]/g, "\\$&");
```
Inside `pre`/`code` entities only `` ` `` and `\` need escaping. When in doubt for dynamic text, use `parse_mode=HTML` (escape only `< > &`).
## 4096-char chunking
```ts
function chunk(text: string, max = 4096): string[] {
const out: string[] = [];
for (let i = 0; i < text.length; i += max) out.push(text.slice(i, i + max));
return out;
}
```
## Rate limits + 429 backoff
- ~30 msg/s broadcast across chats; ~1 msg/s to the same chat.
- 429 body: `{ "ok": false, "error_code": 429, "parameters": { "retry_after": 5 } }`. Sleep `retry_after` seconds, retry.
- Paid Broadcasts (enable via @BotFather): up to 1000 msg/s, 0.1 Telegram Stars per message above the free tier.
```ts
async function call(method: string, payload: object, tries = 5): Promise<any> {
for (let i = 0; i < tries; i++) {
const res = await fetch(`https://api.telegram.org/bot${process.env.TG_TOKEN}/${method}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
const json = await res.json();
if (json.ok) return json.result;
if (json.error_code === 429) {
await new Promise((r) => setTimeout(r, (json.parameters?.retry_after ?? 1) * 1000));
continue;
}
throw new Error(`Telegram ${method}: ${json.error_code} ${json.description}`);
}
throw new Error(`Telegram ${method}: rate-limited after ${tries} tries`);
}
```
## Inbound: setWebhook XOR getUpdates (never both)
### setWebhook
```bash
curl -sS "https://api.telegram.org/bot${TG_TOKEN}/setWebhook" \
-d url=https://example.com/tg \
-d secret_token=$(openssl rand -hex 16) \
--data-urlencode 'allowed_updates=["message","callback_query"]' \
-d max_connections=40
```
Telegram echoes the `secret_token` in the `X-Telegram-Bot-Api-Secret-Token` request header on each update — compare it and reject mismatches. `max_connections` range 1–100, default 40. `allowed_updates` filters update types.
### getUpdates (long-poll, dev / single instance)
```ts
let offset = 0;
for (;;) {
const updates = await call("getUpdates", { offset, timeout: 30 });
for (const u of updates) {
offset = u.update_id + 1; // ack: advance past processed updates
// handle u.message / u.callback_query
}
}
```
Calling `getUpdates` while a webhook is set returns an error — `deleteWebhook` first. Run exactly one delivery mode.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |