I am trying to send questions to my telegram bot from google app script, but right now it seems like my code is not executing my start function when I type /start to my telegram bot. Please advise.
function start(data) {
var reply = {
'text': "Please type /survey to start using it's service.",
'parse_mode': 'Markdown',
'disable_web_page_preview': true
};
var method = 'sendMessage.';
var options = {
'method' : 'post',
'contentType': 'application/json',
'payload' : JSON.stringify(reply)
};
var response = UrlFetchApp.fetch('https://api.telegram.org/bot' + telegramToken + '/' + method,
options);
}
function doPost(e){
var data = JSON.parse(e.postData.contents);
var text = data.message.text;
if(text == '/start'){
start(data);
} else if (text == '/survey' || text == '/survey') {
survey(data);
} else {
invalid(data);
}
}