Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

405
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda