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 ¶
- Variables
- type SendTool
- func (t *SendTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *SendTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *SendTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *SendTool) Definition() tool.Definition
- func (t *SendTool) Description(_ context.Context) (string, error)
- func (t *SendTool) FormatResult(data any) string
- func (t *SendTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *SendTool) IsEnabled() bool
- func (t *SendTool) IsReadOnly(_ map[string]any) bool
- func (t *SendTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
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 (*SendTool) Call ¶
func (t *SendTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
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) FormatResult ¶
Click to show internal directories.
Click to hide internal directories.