send_message
Send text messages to Telegram channels using specified parse modes like HTML or Markdown for automated bot communication and content distribution.
Instructions
Send a text message to the Telegram channel
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parse_mode | No | Parse mode (HTML, Markdown, or MarkdownV2) | |
| text | Yes | Message text to send |
Input Schema (JSON Schema)
{
"properties": {
"parse_mode": {
"description": "Parse mode (HTML, Markdown, or MarkdownV2)",
"enum": [
"HTML",
"Markdown",
"MarkdownV2"
],
"type": "string"
},
"text": {
"description": "Message text to send",
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
}
Implementation Reference
- src/index.ts:334-352 (handler)The handler for the 'send_message' tool. Extracts text and optional parse_mode from arguments, sends the message to the specified Telegram channel using bot.sendMessage, and returns a formatted success response with message details.case 'send_message': { const { text, parse_mode = 'HTML' } = args as { text: string; parse_mode?: string; }; const result = await bot.sendMessage(CHANNEL_ID, text, { parse_mode: parse_mode as any, }); return { content: [ { type: 'text', text: `β Message sent successfully!\n\nπ± Channel: ${CHANNEL_ID}\nπ Message ID: ${result.message_id}\nπ Text: ${result.text}\nπ Date: ${new Date(result.date * 1000).toLocaleString()}`, }, ], }; }
- src/index.ts:61-79 (schema)The input schema definition for the 'send_message' tool, specifying required 'text' parameter and optional 'parse_mode'.{ name: 'send_message', description: 'Send a text message to the Telegram channel', inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Message text to send', }, parse_mode: { type: 'string', enum: ['HTML', 'Markdown'], description: 'Parse mode for the message (HTML or Markdown)', }, }, required: ['text'], }, },