Telegram Bot API
A direct Bot API call.
Installation
npm install @telyx/corePackages are built locally; PyPI/npm publication is still pending.
Bot API
Set BOT_TOKEN and CHAT_ID on the server, never in the browser.
JavaScript
import { tx } from "@telyx/core";
const response = await fetch(`https://api.telegram.org/bot${process.env.BOT_TOKEN}/sendMessage`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
chat_id: process.env.CHAT_ID,
text: `${tx.wallet} Баланс`,
parse_mode: "HTML",
}),
});
const result = await response.json();
if (!result.ok) throw new Error(result.description);Telegram requirements
Custom emoji availability depends on Telegram: the owner's Premium and sending context, or additional Fragment usernames. HTML is only for messages; button labels are plain text.