Skip to main content
skill CX Codex

telegram-bot · claude-office-skills — Claude Code skill: bots, alerts, group automation

A skill for building Telegram bots: chatbots, notifications, AI assistants and group automation. Useful when you need message handlers and workflows fast.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add claude-office-skills/skills --skill telegram-bot -a claude-code
Open on GitHub

What telegram-bot does

The skill walks through the full bot lifecycle. Start with @BotFather: /newbot, a name, a username ending in bot, then grab the API token. After that come description, avatar and command list, plus pulling chat.id from getUpdates.

Inside are handler templates for text, commands, photos, documents, voice and location. There are n8n workflows too: a trigger on messages and callback queries, a switch by content type, a model call, and a reply. Voice notes get transcribed with Whisper; images go through a vision model.

Separate sections cover notifications and group work. Alert, build-status and order templates with routing by severity. Welcome messages for new members, spam detection, link filtering and flood control. The skill relies on the telegram-mcp server with telegram_send_message, telegram_get_updates and telegram_send_photo tools — without it some workflows won't run.

What it helps with

  • create a bot and get an API token via @BotFather
  • handle text, photo and voice messages in one flow
  • send build or order alerts routed by severity
  • welcome new group members and filter spam
  • wire up an AI assistant with recent-message memory

Example prompts for the agent

  • Create a Telegram bot: set it up via @BotFather and add /start and /help commands
  • Build a voice message handler that transcribes with Whisper
  • Send build status alerts to the admin group

How to install telegram-bot

1Skills CLI (Vercel)

npx skills add claude-office-skills/skills --skill telegram-bot -a claude-code

2Manually: put the files in place

~/.claude/skills/telegram-bot/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/telegram-bot/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about telegram-bot

How do I install telegram-bot in Claude?

Run npx skills add claude-office-skills/skills --skill telegram-bot -a claude-code. The skill lands in ~/.claude/skills/telegram-bot/SKILL.md.

What does telegram-bot do?

It helps you build Telegram bots: message handlers, AI assistants, notification systems and group automation. Templates for n8n and code examples are included.

What does the skill need to work?

The telegram-mcp server with telegram_send_message, telegram_get_updates and telegram_send_photo tools. Some workflows won't run without it.

Source text

SKILL.md · MIT
---
name: telegram-bot
description: "Telegram bot development - chatbots, notifications, AI assistants, and group automation"
version: "1.0.0"
author: claude-office-skills
license: MIT

category: messaging
tags:
  - telegram
  - bot
  - chatbot
  - automation
  - notifications
department: Engineering

models:
  recommended:
    - claude-sonnet-4

mcp:
  server: telegram-mcp
  tools:
    - telegram_send_message
    - telegram_get_updates
    - telegram_send_photo

capabilities:
  - bot_development
  - message_handling
  - ai_integration
  - notification_system
  - group_management

languages:
  - en
  - zh

related_skills:
  - discord-bot
  - whatsapp-automation
  - ai-agent-builder
  - slack-workflows
---

# Telegram Bot

Build Telegram bots for chatbots, notifications, AI assistants, and group automation. Based on n8n's Telegram workflow templates.

## Overview

This skill covers:
- Bot setup and configuration
- Message handling patterns
- AI-powered assistants
- Notification workflows
- Group automation

---

## Bot Setup

### Creating a Bot

```yaml
setup_steps:
  1. create_bot:
      - open: @BotFather on Telegram
      - command: /newbot
      - provide: bot_name
      - provide: bot_username (must end in 'bot')
      - receive: API_token
      
  2. configure_bot:
      - command: /setdescription
      - command: /setabouttext
      - command: /setuserpic
      - command: /setcommands
      
  3. get_chat_id:
      - start: conversation with bot
      - call: https://api.telegram.org/bot{TOKEN}/getUpdates
      - extract: chat.id from response
```

### Bot Commands

```yaml
commands:
  - command: /start
    description: "Start the bot"
    
  - command: /help
    description: "Show available commands"
    
  - command: /status
    description: "Check system status"
    
  - command: /subscribe
    description: "Subscribe to notifications"
    
  - command: /unsubscribe
    description: "Unsubscribe from notifications"
```

---

## Message Handlers

### Basic Message Handler

```yaml
workflow: "Telegram Message Handler"
trigger: telegram_message

handlers:
  text_message:
    action: |
      1. Parse message text
      2. Determine intent
      3. Process request
      4. Send response
      
  command:
    pattern: "^/"
    action: route_to_command_handler
    
  photo:
    action: |
      1. Download photo
      2. Process with vision AI
      3. Respond with analysis
      
  document:
    action: |
      1. Download document
      2. Extract content
      3. Process and respond
      
  voice:
    action: |
      1. Download audio
      2. Transcribe with Whisper
      3. Process text
      4. Respond (text or voice)
      
  location:
    action: |
      1. Extract coordinates
      2. Lookup local info
      3. Respond with relevant data
```

### n8n Workflow

```yaml
workflow: "Telegram Bot n8n"

nodes:
  - name: "Telegram Trigger"
    type: "n8n-nodes-base.telegramTrigger"
    parameters:
      updates: ["message", "callback_query"]
      
  - name: "Route Message Type"
    type: "n8n-nodes-base.switch"
    parameters:
      rules:
        - output: 0
          condition: "{{ $json.message.text.startsWith('/') }}"
        - output: 1
          condition: "{{ $json.message.photo }}"
        - output: 2
          condition: "{{ $json.message.voice }}"
        - output: 3
          fallback: true
          
  - name: "Process with AI"
    type: "n8n-nodes-base.openAi"
    parameters:
      model: "gpt-4"
      messages:
        - role: "system"
          content: "You are a helpful Telegram assistant."
        - role: "user"
          content: "{{ $json.message.text }}"
          
  - name: "Send Response"
    type: "n8n-nodes-base.telegram"
    parameters:
      chatId: "{{ $json.message.chat.id }}"
      text: "{{ $json.response }}"
```

---

## AI-Powered Bot

### GPT-4 Integration

```yaml
ai_bot:
  name: "AI Assistant Bot"
  
  system_prompt: |
    You are a helpful AI assistant on Telegram.
    
    Guidelines:
    - Be concise (Telegram has message limits)
    - Use emojis appropriately
    - Format with markdown when helpful
    - Ask clarifying questions if needed
    
  features:
    - conversational_memory: true
    - context_window: last_10_messages
    - tools: [web_search, calculator, weather]
    
  message_formatting:
    max_length: 4096
    split_long_messages: true
    use_markdown: true
```

### Multi-Modal Bot

```yaml
multimodal_bot:
  handlers:
    text:
      model: gpt-4
      action: chat_completion
      
    image:
      model: gpt-4-vision
      action: analyze_and_respond
      
    voice:
      transcribe: whisper
      process: gpt-4
      respond: text_or_voice
      
    document:
      extract: based_on_type
      summarize: gpt-4
      respond: text
```

---

## Notification System

### Alert Bot

```yaml
workflow: "System Alert Bot"

triggers:
  - source: monitoring_system
    event: alert
  - source: ci_cd
    event: build_status
  - source: ecommerce
    event: new_order
    
notification_templates:
  alert:
    format: |
      🚨 *Alert: {severity}*
      
      *Service:* {service}
      *Message:* {message}
      *Time:* {timestamp}
      
      [View Dashboard]({dashboard_link})
      
  build:
    format: |
      {status_emoji} *Build {status}*
      
      *Project:* {project}
      *Branch:* {branch}
      *Commit:* `{commit_short}`
      
      {details}
      
  order:
    format: |
      🛒 *New Order!*
      
      *Order:* #{order_id}
      *Customer:* {customer}
      *Total:* ${total}
      *Items:* {item_count}
      
routing:
  by_severity:
    critical: [admin_group, on_call_user]
    warning: [team_group]
    info: [logging_channel]
```

### Scheduled Notifications

```yaml
scheduled_notifications:
  daily_digest:
    schedule: "9am daily"
    template: |
      📊 *Daily Summary - {date}*
      
      📈 Sales: ${sales} ({change})
      👥 New users: {new_users}
      🎫 Open tickets: {tickets}
      
      Have a great day! ☀️
      
  weekly_report:
    schedule: "Monday 9am"
    template: weekly_metrics_report
    
  reminder:
    trigger: custom_event
    template: |
      ⏰ *Reminder*
      
      {reminder_text}
      
      Scheduled by: {creator}
```

---

## Group Automation

### Welcome Bot

```yaml
group_bot:
  on_member_join:
    action: |
      1. Check if new member
      2. Send welcome message
      3. Share rules
      4. Suggest introduction
      
    template: |
      👋 Welcome to {group_name}, {user_name}!
      
      Please:
      1. Read the /rules
      2. Introduce yourself
      3. Ask questions anytime!
      
      Enjoy your stay! 🎉
      
  on_member_leave:
    action: optional_goodbye
    
  moderation:
    - spam_detection: auto_delete + warn
    - link_filtering: whitelist_only
    - flood_control: rate_limit
```

### Poll & Survey Bot

```yaml
poll_bot:
  commands:
    /poll:
      format: "/poll Question | Option1 | Option2 | ..."
      action: create_poll
      
    /survey:
      action: start_multi_question_survey
      
    /results:
      action: show_aggregated_results
      
  features:
    - anonymous_voting: optional
    - multiple_choice: optional
    - scheduled_close: optional
    - export_results: to_sheets
```

---

## Inline Features

### Inline Keyboard

```yaml
inline_keyboard:
  example:
    text: "Choose an option:"
    keyboard:
      - row:
          - text: "Option 1"
            callback_data: "opt_1"
          - text: "Option 2"
            callback_data: "opt_2"
      - row:
          - text: "Cancel"
            callback_data: "cancel"
            
  callback_handler:
    opt_1:
      action: process_option_1
      response: "You selected Option 1"
      
    opt_2:
      action: process_option_2
      response: "You selected Option 2"
      
    cancel:
      action: cancel_operation
      response: "Operation cancelled"
```

### Inline Query

```yaml
inline_mode:
  trigger: "@botname query"
  
  results:
    - type: article
      title: "{query} result"
      description: "Click to send"
      message_text: "Result for: {query}"
      
    - type: photo
      photo_url: "{search_result_image}"
      
    - type: gif
      gif_url: "{gif_url}"
```

---

## Output Example

**Request**: "Create a Telegram notification bot for server alerts"

**Output**:

```markdown
# Server Alert Telegram Bot

## Setup

1. Create bot with @BotFather
2. Get token: `123456:ABC-DEF...`
3. Get chat ID for alerts channel

## n8n Workflow

```yaml
nodes:
  1. Webhook (receives alerts)
  2. Format Message
  3. Telegram Send
```

## Alert Templates

**Critical Alert:**
```
🚨 CRITICAL ALERT

Server: production-web-01
Status: DOWN
Time: 2026-01-30 14:32:05 UTC

Details:
- CPU: 98%
- Memory: 95%
- Disk: 89%

[View Grafana] [Acknowledge]
```

**Recovery:**
```
✅ RECOVERED

Server: production-web-01
Downtime: 5 minutes
Status: All systems normal

Incident resolved automatically.
```

## Implementation

```javascript
// Send alert function
async function sendAlert(severity, message, details) {
  const emoji = {
    critical: '🚨',
    warning: '⚠️',
    info: 'ℹ️',
    success: '✅'
  };
  
  const text = `${emoji[severity]} *${severity.toUpperCase()}*\n\n${message}\n\n${details}`;
  
  await telegram.sendMessage({
    chat_id: ALERT_CHANNEL_ID,
    text: text,
    parse_mode: 'Markdown'
  });
}
```

## Features
- Severity-based routing
- Inline action buttons
- Acknowledgment tracking
- Escalation rules
```

---

*Telegram Bot Skill - Part of Claude Office Skills*

© claude-office-skills · MIT · claude-office-skills/skills

Similar skills

SKILL.md skills catalog →

telegram-bot by other authors comes first.

From the same set109

whatsapp-automation This skill covers WhatsApp Business support, chatbots, order notifications, and broadcast messaging for agent-driven workflows. CX Codex +1 6,500installs xlsx-manipulation A skill that builds and edits Excel files from code: creates .xlsx workbooks with openpyxl, adds formulas, formatting and charts. CX Codex +1 6,500installs google-ads-manager Helps plan Google Ads campaigns, group search keywords, write RSA ad copy, and prepare reporting. Useful when organizing paid search workflows. CX Codex +1 6,300installs airtable-automation Gives an agent patterns for Airtable base design, views, formulas and automation flows. Use it when tasks, projects or n8n workflows need a clear data structure. CX Codex +1 6,200installs academic-search Builds academic search strategies, reviews supplied papers and abstracts, and helps synthesize findings. Use it when planning a literature review or assessing research methods. CX Codex +1 6,100installs docx-manipulation The skill builds and edits Word files through python-docx: headings, tables, images, headers. Useful when a report or contract has to come out of code. CX Codex +1 6,100installs calendar-automation Automates Google Calendar and Outlook workflows: allocates focus time blocks, sends morning Slack briefings, and prepares meeting notes with context. CX Codex +1 6,100installs pdf-to-docx Turns PDF files into editable Word documents with the pdf2docx library. Useful when a report or contract needs changes, not just reading. CX Codex +1 6,000installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor