What You Get
- -Multi-source data gathering
- -Report generation with AI analysis
- -Email delivery automation
- -Customizable report sections
- -Schedule management
Step by Step
1. Set up data source integrations
Create connector modules for each data source: Google Analytics API (page views, top pages, users), Stripe API (revenue, new customers, failed payments, MRR), HubSpot API (new leads, deal stage changes, email stats), Slack API (brand mentions in channels). Each connector returns typed data or a connection error.
2. Build the data gathering pipeline
Create a scheduled job (cron, runs at 6:45 AM). It calls each connector in parallel, collects results, and handles failures gracefully. If a source fails, log the error and continue with partial data.
3. Implement AI report generation
Send gathered data to OpenAI with a structured prompt. Request: a 3-paragraph executive summary (highlights, concerns, recommendations), key metrics table, top 3 action items. Parse structured JSON response.
4. Create the email template
Build a responsive HTML email template with: header (date, company name), executive summary section, metrics table (metric, value, change %), highlights as bullet points, action items with priority badges. Use inline CSS for email client compatibility.
5. Set up email delivery
Use Resend API to send the report. Configure: sender name (Daily Report Bot), reply-to (manager email), recipient list from settings. Schedule delivery for 8 AM via cron after report generation.
6. Build the settings page
Create a Next.js settings page: toggle data sources on/off, set delivery time, manage recipient list, set timezone, test email button. Store settings in PostgreSQL.
7. Add monitoring and error handling
Track: report generation success/failure, delivery status, data source health. Send Slack alert if report generation fails. Log all runs with timestamps and data point counts.
Stack
Build This
Copy this prompt and paste it into Claude Code, OpenCode, Codex, or Cursor to build this recipe.
Common Failure Modes
- !API credentials expire silently
- !Report gets too long and gets ignored
- !Data source rate limits
- !Timezone confusion for scheduling
Implementation Notes
Store all API tokens encrypted. Keep reports to under 5 sections. Test each data source integration individually first.
Related skill: internal reporting agent
Want daily business report agent running in your business?
4M Labs can deploy daily business report agent as a production workflow:
- Connected to your tools and data sources
- Secured for your team with proper access controls
- Deployed with monitoring and error handling
- Documented for handoff and future maintenance