Skip to main content
Keep stakeholders in the loop without forcing them to log in. A Monday-morning email with last week’s numbers, insights, and a recommendation.
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

1

Start a new workflow

Workflows > New Workflow. Name it Weekly Team Digest.
2

Add a Schedule trigger

Click Add Trigger > Schedule. Use cron:
cron(0 9 ? * MON *)
Monday 9:00 AM UTC. Adjust to your team’s timezone by shifting the hour.
3

Add database queries

Add three Database Query actions, one per metric:
  • new_leadsSELECT count(*) FROM crm_contacts WHERE created_at > now() - interval '7 days'
  • new_ordersSELECT count(*), sum(total) as revenue FROM orders WHERE created_at > now() - interval '7 days' AND status = 'paid'
  • top_contentSELECT title, slug, views FROM blog_posts ORDER BY views DESC LIMIT 3
Name each output (e.g., new_leads, new_orders, top_content) so you can reference them later.
4

Add an AI Generation action

Click + Add Action > AI Generation. Prompt:
Generate a friendly weekly digest email for an internal team.
Tone: warm, concise, a little conversational. ~150 words.
Include one insight and one recommendation.

Data:
- New leads this week: {{new_leads.count}}
- New paid orders: {{new_orders.count}} (${{new_orders.revenue}})
- Top blog posts:
  {{#each top_content}}- {{title}} ({{views}} views)
  {{/each}}

Output format: subject line on line 1, blank line, then body.
Wrap the body in HTML for email (use <p>, <h3>, <ul>).
Name the output digest.
5

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}}
6

Save and enable

Save and flip the Enabled toggle. The first digest goes out next Monday at 9 AM UTC.
Want to test sooner? Change the schedule temporarily to rate(5 minutes), enable, wait one run, verify, then switch back to the weekly cron. Digest workflows are safe to test this way because they’re read-only.

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:
<h2>Weekly digest — {{format_date(now, 'MMM D, YYYY')}}</h2>

<h3>By the numbers</h3>
<ul>
  <li><strong>New leads:</strong> {{new_leads.count}}</li>
  <li><strong>New orders:</strong> {{new_orders.count}} (${{new_orders.revenue}})</li>
</ul>

<h3>Top content</h3>
<ul>
  {{#each top_content}}<li>{{title}} — {{views}} views</li>{{/each}}
</ul>
Cheaper, deterministic, but less engaging than the AI version.

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
Add as many Database Query actions as you need, reference them in the AI prompt, and the digest picks them up.

Test It

1

Change the trigger to every 5 minutes

Temporarily set the cron to rate(5 minutes) so you don’t wait a week.
2

Enable and wait

Flip the toggle on. A run should appear in the Runs tab within 5 minutes.
3

Check your inbox

The digest lands at the To: address. Verify the numbers match what you expect, and that the AI copy reads naturally.
4

Switch back to weekly

Change the trigger back to cron(0 9 ? * MON *) and save. Forgetting this step means you get a digest every 5 minutes until you turn it off.

Troubleshooting

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.
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'.
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.
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.
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