have amended Google Web App based on JavaScript source code as per 20200403 sadly, still does not work
problem: buttons do not show up on Telegram group, related to the group chat_id, when I type: menu
JavaScript should construct and send back to Telegram group: InlineKeyboardMarkup object (This object represents an inline keyboard that appears right next to the message it belongs to.)
Google Web App JavaScript source code follows:
var vApiTokenTelegram = "????????????????????????"; // @MediaFlamengoBot API token
var vUrlTelegram = "https://api.telegram.org/bot" + vApiTokenTelegram;
var vWebAppUrl = "https://script.google.com/macros/s/?????????????????????/exec";
function sendReplyMarkupMessage( chat_id, text, oInlineKeyboard ) {
var encodedText = encodeURIComponent(text);
GmailApp.sendEmail(Session.getEffectiveUser().getEmail(), "Telegram Bot Update", JSON.stringify(oInlineKeyboard, null, 4));
var req = new Request(vUrlTelegram + "/sendMessage?chat_id=" + chat_id + "&text=" + text + "&reply_markup=" + oInlineKeyboard );
fetch(req)
.then(response => response.blob())
.then(blob => {
console.log('Response: ', blob)
});
//Logger.log(response.getContentText());
}
function menu( chat_id ) {
var oInlineKeyboard = 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' }],
[{ text: 'Some button text 4', callback_data: '4' }],
[{ text: 'Some button text 5', callback_data: '5' }]
]
});
sendReplyMarkupMessage( chat_id, "test", oInlineKeyboard );
}
gmail logs the following, no JSON object: "{\"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\"}],[{\"text\":\"Some button text 4\",\"callback_data\":\"4\"}],[{\"text\":\"Some button text 5\",\"callback_data\":\"5\"}]]}"
thanks in advance for any help
Trajano
