JSFiddle - React, Tailwind, and code Playground
JavaScript
function sendReplyMarkupMessage( chat_id, text, reply_markup ) {
var UrlTelegram = 'https://api.telegram.org/bot<YOUR_TOKEN>';
var encodedText = encodeURIComponent(text);
var req = new Request(UrlTelegram + "/sendMessage?chat_id=" + chat_id + "&text=" + text + "&reply_markup=" + reply_markup );
fetch(req)
.then(response => response.blob())
.then(blob => {
console.log('Response: ', blob)
});
//Logger.log(response.getContentText());
}
function menu( chat_id ) {
var options = JSON.stringify({
inline_keyboard: [
[{ text: 'Some button text 1', callback_data: '1' }],
[{ text: 'Some button text 2', callback_data: '2' }],
[{ text: 'Some button text 3', callback_data: '3' }]
]
});
sendReplyMarkupMessage( chat_id, "test", options );
}
let send = menu(<YOUR-ID>);