how to get the data from the telegram bot with google app script.
I have this script that extracts the last messages that I send to the bot from my cell phone. These messages are placed on the right of the screen.
Now I also send text to the bot from the script, and the text is placed on the left of the screen.
The question is how do I get the data on the left? Specifically, I need to get the data on the left, which is several photos.
is it possible to get them? I have tried in many ways and I have not been able to get the data that is put on the left of the screen.
function obtenerUltimosMensajes() {
var token = TELEGRAM_TOKEN; // Reemplazar con el token de acceso de tu bot de Telegram
var apiUrl = 'https://api.telegram.org/bot' + token + '/getUpdates?limit=5';
var response = UrlFetchApp.fetch(apiUrl);
var jsonResponse = JSON.parse(response.getContentText());
if (jsonResponse.ok) {
var resultado = jsonResponse.result;
if (resultado.length > 0) {
var mensajes = [];
for (var i = 0; i < resultado.length; i++) {
var mensaje = resultado[i].message;
var texto = mensaje.text;
mensajes.push(texto);
}
Logger.log(mensajes);
} else {
Logger.log('No se encontraron mensajes en el bot');
}
} else {
Logger.log('Error al obtener mensajes: ' + jsonResponse.description);
}
}