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

404
Views
Telegram bot and google apps script not working

Good evening everyone, forgive the trouble, I tried to do a "search" on the site but I could not find the answer to my problem so I thought of opening a new discussion. I make two premises, the first is that I am not familiar with the English language and therefore I am writing to you via google translator, the second is that I am a novice programmer. Having said that, let's get to the tricky part immediately, the following is the code that I put by inserting the token and the webappurl

var token = "YOUR_TOKEN";
var telegramUrl = "https://api.telegram.org/bot" + token;
var webAppUrl = "YOUR_YO_URL";

function setWebhook () {
  var url = telegramUrl + "/ setWebhook? url =" + webAppUrl;
  var response = UrlFetchApp.fetch (url);
}

function sendMessage (chat_id, text) {
  var url = telegramUrl + "/ sendMessage? chat_id =" + chat_id + "& text =" + text;
  var response = UrlFetchApp.fetch (url);
}

function doPost (e) {
  var contents = JSON.parse (e.postData.contents);
  var chat_id = contents.message.from.id;
  var answer = "Hello";
  sendMessage (chat_id, answer);
}

once this is done I publish it as a web application I imposed that a new version Execute the app as my account Who has access to the app anyone and press on update i go to my telegram bot and any message i send does not reply to me. I also tried to follow other tutorials (the codes are very similar to each other) but always the same story, I follow the procedures, but when I go to write on the bot it gives me no sign of life. I thank all those who want to help me and I apologize for what for the more experienced will be a very simple problem Thank you


I added the line of code you suggested to me

function setWebhook () {
   var url = telegramUrl + "/ setWebhook? url =" + webAppUrl;
   var response = UrlFetchApp.fetch (url);
   Logger.log (response.getContentText ());
}

the result was the following

"[22-03-25 19: 00: 07: 208 CET] {" ok ": true," result ": true," description ":" Webhook is already set "}"

but my bot still keeps not responding.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you have no wrong in your code , you just need to deploy the web app using the old version of Google apps script to go to the old version find this and click on it

1

then deploy it

2

3

4

5

after u get the appurl use it in ur code and deploy it againe . after that go back to the new version of google app script , and every time you make changes and want to deploy use manage deployments

6

7

and you can contact me on telegram to help you , my username : @zedkrimo

about 4 years ago · Juan Pablo Isaza Report
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!