Ayuda para integrar Google Apps Script con Trello y superar el límite de solicitudes

Sistema
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 12, 2024

 

 

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:

  1. Recolectar datos de mis clientes mediante un formulario HTML y almacenarlos en una hoja de Google Sheets.
  2. Crear automáticamente una tarjeta en Trello con estos datos y obtener el correo electrónico asociado a dicha tarjeta para darle seguimiento.
  3. 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:

  1. Collect customer data via an HTML form and store it in a Google Sheets document.
  2. Automatically create a Trello card with this data and retrieve the email address associated with the card for further tracking.
  3. 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
  };
}

1 answer

0 votes
Carolina Lopez
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2024

Hi!

I looked into the error message you received and it seems to be related to Google Apps Script quotas rather than the Trello API. This conclusion is backed by the fact that everything is functioning correctly with Postman.
I suggest checking Google Community to see if they have any suggestions on how to avoid reaching this quota. I came across a thread that might be helpful to you, although I haven't tested their suggestion yet:
https://support.google.com/docs/thread/229846554/exception-service-invoked-too-many-times-for-one-day-urlfetch?hl=en

If you don't find a solution through the Google Community or Google support, I recommend posting your issue in our developer community. We have a number of Trello Engineers who are active there, and they'd be happy to give some guidance for more advanced topics like this.

https://community.developer.atlassian.com/c/trello

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events