Before you start: make sure you have tables to query (CRM contacts, orders, analytics) and a sending domain configured. See Send Emails if you haven’t set up email sending yet.
The Flow at a Glance
1. Weekly schedule
Monday 9 AM UTC
2. Query stats
Leads, orders, views
3. AI summary
Friendly prose digest
4. Email team
Send to the list
Step 1: Build the Workflow
Add a Schedule trigger
Click Add Trigger > Schedule. Use cron:Monday 9:00 AM UTC. Adjust to your team’s timezone by shifting the hour.
Add database queries
Add three Database Query actions, one per metric:
- new_leads —
SELECT count(*) FROM crm_contacts WHERE created_at > now() - interval '7 days' - new_orders —
SELECT count(*), sum(total) as revenue FROM orders WHERE created_at > now() - interval '7 days' AND status = 'paid' - top_content —
SELECT title, slug, views FROM blog_posts ORDER BY views DESC LIMIT 3
new_leads, new_orders, top_content) so you can reference them later.Add a Send Email action
Click + Add Action > Send Email. Configure:
- To:
team@yourcompany.com(or a distribution list) - From: your verified sending address
- Subject:
{{digest.subject}} - HTML Body:
{{digest.body}}
Simple Alternative (No AI)
If you don’t want AI copy, replace the AI action with a plain HTML template in the Send Email body:Customize What’s in the Digest
Every team cares about different things. Swap out queries to match. Examples:- New sign-ups:
SELECT count(*) FROM users WHERE created_at > now() - interval '7 days' - Active subscribers:
SELECT count(*) FROM subscriptions WHERE status = 'active' - Churn this week:
SELECT count(*) FROM subscriptions WHERE cancelled_at > now() - interval '7 days' - Support tickets:
SELECT count(*) FROM tickets WHERE created_at > now() - interval '7 days' AND status = 'open' - Top pages by views: pulled from your analytics table
Test It
Change the trigger to every 5 minutes
Temporarily set the cron to
rate(5 minutes) so you don’t wait a week.Check your inbox
The digest lands at the To: address. Verify the numbers match what you expect, and that the AI copy reads naturally.
Troubleshooting
Digest not sending
Digest not sending
Check the workflow’s Runs tab. If the run shows a failure on the Send Email step, it’s usually one of: the sending API key is revoked (rotate it in env vars), the From address isn’t verified with your email provider, or the To address has hard-bounced in the past and is on the suppression list.
Numbers look wrong
Numbers look wrong
Timezone is usually the culprit.
now() on Postgres is UTC by default, which can throw off “this week” calculations if your team operates in another timezone. Specify explicitly: WHERE created_at > now() AT TIME ZONE 'America/New_York' - interval '7 days'.AI copy too generic
AI copy too generic
Prompts that say “write a digest” get generic output. Improve by: giving a voice example (“Sound like Patrick from Basecamp’s launch emails”), listing what NOT to include (“no fluff, no emoji, no corporate speak”), and providing a past digest as a reference.
Recipients aren't getting it
Recipients aren't getting it
Check spam folders first. Then verify the sending domain is authenticated (SPF, DKIM, DMARC) — unauthenticated emails to corporate Gmail/Outlook often get silently dropped. See Send Emails for domain setup.
Database query times out
Database query times out
Large tables without indexes can make the query slow. Add an index on
created_at, or use a materialized view that’s refreshed daily. Your workflow reads the view instead of the raw table.What’s Next?
Send Emails
Set up verified sending for reliable delivery
SEO Rank Alerts
Add SEO changes to your digest
Workflows Basics
More on triggers, actions, and runs