Is there a way to create a weekly email containing the activity information on the Admin Dashboard page? Primarily the items under Community Health and User Metrics.
AI-generated summary
The discussion revolves around automating weekly email reports of Admin Dashboard data in Discourse. Sean_Li asks if there’s a way to send a weekly email with Community Health and User Metrics data. Moin suggests using Data Explorer and the automation plugin for automated personal messages, referencing a guide on automated emails. Sean_Li inquires if this can be done with stock Discourse, as it already provides the needed visualizations. bitmage shares CSS to make the Admin Dashboard printable, allowing manual PDF generation. They also attempt automation via a bash script using headless Chromium to print the dashboard to PDF, but face issues with authentication (404 errors) and uncertainty about chart loading during the process.
You can use Data Explorer to get the data and the automation plugin to send the results of the query as a personal message.
is there no way to do this with stock Discourse? as it already has the visualizations that I need for the information.
I added this CSS to my theme. This will allow you to print the admin dashboard without the sidebar and other unnecessary widgets showing up. In general this makes other pages more printable too. I just printed mine to PDF and I could manually do this every Sunday let’s say in order to store snapshots of my site statistics.
@media print {
#main-outlet-wrapper {
display: block;
}
.sidebar-wrapper, .d-page-header, nav {
display: none;
}
#main-outlet {
width: 100%;
padding: 2em !important;
max-width: unset;
}
}
In terms of automating the print so it could be put in a cron job, so far I have not been successful. Here is an attempt. Currently returns 404, I assume because auth is failing, though I did copy cookies from devtools. Maybe I’m missing some nuance of auth. Also I don’t know if the charts would load properly before the print is triggered.
#!/bin/bash
# Define URL and output filename
DATE=$(date +"%Y-%m-%d")
OUTPUT="${DATE} Site Report.pdf"
DOMAIN="mysite.org"
COOKIES_DB="$HOME/.config/chromium/Default/Cookies"
COOKIES_FILE="./cookies.txt" # copy cookies out of devtools and place here
COOKIE_HEADER=$(cat $COOKIES_FILE)
#echo "$COOKIE_HEADER"
# Run Chrome or Chromium headless to print to PDF
chromium --headless --disable-gpu --print-to-pdf="$OUTPUT" \
--extra-headers="Cookie: $COOKIE_HEADER" \
--extra-headers="Accept: text/html" \
--extra-headers="Accept-Encoding: gzip" \
--extra-headers="Accept-Language: en-US,en;q=0.9" \
"https://$DOMAIN/admin"
echo "Saved to $OUTPUT"