Public
Back
Version 0
3/30/2024
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export const telegramSendMessage = async (botToken: string, options: {
chat_id: string | number;
text: string;
message_thread_id?: number;
parse_mode?: string;
entities?: any[];
disable_web_page_preview?: boolean;
disable_notification?: boolean;
protect_content?: boolean;
reply_to_message_id?: number;
allow_sending_without_reply?: boolean;
reply_markup?: any[];
}) =>
fetchJSON(
`https://api.telegram.org/bot${botToken}/sendMessage`,
{
method: "POST",
body: JSON.stringify({ ...options }),
},
);
Updated: April 11, 2024