feat: Telegram Bot API integration
- New client: src/clients/telegram.ts
- Tools: telegram_get_me, telegram_send_message, telegram_send_photo, telegram_get_updates, telegram_get_chat
- REST endpoints: GET /api/telegram/me, POST /api/telegram/message, POST /api/telegram/photo, GET /api/telegram/updates, GET /api/telegram/chat
- Multi-account env var pattern: TELEGRAM_{ACCOUNT}_BOT_TOKEN
- Uses Telegram Bot API (https://api.telegram.org)
Total tools: 24 (email 6, obsidian 5, whatsapp 3, linkedin 4, telegram 5)
This commit is contained in:
140
src/manifest.ts
140
src/manifest.ts
@@ -567,6 +567,142 @@ export function getManifest(serverUrl: string, authEnabled: boolean) {
|
||||
examples: [{ recipient_id: 'urn:li:person:abc123', message: 'Hi, thanks for connecting!', account: 'default' }],
|
||||
},
|
||||
|
||||
// ── Telegram tools ──────────────────────────────────────────────────────
|
||||
{
|
||||
name: 'telegram_get_me',
|
||||
category: 'telegram',
|
||||
description: 'Get information about the connected Telegram bot',
|
||||
when_to_use:
|
||||
'User asks about the Telegram bot, wants to verify it is connected, or needs the bot username.',
|
||||
input_schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
account: { type: 'string', description: 'Which Telegram account to use (default: "default")' },
|
||||
},
|
||||
},
|
||||
returns: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'number', description: 'Bot user ID' },
|
||||
first_name: { type: 'string' },
|
||||
username: { type: 'string' },
|
||||
is_bot: { type: 'boolean' },
|
||||
},
|
||||
},
|
||||
examples: [{ account: 'default' }],
|
||||
},
|
||||
{
|
||||
name: 'telegram_send_message',
|
||||
category: 'telegram',
|
||||
description: 'Send a text message via Telegram bot',
|
||||
when_to_use:
|
||||
'User wants to send a Telegram message, DM someone, or notify a group or channel.',
|
||||
input_schema: {
|
||||
type: 'object',
|
||||
required: ['chat_id', 'text'],
|
||||
properties: {
|
||||
chat_id: { type: 'string', description: 'Chat ID, username (@username), or channel ID' },
|
||||
text: { type: 'string', description: 'Message text' },
|
||||
parse_mode: { type: 'string', enum: ['HTML', 'Markdown', 'MarkdownV2'], description: 'Message formatting mode' },
|
||||
account: { type: 'string', description: 'Which Telegram account to use (default: "default")' },
|
||||
},
|
||||
},
|
||||
returns: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
message_id: { type: 'number' },
|
||||
chat_id: { type: 'string', description: 'Chat ID where the message was sent' },
|
||||
},
|
||||
},
|
||||
examples: [{ chat_id: '@mychannel', text: 'Hello from Hermes!', account: 'default' }],
|
||||
},
|
||||
{
|
||||
name: 'telegram_send_photo',
|
||||
category: 'telegram',
|
||||
description: 'Send a photo via Telegram bot',
|
||||
when_to_use:
|
||||
'User wants to share an image through Telegram.',
|
||||
input_schema: {
|
||||
type: 'object',
|
||||
required: ['chat_id', 'photo'],
|
||||
properties: {
|
||||
chat_id: { type: 'string', description: 'Chat ID, username (@username), or channel ID' },
|
||||
photo: { type: 'string', description: 'Photo URL or Telegram file_id' },
|
||||
caption: { type: 'string', description: 'Optional caption text' },
|
||||
account: { type: 'string', description: 'Which Telegram account to use (default: "default")' },
|
||||
},
|
||||
},
|
||||
returns: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
message_id: { type: 'number' },
|
||||
chat_id: { type: 'string' },
|
||||
},
|
||||
},
|
||||
examples: [{ chat_id: '@mychannel', photo: 'https://example.com/image.jpg', caption: 'Check this out', account: 'default' }],
|
||||
},
|
||||
{
|
||||
name: 'telegram_get_updates',
|
||||
category: 'telegram',
|
||||
description: 'Get recent incoming messages for the Telegram bot',
|
||||
when_to_use:
|
||||
'User asks to check Telegram messages, read DMs, or see recent bot activity.',
|
||||
input_schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
limit: { type: 'number', description: 'Max updates to return (default: 10)' },
|
||||
account: { type: 'string', description: 'Which Telegram account to use (default: "default")' },
|
||||
},
|
||||
},
|
||||
returns: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
update_id: { type: 'number' },
|
||||
message: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
message_id: { type: 'number' },
|
||||
from: { type: 'object', properties: { id: { type: 'number' }, first_name: { type: 'string' }, username: { type: 'string' } } },
|
||||
chat: { type: 'object', properties: { id: { type: 'number' }, type: { type: 'string' }, title: { type: 'string' } } },
|
||||
date: { type: 'number' },
|
||||
text: { type: 'string' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
examples: [{ limit: 5, account: 'default' }],
|
||||
},
|
||||
{
|
||||
name: 'telegram_get_chat',
|
||||
category: 'telegram',
|
||||
description: 'Get information about a Telegram chat or channel',
|
||||
when_to_use:
|
||||
'User wants to verify a Telegram chat exists or get its details before sending a message.',
|
||||
input_schema: {
|
||||
type: 'object',
|
||||
required: ['chat_id'],
|
||||
properties: {
|
||||
chat_id: { type: 'string', description: 'Chat ID, username (@username), or channel ID' },
|
||||
account: { type: 'string', description: 'Which Telegram account to use (default: "default")' },
|
||||
},
|
||||
},
|
||||
returns: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'number' },
|
||||
type: { type: 'string' },
|
||||
title: { type: 'string' },
|
||||
username: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
member_count: { type: 'number' },
|
||||
},
|
||||
},
|
||||
examples: [{ chat_id: '@mychannel', account: 'default' }],
|
||||
},
|
||||
|
||||
// ── Obsidian tools ──────────────────────────────────────────────────────
|
||||
{
|
||||
name: 'obsidian_search_notes',
|
||||
@@ -734,6 +870,10 @@ export function getManifest(serverUrl: string, authEnabled: boolean) {
|
||||
description: 'LinkedIn profile and posting via LinkedIn API',
|
||||
icon: '🔗',
|
||||
},
|
||||
telegram: {
|
||||
description: 'Telegram messaging via Bot API',
|
||||
icon: '✈️',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user