Hola equipo de soporte de Trello,
Estoy desarrollando una web app utilizando Google Apps Script, y necesito integrar Trello en mi flujo de trabajo para crear tarjetas a partir de los datos que recojo con un formulario y guardo en una hoja de Google Sheets.
Mi objetivo es lo siguiente:
- Recolectar datos de mis clientes mediante un formulario HTML y almacenarlos en una hoja de Google Sheets.
- Crear automáticamente una tarjeta en Trello con estos datos y obtener el correo electrónico asociado a dicha tarjeta para darle seguimiento.
- Posteriormente, actualizar la tarjeta con nuevos datos (como comentarios) cuando se actualice la hoja de cálculo o se realice una nueva entrada desde el formulario.
He intentado implementar esto utilizando la API de Trello, pero siempre me encuentro con el error: "Servicio solicitado demasiadas veces para un mismo día: UrlFetch". Probé usando una URL JSON para la solicitud, pero sigo obteniendo el mismo error. Curiosamente, cuando pruebo la API desde otras herramientas como Postman, funciona correctamente, por lo que parece ser un problema relacionado con Google Apps Script.
Mis preguntas son:
- ¿Hay alguna alternativa para superar este límite de solicitudes y obtener el correo de la tarjeta creada en Trello?
- ¿Existe alguna otra solución recomendada para integrar Trello con Google Apps Script, quizás utilizando webhooks o alguna otra técnica?
Agradezco cualquier sugerencia o guía para resolver este problema, ya que he buscado soluciones sin éxito.
Gracias de antemano por su ayuda-
----
Hi Trello Support Team,
I am developing a web app using Google Apps Script, and I need to integrate Trello into my workflow to create cards from the data collected via a form and stored in a Google Sheets document.
Here’s what I’m trying to achieve:
- Collect customer data via an HTML form and store it in a Google Sheets document.
- Automatically create a Trello card with this data and retrieve the email address associated with the card for further tracking.
- Later, update the card with new data (such as comments) when the spreadsheet is updated or when a new entry is made through the form.
I have tried implementing this using the Trello API, but I always encounter the following error: "Service invoked too many times for one day: UrlFetch". I also tried using a JSON URL for the request, but I still face the same issue. Interestingly, when testing the API with tools like Postman, it works perfectly, which suggests the problem is related to how Google Apps Script handles the requests.
My questions are:
- Is there any alternative to bypass this request limit and retrieve the email associated with the card created in Trello?
- Are there any other recommended solutions for integrating Trello with Google Apps Script, perhaps using webhooks or another technique?
I would appreciate any guidance or suggestions to resolve this issue, as I have been unable to find a solution.
Thanks in advance for your help.
--
url json: https://api.trello.com/1/cards/${TRELLO_CARD_ID}/actions/comments?key=${TRELLO_API_KEY}&token=${TRELLO_TOKEN}&text=${encodeURIComponent(comment)}
api:
function doGet() {
return HtmlService.createHtmlOutput(getForm())
.setTitle('Formulario de Solicitud');
}
function getForm() {
return `
<form id="myForm">
<label for="nombre">Nombre:</label><br>
<input type="text" id="nombre" name="nombre" required><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br>
<label for="descripcion">Descripción:</label><br>
<textarea id="descripcion" name="descripcion" required></textarea><br>
<input type="submit" value="Enviar">
</form>
<div id="output"></div>
<script>
document.getElementById('myForm').addEventListener('submit', function(e) {
e.preventDefault();
document.getElementById('output').innerHTML = 'Procesando...';
google.script.run.withSuccessHandler(function(result) {
document.getElementById('output').innerHTML = 'Solicitud enviada. ID de la tarjeta: ' + result;
}).procesarFormulario(this);
});
</script>
`;
}
function procesarFormulario(form) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME);
if (!sheet) {
sheet = SpreadsheetApp.getActiveSpreadsheet().insertSheet(SHEET_NAME);
sheet.appendRow(["Nombre", "Email", "Descripción", "ID Tarjeta", "Email Tarjeta"]);
}
var nombre = form.nombre;
var email = form.email;
var descripcion = form.descripcion;
var tarjetaInfo = crearTarjetaTrello(nombre, email, descripcion);
sheet.appendRow([nombre, email, descripcion, tarjetaInfo.id, tarjetaInfo.email]);
return tarjetaInfo.id;
}
function crearTarjetaTrello(nombre, email, descripcion) {
var data = {
'idList': TRELLO_LIST_ID,
'name': nombre + ' - ' + email,
'desc': descripcion,
'key': TRELLO_API_KEY,
'token': TRELLO_TOKEN,
'emailSettings': true
};
var options = {
'method': 'post',
'payload': data
};
var response = UrlFetchApp.fetch(url, options);
var json = JSON.parse(response.getContentText());
return {
id: json.id,
email: json.emailSettings.email
};
}