Skip to main content

Messaging

send.* sends messages, edit.* updates them, and delete removes them.

send.*​

All send.* variants accept an optional chat_id (target a specific chat) and most accept reply_markup (an inline or reply keyboard). RichText parameters support parse_mode: "Markdown" | "HTML".

send.text​

send.text(text: "Hello!", parse_mode: "Markdown", reply_to: message.message_id)
ParamTypeNotes
text!RichTextThe message body
chat_idChatIdTarget chat (default: current)
parse_modeString"Markdown", "HTML", or ""
reply_markupReplyMarkupInline or reply keyboard
reply_toMessageRefAttach as a reply

Media​

VariantRequiredOther params
send.photofile!caption, chat_id
send.videofile!caption, chat_id
send.documentfile!caption, chat_id
send.audiofile!caption, duration, performer, title, parse_mode, reply_markup
send.voicefile!caption, duration, parse_mode, reply_markup
send.animationfile!caption, has_spoiler, parse_mode, reply_markup
send.video_notefile!duration, length, reply_markup
send.stickerfile!reply_markup
send.media_groupmedia! (Array)chat_id
send.photo(file: "https://example.com/cat.jpg", caption: "🐱")
send.document(file: "https://example.com/report.pdf", caption: "Q3 report")
send.media_group(media: [
{ type: "photo", media: "https://example.com/1.jpg" },
{ type: "photo", media: "https://example.com/2.jpg" }
])

Location, venue, contact​

send.location(latitude: 51.5, longitude: -0.12)
send.venue(latitude: 51.5, longitude: -0.12, title: "Big Ben", address: "Westminster")
send.contact(first_name: "Sam", phone_number: "+15551234567")
VariantRequired
send.locationlatitude!, longitude! (opt: live_period, horizontal_accuracy)
send.venuelatitude!, longitude!, title!, address!
send.contactfirst_name!, phone_number! (opt: last_name, vcard)

Poll and dice​

send.poll(question: "Best language?", options: ["Botgami", "Other"], is_anonymous: false)
send.dice(emoji: "🎲")
VariantRequiredNotes
send.pollquestion!, options!poll_type, is_anonymous, allows_multiple_answers
send.diceβ€”emoji (🎲 🎯 πŸ€ …)

See Polls, forms & menus for richer poll usage.

send.chat_action​

Show a "typing…" style indicator:

send.chat_action(action: "typing")

send.answer_callback​

Show a toast or alert in response to a button tap (the callback is auto-answered anyway β€” use this only when you want a visible toast):

send.answer_callback(text: "Added to cart!", show_alert: false)

send.invoice (Telegram Stars)​

Send a Telegram Stars invoice. prices is an array of { label, amount } where amount is the star count, and currency is "XTR". The buyer's tap is handled by the on pre_checkout and on successful_payment triggers.

send.invoice(
"Pro Plan",
"Unlock all premium features",
"pro-plan", // payload β€” echoed back to your payment flows
[{ label: "Pro Plan", amount: 250 }], // 250 ⭐
currency: "XTR"
)
ParamTypeNotes
title!StringInvoice title
description!StringInvoice description
payload!StringYour own routing id, echoed to pre_checkout.invoice_payload / payment.invoice_payload
prices!Array[{ label, amount }] β€” amount is the star count
currencyString"XTR" for Stars
chat_idChatIdTarget chat (default: current)
reply_markupReplyMarkupOptional keyboard

edit.*​

Update a message you already sent. Inside a callback flow, message: callback.message targets the message the button was attached to.

edit.text(message: callback.message, text: "βœ… Updated!", parse_mode: "Markdown")
edit.caption(message: callback.message, caption: "New caption")
// Attach a named menu (recommended):
edit.reply_markup(message: callback.message, reply_markup: shopMenu("all"))
// Or replace with a raw inline keyboard:
edit.reply_markup(message: callback.message, reply_markup: { inline_keyboard: [[{ text: "OK", callback_data: "ok" }]] })
VariantRequired
edit.textmessage!, text! (opt: parse_mode, reply_markup)
edit.captionmessage!, caption! (opt: parse_mode, reply_markup)
edit.reply_markupmessage!, reply_markup!

delete​

delete(message: callback.message)

Removes a previously sent message.

react​

Set or clear the bot's emoji reaction on a message. Pass an empty emoji ("") to clear it.

react(message.message_id, "πŸ‘€") // set
react(message.message_id, "") // clear
ParamTypeNotes
message_id!NumberThe message to react to
emoji!StringThe reaction emoji (empty string clears)
chat_idChatIdTarget chat (default: current)

See the on reaction trigger to respond when users react.

answer_inline​

Respond to an on inline_query with a list of article results.

answer_inline(inline.id, [
{ id: "tip-1", title: "Quick tip", text: "Use /help to see commands.", description: "Bot basics" },
{ id: "tip-2", title: "Pricing", text: "Pro is 250 ⭐/month.", description: "Plans" }
])
ParamTypeNotes
query_id!StringThe inline query id (inline.id)
results!Array[{ id, title, text, description }]

msg.* β€” pin, unpin, forward, copy​

Manage existing messages by id. Each takes an optional chat_id (defaults to the current chat). Network actions can fail β€” attach on error => { }.

msg.pin(message.message_id)
msg.unpin(message.message_id) // omit id to unpin all
msg.forward(from_chat_id, message_id, chat_id: target_chat)
msg.copy(from_chat_id, message_id, chat_id: target_chat, caption: "Reposted")
VariantParams
msg.pinmessage_id!, chat_id
msg.unpinmessage_id (omit to unpin all), chat_id
msg.forwardfrom_chat_id!, message_id!, chat_id
msg.copyfrom_chat_id!, message_id!, chat_id, caption

msg.forward keeps the "forwarded from" attribution; msg.copy reposts without it. See Groups & admin for moderation uses.

See also​