Get the FREE Ultimate OpenClaw Setup Guide →

telegram-init

npx machina-cli add skill lycfyi/community-agent-plugin/telegram-init --openclaw
Files (1)
SKILL.md
2.0 KB

telegram-init

Initialize Telegram connection and configure sync settings.

Trigger Phrases

  • "set up Telegram"
  • "configure Telegram"
  • "initialize Telegram"
  • "connect Telegram"
  • "telegram init"

Description

This skill initializes your Telegram connection by:

  1. Validating your Telegram API credentials
  2. Testing the session string authentication
  3. Listing all accessible groups and channels
  4. Optionally setting a default group for other commands

Prerequisites

Before using this skill, you must:

  1. Get API credentials from https://my.telegram.org/apps

    • Log in with your phone number
    • Create an application
    • Note your API_ID and API_HASH
  2. Generate a session string using:

    python ${CLAUDE_PLUGIN_ROOT}/scripts/generate_session.py
    

    This will prompt for your phone number and verification code.

  3. Add credentials to .env:

    TELEGRAM_API_ID=your_api_id
    TELEGRAM_API_HASH=your_api_hash
    TELEGRAM_SESSION=your_session_string
    

Usage

Basic initialization:

python ${CLAUDE_PLUGIN_ROOT}/tools/telegram_init.py

Set a specific group as default:

python ${CLAUDE_PLUGIN_ROOT}/tools/telegram_init.py --group 1234567890

Output

  • Lists all accessible groups with ID, type, and member count
  • Updates config/agents.yaml with Telegram settings
  • Displays next steps for syncing messages

Warning

Using a user token may violate Telegram's Terms of Service. This tool is intended for personal use only:

  • Archiving your own conversations
  • Analyzing communities you actively participate in

Use at your own risk.

Exit Codes

  • 0 - Success
  • 1 - Authentication error (invalid/expired session)
  • 2 - Configuration error (missing credentials)

Related Skills

  • telegram-list - List groups and topics
  • telegram-sync - Sync messages to local storage
  • telegram-read - Read synced messages

Source

git clone https://github.com/lycfyi/community-agent-plugin/blob/main/plugins/telegram-connector/skills/telegram-init/SKILL.mdView on GitHub

Overview

telegram-init initializes your Telegram connection and configures sync settings. It validates API credentials, tests the session, lists accessible groups and channels, and can set a default group for subsequent commands.

How This Skill Works

The skill validates the provided API_ID and API_HASH, tests the Telegram session string authentication, and enumerates all accessible groups and channels. It then updates the agent's configuration (config/agents.yaml) with Telegram settings and optionally applies a default group for downstream commands.

When to Use It

  • You are setting up Telegram for the first time.
  • You want to validate credentials before enabling message syncing.
  • You need to see all accessible groups and channels and their metadata.
  • You want to set a default Telegram group for future commands.
  • You are troubleshooting authentication or configuration errors.

Quick Start

  1. Step 1: Get API credentials from my.telegram.org/apps and generate a session string using the provided script.
  2. Step 2: Add TELEGRAM_API_ID, TELEGRAM_API_HASH, and TELEGRAM_SESSION to the .env file.
  3. Step 3: Run: python ${CLAUDE_PLUGIN_ROOT}/tools/telegram_init.py (optionally add --group <id> to set a default).

Best Practices

  • Store API credentials securely in .env: TELEGRAM_API_ID, TELEGRAM_API_HASH, TELEGRAM_SESSION.
  • Generate a fresh session string with the provided script before connecting.
  • Run telegram_init.py to verify access and automatically update config/agents.yaml.
  • Choose a default group that aligns with your primary workflow to simplify commands.
  • Be mindful of Telegram's Terms of Service and limit usage to personal data and permitted activities.

Example Use Cases

  • A new user connects Telegram to the agent and receives a list of groups and channels.
  • A team sets a default 'DevOps Alerts' group for automated notifications.
  • An admin runs generate_session.py, then completes setup with telegram_init.py.
  • Initialization fails due to an authentication error, prompting credential verification.
  • Config/agents.yaml is updated automatically after successful Telegram initialization.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers