telegram

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package telegram provides the telegram_send tool for sending messages via the Telegram Bot API.

Authentication:

  • Create a bot via @BotFather on Telegram → receive a bot token.
  • The bot must have been started by (or added to) the target chat.
  • For private messages: the user must have sent /start to the bot first.
  • For groups: add the bot to the group.

Implementation notes for contributors:

  • API endpoint: https://api.telegram.org/bot<TOKEN>/sendMessage
  • Telegram supports HTML and MarkdownV2 parse modes.
  • For MarkdownV2: special characters must be escaped with \ (e.g. \. \- \! \( \) \[ \]). Use HTML mode to avoid this.
  • sendPhoto, sendDocument, sendAudio share the same base structure — implement sendMessage first and the rest follow the same pattern.
  • chat_id can be a numeric ID or a @username for public groups.
  • Telegram Bot API docs: https://core.telegram.org/bots/api

Env vars:

TELEGRAM_BOT_TOKEN  — bot token from @BotFather (required)
TELEGRAM_CHAT_ID    — default chat ID to send to (optional override)

See GitHub issue for full implementation spec.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("telegram_send: not implemented — see GitHub issue")

Functions

This section is empty.

Types

type SendTool

type SendTool struct{}

func NewSendTool

func NewSendTool() *SendTool

func (*SendTool) BackfillInput

func (t *SendTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*SendTool) Call

func (*SendTool) CheckPermissions

func (t *SendTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*SendTool) Definition

func (t *SendTool) Definition() tool.Definition

func (*SendTool) Description

func (t *SendTool) Description(_ context.Context) (string, error)

func (*SendTool) FormatResult

func (t *SendTool) FormatResult(data any) string

func (*SendTool) IsConcurrencySafe

func (t *SendTool) IsConcurrencySafe(_ map[string]any) bool

func (*SendTool) IsEnabled

func (t *SendTool) IsEnabled() bool

func (*SendTool) IsReadOnly

func (t *SendTool) IsReadOnly(_ map[string]any) bool

func (*SendTool) ValidateInput

func (t *SendTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL