Google App Script - Telegram Bot - callback_data of an inline_keyboard

情到浓时终转凉″ 提交于 2020-01-06 08:44:08

问题


I don't want to use any library and i want to create the function that can react to a pressed botton of an inline_keyboard. I use webhook.

The following code works great for incoming messages but I need help to add the callback_query data.

function doPost(e) {

  var data = JSON.parse(e.postData.contents);

  if(data.message){//working great

    var text = data.message.text;
    var id = data.message.from.id;
    sendText(id,text);

  }

  if(data.callback_data){//this part doesn't work and i need help for this.
    //no help needed here :)
  }

}

回答1:


Try this one.

var data1 = JSON.parse(e.postData.contents).callback_query.<object>

Types of object



来源:https://stackoverflow.com/questions/47902879/google-app-script-telegram-bot-callback-data-of-an-inline-keyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!