Telegram Bot API integration with managed authentication. Send messages, manage chats, handle updates, and interact with users through your Telegram bot. Use this skill when users want to send messages, create polls, manage bot commands, or interact with Telegram chats. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
OpenClaw skills run inside an OpenClaw container. EasyClawd deploys and manages yours — no server setup needed.
- Added a new `clawdbot` metadata block with an emoji and environment variables required (`MATON_API_KEY`) in SKILL.md. - No changes to functionality or usage; documentation only.
---
name: telegram
description: |
Telegram Bot API integration with managed authentication. Send messages, manage chats, handle updates, and interact with users through your Telegram bot. Use this skill when users want to send messages, create polls, manage bot commands, or interact with Telegram chats. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
compatibility: Requires network access and valid Maton API key
metadata:
author: maton
version: "1.0"
clawdbot:
emoji: 🧠
requires:
env:
- MATON_API_KEY
---
# Telegram Bot API
Access the Telegram Bot API with managed authentication. Send messages, photos, polls, locations, and more through your Telegram bot.
## Quick Start
```bash
# Get bot info
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/telegram/:token/getMe')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```
## Base URL
```
https://gateway.maton.ai/telegram/:token/{method}
```
The `:token` placeholder is automatically replaced with your bot token from the connection configuration. Replace `{method}` with the Telegram Bot API method name (e.g., `sendMessage`, `getUpdates`).
## Authentication
All requests require the Maton API key in the Authorization header:
```
Authorization: Bearer $MATON_API_KEY
```
**Environment Variable:** Set your API key as `MATON_API_KEY`:
```bash
export MATON_API_KEY="YOUR_API_KEY"
```
### Getting Your API Key
1. Sign in or create an account at [maton.ai](https://maton.ai)
2. Go to [maton.ai/settings](https://maton.ai/settings)
3. Copy your API key
## Connection Management
Manage your Telegram bot connections at `https://ctrl.maton.ai`.
### List Connections
```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=telegram&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```
### Create Connection
```bash
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'telegram'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```
### Get Connection
```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```
**Response:**
```json
{
"connection": {
"connection_id": "e8f5078d-e507-4139-aabe-1615181ea8fc",
"status": "ACTIVE",
"creation_time": "2026-02-07T10:37:21.053942Z",
"last_updated_time": "2026-02-07T10:37:59.881901Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "telegram",
"metadata": {}
}
}
```
Open the returned `url` in a browser to complete the bot token configuration.
### Delete Connection
```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```
### Specifying Connection
If you have multiple Telegram connections (multiple bots), specify which one to use with the `Maton-Connection` header:
```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/telegram/:token/getMe')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', 'e8f5078d-e507-4139-aabe-1615181ea8fc')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```
If omitted, the gateway uses the default (oldest) active connection.
## API Reference
### Bot Information
#### Get Bot Info
```bash
GET /telegram/:token/getMe
```
Returns information about the bot.
**Response:**
```json
{
"ok": true,
"result": {
"id": 8523474253,
"is_bot": true,
"first_name": "Maton",
"username": "maton_bot",
"can_join_groups": true,
"can_read_all_group_messages": true,
"supports_inline_queries": true
}
}
```
### Getting Updates
#### Get Updates (Long Polling)
```bash
POST /telegram/:token/getUpdates
Content-Type: application/json
{
"limit": 100,
"timeout": 30,
"offset": 625435210
}
```
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| offset | Integer | No | First update ID to return |
| limit | Integer | No | Number of updates (1-100, default 100) |
| timeout | Integer | No | Long polling timeout in seconds |
| allowed_updates | Array | No | Update types to receive |
#### Get Webhook Info
```bash
GET /telegram/:token/getWebhookInfo
```
#### Set Webhook
```bash
POST /telegram/:token/setWebhook
Content-Type: application/json
{
"url": "https://example.com/webhook",
"allowed_updates": ["message", "callback_query"],
"secret_token": "your_secret_token"
}
```
#### Delete Webhook
```bash
POST /telegram/:token/deleteWebhook
Content-Type: application/json
{
"drop_pending_updates": true
}
```
### Sending Messages
#### Send Text Message
```bash
POST /telegram/:token/sendMessage
Content-Type: application/json
{
"chat_id": 6442870329,
"text": "Hello, World!",
"parse_mode": "HTML"
}
```
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| chat_id | Integer/String | Yes | Target chat ID or @username |
| text | String | Yes | Message text (1-4096 characters) |
| parse_mode | String | No | `HTML`, `Markdown`, or `MarkdownV2` |
| reply_markup | Object | No | Inline keyboard or reply keyboard |
| reply_parameters | Object | No | Reply to a specific message |
**With HTML Formatting:**
```bash
POST /telegram/:token/sendMessage
Content-Type: application/json
{
"chat_id": 6442870329,
"text": "<b>Bold</b> and <i>italic</i> with <a href=\"https://example.com\">link</a>",
"parse_mode": "HTML"
}
```
**With Inline Keyboard:**
```bash
POST /telegram/:token/sendMessage
Content-Type: application/json
{
"chat_id": 6442870329,
"text": "Choose an option:",
"reply_markup": {
"inline_keyboard": [
[
{"text": "Option 1", "callback_data": "opt1"},
{"text": "Option 2", "callback_data": "opt2"}
],
[
{"text": "Visit Website", "url": "https://example.com"}
]
]
}
}
```
#### Send Photo
```bash
POST /telegram/:token/sendPhoto
Content-Type: application/json
{
"chat_id": 6442870329,
"photo": "https://example.com/image.jpg",
"caption": "Image caption"
}
```
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| chat_id | Integer/String | Yes | Target chat ID |
| photo | String | Yes | Photo URL or file_id |
| caption | String | No | Caption (0-1024 characters) |
| parse_mode | String | No | Caption parse mode |
#### Send Document
```bash
POST /telegram/:token/sendDocument
Content-Type: application/json
{
"chat_id": 6442870329,
"document": "https://example.com/file.pdf",
"caption": "Document caption"
}
```
#### Send Video
```bash
POST /telegram/:token/sendVideo
Content-Type: application/json
{
"chat_id": 6442870329,
"video": "https://example.com/video.mp4",
"caption": "Video caption"
}
```
#### Send Audio
```bash
POST /telegram/:token/sendAudio
Content-Type: application/json
{
"chat_id": 6442870329,
"audio": "https://example.com/audio.mp3",
"caption": "Audio caption"
}
```
#### Send Location
```bash
POST /Read full documentation on ClawHub