Reputation: 1
I craete the Telegram bot on GAS, but my custom keyboard do not working. My functon send message is below. Thanks.
function sendText(text,chatId){
var payload = { 'method': 'sendMessage', 'chat_id': String(chatId), 'text': text, 'parse_mode': 'HTML' }
var data = {
"method": "post",
"payload": payload,
"reply_markup": JSON.stringify({
'keyboard': [['Store username']],
'resize_keyboard':true,
'one_time_keyboard': true
})
}
// Replace with your token
var API_TOKEN = '**********************';
UrlFetchApp.fetch('https://api.telegram.org/bot' + API_TOKEN + '/', data);
}
Upvotes: 0
Views: 2099
Reputation: 452
According to telegram official api your keyboard format must be:
Array of button rows, each represented by an Array of KeyboardButton objects
for example :
"reply_markup": JSON.stringify({
'keyboard': [
[ ['row1-col1'] ],//row 1
[ ['row2-col1'],['row2-col2'] ] //row 2
],
'resize_keyboard':true,
'one_time_keyboard': true
})
Upvotes: 2