Webhook‑only data vs. webhook + GET for reliable card state in high‑turnover Trello boards
0 reputation · 24 Nov 2022, 00:33 UTC
0 reputation · 24 Nov 2022, 00:33 UTC
Ensure that an automation listening to Trello card‑creation webhooks receives the complete, current state of the card despite possible updates, moves, or deletions occurring between the webhook dispatch and any follow‑up request.
The webhook delivers only basic fields (id, name, idBoard). To obtain additional details one can issue a GET /cards/{id} call, but under high turnover the card may have changed or been removed by the time the GET executes, leading to 404/410 responses or stale data. Relying solely on the webhook payload avoids extra API calls and race conditions but limits the information available to downstream logic.
Given the documented trade‑off between minimizing latency/API usage (webhook‑only) and guaranteeing up‑to‑date card state (webhook + GET) under concurrent modifications, which approach best balances reliability and resource consumption for a production‑scale integration?
For boards that churn cards at a high rate, a hybrid strategy—process the webhook payload first and issue a GET /cards/{id} only when the payload is missing a required field—offers the best trade‑off between reliability and API costs. It guarantees the latest state for critical operations while keeping the average number of API calls close to the webhook‑only baseline.
id, name, idBoard, and minimal state; they are not guaranteed to be the final version of the card.fields query parameter can limit the response to the fields you actually need, reducing payload size and rate‑limit impact.desc, labels, due) in the payload. If all are present, proceed without additional API calls.unknown, issue a GET request with ?fields=desc,labels,due (adjust the list to your needs). Handle 404/410 by treating the card as deleted or by retrying after a short back‑off.X-RateLimit-Remaining header to monitor consumption. If the remaining quota drops below a threshold (e.g., 100 requests), throttle the conditional GETs or batch them.Because the GET is conditional, the average number of calls per event stays close to 1 (the webhook) plus p where p is the probability that the payload lacks a required field. On a board with 5 000 card events per minute and p ≈ 0.1, you’d issue roughly 500 extra GETs per minute—well below Trello’s 10 000‑request‑per‑10‑minute quota for most apps.
In practice, the hybrid model keeps latency low (the conditional GET is only one HTTP round‑trip) and eliminates the risk of missing updates that a webhook‑only design would suffer from during downtime. It also avoids the 404/410 pitfalls of a blanket GET approach by only querying when the data is incomplete.
To fine‑tune the threshold for conditional GETs and ensure you stay comfortably within rate limits, could you share the average number of card‑creation/update events per minute on the board? That will help set the p value and the back‑off window.
Use comments to ask for clarification. Post a solution as an answer.
31,275 reputation · 24 Nov 2022, 04:56 UTC
One refinement to the hybrid approach: a card that receives several events in quick succession can still trigger one conditional GET per event. Coalescing by card id closes that gap — buffer events briefly (a 1–2 second settle window is a reasonable starting point), then issue a single GET per card. Since most automations only need the latest state, this last-write-wins fetch is both fresher and cheaper than per-event fetching.
action.date field to sequence events rather than arrival order, or the settle window can discard the wrong one.Rate-limit thresholds have changed over time, so load-test at your expected peak webhook rate and watch for 429 responses before hard-coding any fetch budget.