Functions
answer-callback-query
fn (request: AnswerCallbackQueryRequest): Bool
fn (request: AnswerCallbackQueryRequest, opts: Map): Bool
answerCallbackQuery - Respond to a callback query from an inline keyboard button. Must be called even if no notification is needed. Set show_alert: true for a popup instead of a toast.
Example
::messages ::telegram::messages
on-callback fn (update: Map): Bool {
::messages/answer-callback-query(::messages/AnswerCallbackQueryRequest({
callback_query_id: update.callback_query.id,
text: "Button pressed!"
}))
}
answer-inline-query
fn (request: AnswerInlineQueryRequest): Bool
fn (request: AnswerInlineQueryRequest, opts: Map): Bool
answerInlineQuery - Answer an inline_query update (a user typing @yourbot query). Requires inline mode enabled in BotFather.
Example
::messages ::telegram::messages
on-inline fn (update: Map): Bool {
::messages/answer-inline-query(::messages/AnswerInlineQueryRequest({
inline_query_id: update.inline_query.id,
results: [{
type: "article",
id: "echo",
title: `Echo: ${update.inline_query.query}`,
input_message_content: {message_text: update.inline_query.query}
}],
cache_time: 0
}))
}
copy-message
fn (request: CopyMessageRequest): Map
fn (request: CopyMessageRequest, opts: Map): Map
copyMessage - Copy a message without the "Forwarded from" attribution. Returns the new message ID rather than the full message object.
delete-message
fn (request: DeleteMessageRequest): Bool
fn (request: DeleteMessageRequest, opts: Map): Bool
deleteMessage - Delete a message. Bots can delete messages they sent, messages in private chats, and messages in groups/channels where they have delete permissions.
delete-messages
fn (request: DeleteMessagesRequest): Bool
fn (request: DeleteMessagesRequest, opts: Map): Bool
deleteMessages - Delete multiple messages at once (up to 100). Messages must be from the same chat and no older than 48 hours.
edit-message-caption
fn (request: EditMessageCaptionRequest): Any
fn (request: EditMessageCaptionRequest, opts: Map): Any
editMessageCaption - Edit the caption of a photo, video, document, or animation message.
edit-message-media
fn (request: EditMessageMediaRequest): Any
fn (request: EditMessageMediaRequest, opts: Map): Any
editMessageMedia - Replace a message's photo, video, document, audio, or animation (or turn a text message into media). Returns the edited message, or true for inline messages.
Example
::messages ::telegram::messages
::messages/edit-message-media(::messages/EditMessageMediaRequest({
chat_id: 123456789,
message_id: 42,
media: {type: "photo", media: "https://example.com/updated.png", caption: "Updated chart"}
}))
edit-message-reply-markup
fn (request: EditMessageReplyMarkupRequest): Any
fn (request: EditMessageReplyMarkupRequest, opts: Map): Any
editMessageReplyMarkup - Edit the reply markup (inline keyboard) of a message.
edit-message-text
fn (request: EditMessageTextRequest): Any
fn (request: EditMessageTextRequest, opts: Map): Any
editMessageText - Edit a text message. Provide either chat_id + message_id for regular messages, or inline_message_id for inline bot messages.
Example
::messages ::telegram::messages
::messages/edit-message-text(::messages/EditMessageTextRequest({
chat_id: 123456789,
message_id: 42,
text: "Updated message text"
}))
forward-message
fn (request: ForwardMessageRequest): Map
fn (request: ForwardMessageRequest, opts: Map): Map
forwardMessage - Forward a message from one chat to another. The forwarded message shows the original sender.
send-audio
fn (request: SendAudioRequest): Map
fn (request: SendAudioRequest, opts: Map): Map
sendAudio - Send an MP3 or M4A file to show in the music player. audio can be a file_id, an HTTP URL, or an InputFile to upload bytes (up to 50 MB).
send-chat-action
fn (request: SendChatActionRequest): Bool
fn (request: SendChatActionRequest, opts: Map): Bool
sendChatAction - Show a typing indicator or upload status. action: "typing", "upload_photo", "record_video", "upload_video", "record_voice", "upload_voice", "upload_document", "find_location", "record_video_note", "upload_video_note".
send-contact
fn (request: SendContactRequest): Map
fn (request: SendContactRequest, opts: Map): Map
sendContact - Send a phone contact.
send-dice
fn (request: SendDiceRequest): Map
fn (request: SendDiceRequest, opts: Map): Map
sendDice - Send an animated dice/emoji. emoji can be a die, dart, basketball, football, bowling, or slot machine emoji. Default is die.
send-document
fn (request: SendDocumentRequest): Map
fn (request: SendDocumentRequest, opts: Map): Map
sendDocument - Send a general file. document can be a file_id, an HTTP URL, or an InputFile to upload bytes (up to 50 MB).
send-location
fn (request: SendLocationRequest): Map
fn (request: SendLocationRequest, opts: Map): Map
sendLocation - Send a point on the map. Set live_period (60-86400 seconds) for a live location that updates.
send-media-group
fn (request: SendMediaGroupRequest): Vec<Map>
fn (request: SendMediaGroupRequest, opts: Map): Vec<Map>
sendMediaGroup - Send 2-10 photos, videos, documents, or audios as an album. Returns the Vec of sent messages.
Example
::messages ::telegram::messages
::api ::telegram::api
album ::messages/send-media-group(::messages/SendMediaGroupRequest({
chat_id: 123456789,
media: [
{type: "photo", media: "https://example.com/a.jpg", caption: "Before"},
{type: "photo", media: ::api/input-file(::hot::file/read-file-bytes("after.jpg"), "after.jpg", "image/jpeg")}
]
}))
length(album) // => 2
send-message
fn (request: SendMessageRequest): Map
fn (request: SendMessageRequest, opts: Map): Map
sendMessage - Send a text message to a chat. chat_id can be an integer ID or a string @channel_username. parse_mode can be "HTML", "Markdown", or "MarkdownV2".
Example
::messages ::telegram::messages
response ::messages/send-message(::messages/SendMessageRequest({
chat_id: 123456789,
text: "Hello from Hot!"
}))
response.message_id // => 42
// With formatting
response ::messages/send-message(::messages/SendMessageRequest({
chat_id: 123456789,
text: "<b>Bold</b> and <i>italic</i>",
parse_mode: "HTML"
}))
send-photo
fn (request: SendPhotoRequest): Map
fn (request: SendPhotoRequest, opts: Map): Map
sendPhoto - Send a photo. photo can be a file_id (to resend), an HTTP URL, or an InputFile to upload bytes.
Example
::messages ::telegram::messages
response ::messages/send-photo(::messages/SendPhotoRequest({
chat_id: 123456789,
photo: "https://example.com/image.jpg",
caption: "Check out this image!"
}))
// Upload bytes (multipart/form-data)
png ::hot::file/read-file-bytes("chart.png")
response ::messages/send-photo(::messages/SendPhotoRequest({
chat_id: 123456789,
photo: ::telegram::api/input-file(png, "chart.png", "image/png")
}))
send-poll
fn (request: SendPollRequest): Map
fn (request: SendPollRequest, opts: Map): Map
sendPoll - Send a poll with 1-12 options, each {text: "Option text"}. Set type: "quiz" for quiz mode with correct_option_ids (0-based, increasing).
send-video
fn (request: SendVideoRequest): Map
fn (request: SendVideoRequest, opts: Map): Map
sendVideo - Send an MPEG4 video. video can be a file_id, an HTTP URL, or an InputFile to upload bytes (up to 50 MB).
send-voice
fn (request: SendVoiceRequest): Map
fn (request: SendVoiceRequest, opts: Map): Map
sendVoice - Send a voice message (OGG/OPUS, MP3, or M4A). voice can be a file_id, an HTTP URL, or an InputFile to upload bytes.
set-message-reaction
fn (request: SetMessageReactionRequest): Bool
fn (request: SetMessageReactionRequest, opts: Map): Bool
setMessageReaction - Set the bot's reactions on a message. Each reaction is {type: "emoji", emoji: "👍"} (from Telegram's allowed set) or {type: "custom_emoji", custom_emoji_id}. Pass an empty reaction Vec to remove the bot's reaction. Bots can set one reaction per message.
Example
::messages ::telegram::messages
::messages/set-message-reaction(::messages/SetMessageReactionRequest({
chat_id: 123456789,
message_id: 42,
reaction: [{type: "emoji", emoji: "👍"}]
}))
stop-poll
fn (request: StopPollRequest): Map
fn (request: StopPollRequest, opts: Map): Map
stopPoll - Close a poll the bot sent. Returns the final Poll with vote counts.
Types
AnswerCallbackQueryRequest
AnswerCallbackQueryRequest type {
callback_query_id: Str,
text: Str?,
show_alert: Bool?,
url: Str?,
cache_time: Int?
}
AnswerInlineQueryRequest
AnswerInlineQueryRequest type {
inline_query_id: Str,
results: Vec<Map>,
cache_time: Int?,
is_personal: Bool?,
next_offset: Str?,
button: Map?
}
results is up to 50 InlineQueryResult objects, e.g. {type: "article", id: "1", title, input_message_content: {message_text}}. next_offset enables paging; button shows a button above the results.
CopyMessageRequest
CopyMessageRequest type {
chat_id: Any,
from_chat_id: Any,
message_id: Int,
video_start_timestamp: Int?,
caption: Str?,
parse_mode: Str?,
caption_entities: Vec<Map>?,
show_caption_above_media: Bool?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?
}
DeleteMessageRequest
DeleteMessageRequest type {
chat_id: Any,
message_id: Int
}
DeleteMessagesRequest
DeleteMessagesRequest type {
chat_id: Any,
message_ids: Vec<Int>
}
EditMessageCaptionRequest
EditMessageCaptionRequest type {
business_connection_id: Str?,
chat_id: Any?,
message_id: Int?,
inline_message_id: Str?,
caption: Str?,
parse_mode: Str?,
caption_entities: Vec<Map>?,
show_caption_above_media: Bool?,
reply_markup: Map?
}
EditMessageMediaRequest
EditMessageMediaRequest type {
business_connection_id: Str?,
chat_id: Any?,
message_id: Int?,
inline_message_id: Str?,
media: Map,
reply_markup: Map?
}
media is one InputMedia object; its media may be a file_id, URL, or InputFile. Identify the message with chat_id + message_id, or inline_message_id.
EditMessageReplyMarkupRequest
EditMessageReplyMarkupRequest type {
business_connection_id: Str?,
chat_id: Any?,
message_id: Int?,
inline_message_id: Str?,
reply_markup: Map?
}
EditMessageTextRequest
EditMessageTextRequest type {
business_connection_id: Str?,
chat_id: Any?,
message_id: Int?,
inline_message_id: Str?,
text: Str,
parse_mode: Str?,
entities: Vec<Map>?,
link_preview_options: Map?,
reply_markup: Map?
}
ForwardMessageRequest
ForwardMessageRequest type {
chat_id: Any,
from_chat_id: Any,
message_id: Int,
video_start_timestamp: Int?,
disable_notification: Bool?,
protect_content: Bool?,
message_effect_id: Str?,
message_thread_id: Int?,
direct_messages_topic_id: Int?
}
SendAudioRequest
SendAudioRequest type {
chat_id: Any,
audio: Str | ::telegram::api/InputFile,
caption: Str?,
parse_mode: Str?,
caption_entities: Vec<Map>?,
duration: Int?,
performer: Str?,
title: Str?,
thumbnail: Str | ::telegram::api/InputFile | Null,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SendChatActionRequest
SendChatActionRequest type {
chat_id: Any,
action: Str,
message_thread_id: Int?,
business_connection_id: Str?
}
SendContactRequest
SendContactRequest type {
chat_id: Any,
phone_number: Str,
first_name: Str,
last_name: Str?,
vcard: Str?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SendDiceRequest
SendDiceRequest type {
chat_id: Any,
emoji: Str?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SendDocumentRequest
SendDocumentRequest type {
chat_id: Any,
document: Str | ::telegram::api/InputFile,
thumbnail: Str | ::telegram::api/InputFile | Null,
caption: Str?,
parse_mode: Str?,
caption_entities: Vec<Map>?,
disable_content_type_detection: Bool?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SendLocationRequest
SendLocationRequest type {
chat_id: Any,
latitude: Dec,
longitude: Dec,
horizontal_accuracy: Dec?,
live_period: Int?,
heading: Int?,
proximity_alert_radius: Int?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SendMediaGroupRequest
SendMediaGroupRequest type {
chat_id: Any,
media: Vec<Map>,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
media is 2-10 InputMedia objects ({type: "photo" | "video" | "document" | "audio", media, caption?, ...}). Each media (and thumbnail/cover) may be a file_id, a URL, or an InputFile; files are uploaded in one multipart request and referenced with attach://. Documents and audio can only be grouped with their own type.
SendMessageRequest
SendMessageRequest type {
chat_id: Any,
text: Str,
parse_mode: Str?,
entities: Vec<Map>?,
link_preview_options: Map?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SendPhotoRequest
SendPhotoRequest type {
chat_id: Any,
photo: Str | ::telegram::api/InputFile,
caption: Str?,
parse_mode: Str?,
caption_entities: Vec<Map>?,
show_caption_above_media: Bool?,
has_spoiler: Bool?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
photo is a file_id, an HTTP URL Telegram fetches, or an InputFile (bytes, uploaded as multipart; up to 10 MB).
SendPollRequest
SendPollRequest type {
chat_id: Any,
question: Str,
question_parse_mode: Str?,
options: Vec<Map>,
is_anonymous: Bool?,
type: Str?,
allows_multiple_answers: Bool?,
allows_revoting: Bool?,
shuffle_options: Bool?,
correct_option_ids: Vec<Int>?,
explanation: Str?,
explanation_parse_mode: Str?,
open_period: Int?,
close_date: Int?,
is_closed: Bool?,
description: Str?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
business_connection_id: Str?
}
SendVideoRequest
SendVideoRequest type {
chat_id: Any,
video: Str | ::telegram::api/InputFile,
duration: Int?,
width: Int?,
height: Int?,
thumbnail: Str | ::telegram::api/InputFile | Null,
cover: Str | ::telegram::api/InputFile | Null,
start_timestamp: Int?,
caption: Str?,
parse_mode: Str?,
caption_entities: Vec<Map>?,
show_caption_above_media: Bool?,
has_spoiler: Bool?,
supports_streaming: Bool?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SendVoiceRequest
SendVoiceRequest type {
chat_id: Any,
voice: Str | ::telegram::api/InputFile,
caption: Str?,
parse_mode: Str?,
caption_entities: Vec<Map>?,
duration: Int?,
disable_notification: Bool?,
protect_content: Bool?,
allow_paid_broadcast: Bool?,
message_effect_id: Str?,
reply_parameters: Map?,
reply_markup: Map?,
message_thread_id: Int?,
direct_messages_topic_id: Int?,
business_connection_id: Str?
}
SetMessageReactionRequest
SetMessageReactionRequest type {
chat_id: Any,
message_id: Int,
reaction: Vec<Map>?,
is_big: Bool?
}
StopPollRequest
StopPollRequest type {
business_connection_id: Str?,
chat_id: Any,
message_id: Int,
reply_markup: Map?
}