Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
How to set Telegram bot commands via Google Apps Script?

Here are my Apps Script commands definition and the function:

function setBotCommands() {
  const BOT_COMMANDS = [
      {
        command: "start", 
        description: "Start"
      }, 
      {
        command: "joke", 
        description: "Chucke jokes"
      } 
    ];  

  var bot = new Bot(botToken, {});
  var result = bot.request('setMyCommands?commands=', BOT_COMMANDS);
  Logger.log(result);
  var cmdtmp = bot.request('getMyCommands');
  Logger.log(cmdtmp);
}

which passes ok, but getMyCommands returns an empty array:

6:23:40 AM  Notice  Execution started
6:23:40 AM  Info    {ok=true, result=true}
6:23:40 AM  Info    {result=[], ok=true}
6:23:40 AM  Notice  Execution completed

Request is defined as follows:

Bot.prototype.request = function (method, data) {
  var options = {
    'method' : 'post',
    'contentType': 'application/json',
    'payload' : JSON.stringify(data)
  };

  var response = UrlFetchApp.fetch('https://api.telegram.org/bot' + this.token + '/' + method, options);
    
  if (response.getResponseCode() == 200) {
    return JSON.parse(response.getContentText());
  }
  
  return false;
}

Any assumptions, what have I missed here? Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!