$npx -y skills add whatnickcodes/clappie --skill telegram-botTelegram bot integration for receiving messages and reactions. Use when setting up Telegram webhooks or managing Telegram bot configuration.
| 1 | # Telegram Bot Skill |
| 2 | |
| 3 | Telegram bot integration for receiving messages/reactions and spawning sidekicks. |
| 4 | |
| 5 | ## Setup |
| 6 | |
| 7 | ### 1. Create Bot with BotFather |
| 8 | |
| 9 | 1. Open Telegram, search for [@BotFather](https://t.me/BotFather) |
| 10 | 2. Send `/newbot` and follow prompts |
| 11 | 3. Copy the **bot token** (looks like `123456789:ABCdefGHIjklMNOpqrsTUVwxyz`) |
| 12 | |
| 13 | ### 2. Get Your User ID |
| 14 | |
| 15 | 1. Search for [@userinfobot](https://t.me/userinfobot) in Telegram |
| 16 | 2. Send any message - it replies with your user ID (a number like `YOUR_USER_ID`) |
| 17 | |
| 18 | ### 3. Add to .env |
| 19 | |
| 20 | ```bash |
| 21 | TELEGRAM_BOT_TOKEN=your-bot-token-from-botfather |
| 22 | TELEGRAM_WEBHOOK_SECRET=any-random-secret-string-you-make-up |
| 23 | ``` |
| 24 | |
| 25 | The `TELEGRAM_WEBHOOK_SECRET` can be anything - it's used to verify webhooks are from Telegram. |
| 26 | |
| 27 | ### 4. Configure Settings |
| 28 | |
| 29 | ```bash |
| 30 | # Enable the bot |
| 31 | echo "true" > recall/settings/telegram-bot/enabled.txt |
| 32 | |
| 33 | # Allow your Telegram user ID |
| 34 | echo "YOUR_USER_ID" > recall/settings/telegram-bot/users.txt |
| 35 | |
| 36 | # Enable incoming messages |
| 37 | mkdir -p recall/settings/telegram-bot/webhooks |
| 38 | echo "true" > recall/settings/telegram-bot/webhooks/incoming-message.txt |
| 39 | ``` |
| 40 | |
| 41 | ### 5. Start Sidekick Server |
| 42 | |
| 43 | ```bash |
| 44 | clappie background start sidekicks |
| 45 | ``` |
| 46 | |
| 47 | ### 6. Expose via Tailscale Funnel |
| 48 | |
| 49 | **Telegram only allows ports 80, 88, 443, or 8443.** Use Tailscale Funnel to proxy: |
| 50 | |
| 51 | ```bash |
| 52 | # Expose port 7777 on HTTPS (Tailscale handles certs) |
| 53 | tailscale funnel 7777 |
| 54 | ``` |
| 55 | |
| 56 | This gives you a URL like `https://your-machine.tail1234.ts.net` |
| 57 | |
| 58 | ### 7. Set Webhook URL |
| 59 | |
| 60 | Get your webhook path and set the webhook: |
| 61 | |
| 62 | ```bash |
| 63 | # Get the webhook path |
| 64 | WEBHOOK_PATH=$(cat recall/settings/telegram-bot/webhook-path.txt) |
| 65 | |
| 66 | # Set webhook with Telegram (IMPORTANT: include secret_token!) |
| 67 | curl -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/setWebhook" \ |
| 68 | -d "url=https://your-machine.tail1234.ts.net/webhooks/telegram-bot/${WEBHOOK_PATH}" \ |
| 69 | -d "secret_token=${TELEGRAM_WEBHOOK_SECRET}" |
| 70 | ``` |
| 71 | |
| 72 | **Critical:** The `secret_token` parameter must match your `TELEGRAM_WEBHOOK_SECRET` env var, or signature verification will fail. |
| 73 | |
| 74 | ### 8. Verify Webhook |
| 75 | |
| 76 | ```bash |
| 77 | curl "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getWebhookInfo" |
| 78 | ``` |
| 79 | |
| 80 | Should show your URL with `pending_update_count: 0` and no errors. |
| 81 | |
| 82 | ## Settings |
| 83 | |
| 84 | All settings in `recall/settings/telegram-bot/`: |
| 85 | |
| 86 | | File | Description | Required | |
| 87 | |------|-------------|----------| |
| 88 | | `enabled.txt` | Set to `true` to enable | Yes | |
| 89 | | `webhook-path.txt` | Secret URL segment (auto-generated) | Auto | |
| 90 | | `users.txt` | Allowed Telegram user IDs (one per line) | Yes | |
| 91 | | `webhooks/incoming-message.txt` | Enable incoming messages | Yes | |
| 92 | | `sidekick-prompt.txt` | Custom prompt/personality for sidekicks (overrides skill defaults) | No | |
| 93 | |
| 94 | ## CLI Commands |
| 95 | |
| 96 | ```bash |
| 97 | clappie telegram send <chatId> <message> # Send text message |
| 98 | clappie telegram photo <chatId> <path> # Send photo |
| 99 | clappie telegram document <chatId> <path> # Send document |
| 100 | clappie telegram voice <chatId> <path> # Send voice message |
| 101 | clappie telegram video <chatId> <path> # Send video |
| 102 | clappie telegram sticker <chatId> <id> # Send sticker |
| 103 | clappie telegram react <chatId> <msgId> <emoji> # React to message |
| 104 | clappie telegram webhook <url> # Set webhook URL |
| 105 | clappie telegram webhook-info # Get webhook status |
| 106 | clappie telegram me # Get bot info |
| 107 | ``` |
| 108 | |
| 109 | ## Sidekick Extension Commands |
| 110 | |
| 111 | When a Telegram sidekick is running, these extra commands are available (registered via `sidekickCommands` in `webhooks/send.js`). The sidekick ID is auto-detected from the `CLAPPIE_SIDEKICK_ID` env var -- no need to type it. Explicit ID still works as an override. |
| 112 | |
| 113 | ```bash |
| 114 | clappie sidekick react <msgId> 👍 # React to a message |
| 115 | clappie sidekick combo <msgId> 👍 🔥 🎉 # Sequential reaction combo |
| 116 | clappie sidekick sticker <setName> [index] # Send sticker from set |
| 117 | clappie sidekick sticker <setName> random # Random sticker from set |
| 118 | clappie sidekick send-file photo "/path" "caption" |
| 119 | clappie sidekick send-file document "/path" "caption" |
| 120 | clappie sidekick send-file voice "/path" |
| 121 | clappie sidekick send-file video "/path" "caption" |
| 122 | ``` |
| 123 | |
| 124 | These are only available to sidekicks with `source: telegram-bot`. Internal sidekicks or Slack sidekicks can't use them. |
| 125 | |
| 126 | ## Reactions |
| 127 | |
| 128 | When a user reacts to a message, the sidekick receives: |
| 129 | ``` |
| 130 | [Reacted with 👍] |
| 131 | ``` |
| 132 | |
| 133 | Direct CLI (not sidekick): |
| 134 | ```bash |
| 135 | clappie telegram react YOUR_USER_ID 123 👍 |
| 136 | ``` |
| 137 | |
| 138 | ## How It Works |
| 139 | |
| 140 | 1. User sends message to bot |
| 141 | 2. Telegram POSTs to `/webhooks/telegram-bot/{webhook-path}` |
| 142 | 3. Server verifies `X-Telegram-Bot-Api-Secret-Token` header matches `TELEGRAM_WEBHOOK_SECRET` |
| 143 | 4. Handler parses message, downloads any attachments |
| 144 | 5. Sidekick spawns with message content |
| 145 | 6. Claude can reply via `clappie sidekick send`, `cl |