> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # 전보 Telegram 채널을 사용하면 Mastra Agent가 Telegram에서 직접 메시지, 그룹 메시지 및 봇 멘션을 받을 수 있습니다. Mastra는 Agent 연결 및 웹훅 경로를 처리합니다. Chat SDK Telegram 어댑터 문서에서는 봇 설정, 웹훅 등록 및 폴링 동작을 다룹니다. ## 어댑터 설치 Chat SDK에서 Telegram 어댑터를 설치합니다. **npm**: ```bash npm install @chat-adapter/telegram ``` **pnpm**: ```bash pnpm add @chat-adapter/telegram ``` **Yarn**: ```bash yarn add @chat-adapter/telegram ``` **Bun**: ```bash bun add @chat-adapter/telegram ``` ## Agent 구성 Agent의 `channels.adapters` 객체에 `createTelegramAdapter()`를 추가하세요. ```typescript import { Agent } from '@mastra/core/agent' import { createTelegramAdapter } from '@chat-adapter/telegram' export const telegramAgent = new Agent({ id: 'telegram-agent', name: 'Telegram Agent', instructions: 'Answer questions and help with tasks in Telegram.', model: 'openai/gpt-5.6-sol', channels: { adapters: { telegram: createTelegramAdapter(), }, }, }) ``` Mastra 인스턴스에 Agent를 등록합니다. ```typescript import { Mastra } from '@mastra/core' import { telegramAgent } from './agents/telegram-agent' export const mastra = new Mastra({ agents: { telegramAgent }, }) ``` ## 어댑터 설정 BotFather, 웹훅 등록, 비밀 토큰, 폴링 모드를 포함한 Telegram 전용 설정은 [Chat SDK Telegram 어댑터 문서](https://chat-sdk.dev/adapters/official/telegram)를 따르세요. 어댑터는 다음과 같은 환경 변수에서 Telegram 자격 증명을 읽습니다. ```bash TELEGRAM_BOT_TOKEN=your-telegram-bot-token TELEGRAM_WEBHOOK_SECRET_TOKEN=your-webhook-secret-token TELEGRAM_BOT_USERNAME=your_bot_username ``` ## 웹훅 URL Mastra는 Agent ID 및 어댑터 키에서 Telegram 웹후크 경로를 생성합니다. ```text /api/agents/telegram-agent/channels/telegram/webhook ``` 공개 Mastra 서버 URL을 기본 URL로 사용하십시오. ```text https://your-app.example.com/api/agents/telegram-agent/channels/telegram/webhook ``` Telegram 어댑터 문서에서 웹훅 URL을 요청하는 곳이면 어디든 이 URL을 사용하세요. 텔레그램은 폴링 모드도 지원합니다. 로컬 개발에 폴링을 사용하려면 Chat SDK 어댑터 문서를 따르세요. ## 관련된 - [채널 개요](https://mastra.zisheng.pro/ko/docs/capabilities/channels/overview) - [더](https://mastra.zisheng.pro/ko/docs/capabilities/channels/other-adapters)