I would like to create a weekly report, and in this report, I have cards in 3 lists. Each of these lists, has about 50 cards. I would like to generate a report that looks at all these cards in the list and send an email (with the card link) for all the cards that have NOT had any comments in the last 7 days.
I see the Inactive (but that tracks moving of the card, description changes, etc.) - I do not want that. I only want to track COMMENTS activity.
I have tried Dashcard (didn't seem to be able to do this), and I've tried doing schedule automation, but unable to find a way to do this properly either.
Does anyone have any ideas on how to do this properly?
Thanks, I figured as much. I was able to code something in Python talking to Trello's API. So if anyone else needs that solution, here are the quick steps below... hope it helps others that need this (I changed mine to 14 days):
import os
import requests
from datetime import datetime, timedelta
# --- CONFIGURATION ---
API_KEY = os.getenv('TRELLO_API_KEY')
TOKEN = os.getenv('TRELLO_TOKEN')
ELASTIC_API_KEY = os.getenv('ELASTIC_EMAIL_API_KEY')
# Replace the idList number with yours
LIST_IDS = ['idList1', 'idList2', 'idList3']
DAYS_THRESHOLD = 14
def get_stale_cards():
report_content = ""
now = datetime.utcnow()
cutoff_date = now - timedelta(days=DAYS_THRESHOLD)
found_stale = False
for list_id in LIST_IDS:
# 1. Fetch List Name with error handling
list_url = f"https://api.trello.com/1/lists/{list_id}?key={API_KEY}&token={TOKEN}"
resp = requests.get(list_url)
if resp.status_code != 200:
print(f"Error fetching list {list_id}: {resp.text}")
continue
list_name = resp.json().get('name', 'Unknown List')
# 2. Fetch Cards with Member details expanded
cards_url = f"https://api.trello.com/1/lists/{list_id}/cards?key={API_KEY}&token={TOKEN}&members=true&member_fields=fullName"
cards_resp = requests.get(cards_url)
if cards_resp.status_code != 200:
print(f"Error fetching cards for {list_id}: {cards_resp.text}")
continue
cards = cards_resp.json()
stale_in_list = []
for card in cards:
# 3. Fetch the most recent comment action
actions_url = f"https://api.trello.com/1/cards/{card['id']}/actions?key={API_KEY}&token={TOKEN}&filter=commentCard&limit=1"
actions_resp = requests.get(actions_url)
if actions_resp.status_code != 200:
continue
actions = actions_resp.json()
is_stale = False
if not actions:
# No comments ever recorded
is_stale = True
else:
# Check if the most recent comment is older than 7 days
last_comment_time = datetime.strptime(actions[0]['date'], '%Y-%m-%dT%H:%M:%S.%fZ')
if last_comment_time < cutoff_date:
is_stale = True
if is_stale:
# Extract and format member names
member_names = [m['fullName'] for m in card.get('members', [])]
members_display = f" — <em>{', '.join(member_names)}</em>" if member_names else " — <em>(No members)</em>"
stale_in_list.append(f"<li><a href='{card['url']}'>{card['name']}</a>{members_display}</li>")
if stale_in_list:
found_stale = True
report_content += f"<h3>List: {list_name}</h3><ul>" + "".join(stale_in_list) + "</ul>"
return report_content if found_stale else None
def send_email(content):
url = "https://api.elasticemail.com/v2/email/send"
params = {
"apikey": ELASTIC_API_KEY,
"subject": "WEEKLY REPORT: Trello Cards without Comments",
"from": "name@verifieddomain.com",
"fromName": "Trello Automator",
"to": "your@email.com",
"bodyHtml": f"""
<html>
<body style='font-family: Arial, sans-serif; line-height: 1.6; color: #333;'>
<h2 style='color: #d9534f;'>Trello Inactivity Report</h2>
<p>The following cards in your tracked lists have not received a comment in the last 14 days:</p>
<hr>
{content}
<br>
<p style='font-size: 0.8em; color: #777;'>This is an automated weekly report.</p>
</body>
</html>
""",
"isTransactional": True
}
response = requests.post(url, data=params)
print(f"Elastic Email Response: {response.text}")
if __name__ == "__main__":
if not all([API_KEY, TOKEN, ELASTIC_API_KEY]):
print("CRITICAL ERROR: Missing GitHub Secrets (API_KEY, TOKEN, or ELASTIC_API_KEY).")
else:
report_body = get_stale_cards()
if report_body:
send_email(report_body)
print("Report generated and email sent.")
else:
print("Success: No stale cards found.")
name: Weekly Trello Report
on:
schedule:
- cron: '0 10 * * 1' # 10:00 AM UTC = 6:00 AM EDT
workflow_dispatch: # Allows you to click "Run Workflow" manually
jobs:
run-report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4 # Updated version
- name: Setup Python
uses: actions/setup-python@v5 # Updated version
with:
python-version: '3.11' # Using a slightly newer Python version
- name: Install Requests
run: pip install requests
- name: Execute Script
env:
TRELLO_API_KEY: ${{ secrets.TRELLO_API_KEY }}
TRELLO_TOKEN: ${{ secrets.TRELLO_TOKEN }}
ELASTIC_EMAIL_API_KEY: ${{ secrets.ELASTIC_EMAIL_API_KEY }}
run: python trello_report.pySave and commit that file.
This step is important because you want to store secret keys in github in their private keys area so that it is never saved in the code itself. This is for security risk. Once you copy and paste it into these keys, you can't get the keys again, cause if you edit it, it will erase the keys. So just copy and paste, then leave it.
By now, everything is now completed. It's time for you to test run it.
On a weekly basis on Monday at 5am. This will send me an email with all the cards that have not have any comments on it within the last 14 days in 3 of my lists. In the email, it'll categorize the list, and then display the cards (with it hyperlinked already) so its easier to access to, and who is responsible (ie. members assigned to that card) in italics next to each card.
This allows me, and my team to see which clients we need to touch base with.
Hello @Jeremy Choi
I do not believe Trello supports this natively in the exact way you need.
The main reason is that Trello’s native activity/inactivity signals are broader than comments only. A card can be “active” because of several types of changes, so that is not the same as saying there has been a comment in the last 7 days.
That distinction matters here:
From what I know, Trello does not have a native report or filter built specifically for comment inactivity. The closest built-in option is Activity → Comments, but that is just a manual activity view, not a scheduled exception report.
If you need an exact result such as cards in these 3 lists with no comments in the last 7 days
then I would look at either:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.