Summarize Daily User Activity
Query recent user activity from Postgres, summarize key metrics, and post a concise Slack report.
Last updated
October 1, 2025
Connectors used
Tags
Key Takeaways
- Automated daily database reporting - Queries your PostgreSQL database every morning and turns raw activity data into a formatted Slack summary
- No manual SQL needed - The workflow runs the query, formats the results, and sends the report automatically
- AI-powered summaries - GPT-4.1 transforms raw data into a clear, actionable Slack message with metrics and next steps
- Fully scheduled - Runs daily at 9am with no manual intervention required
What This Workflow Does
This Needle workflow connects to your PostgreSQL database on a daily schedule, runs a custom SQL query to fetch recent user activity, formats the results with a JavaScript code node, and then uses GPT-4.1 to generate a concise Slack report. The final summary is posted directly to your Slack channel so your team starts the day with fresh activity data.
Use cases:
- Monitoring daily user activity and engagement metrics from your product database
- Getting automated status reports on processing results grouped by email and status
- Replacing manual SQL queries with scheduled, AI-summarized Slack reports
How It Works
| Step | What Happens |
|---|---|
| 1. Scheduled trigger | Fires every day at 9am (Europe/Berlin timezone) |
| 2. PostgreSQL query | Runs a custom SQL query against your database to fetch activity from the last 24 hours, grouped by email and status |
| 3. Code formatting | A JavaScript node transforms the raw query results into a readable text report |
| 4. AI summary | GPT-4.1 takes the formatted data and creates a scannable Slack message with metrics, highlights, and suggested actions |
| 5. Slack delivery | The AI-generated summary is posted to your configured Slack channel |
Workflow Nodes
| Node | Role |
|---|---|
| Scheduled Trigger | Runs daily at 9am Europe/Berlin |
| PostgreSQL Custom Query | Executes a SQL query to fetch activity data from the last 24 hours |
| Code (JavaScript) | Formats query results into a structured text report |
| AI Node (GPT-4.1) | Generates a professional Slack message with metrics and actionable insights |
| Slack Send Message | Posts the summary to your Slack channel |
Setup Instructions
- Add the workflow template to Needle
- Connect your PostgreSQL database via the Pipedream connector
- Update the SQL query in the PostgreSQL node to match your database schema and tables
- Connect your Slack account and set the target channel
- Adjust the schedule and timezone if needed
Customization
| What You Can Change | How |
|---|---|
| SQL query | Edit the query in the PostgreSQL node to pull different data from your tables |
| Schedule | Change the cron expression in the trigger node (default: daily at 9am) |
| Timezone | Update the timezone setting in the trigger node (default: Europe/Berlin) |
| Slack channel | Change the target channel in the Slack node (default: #general) |
| Report format | Edit the AI prompt to change how the summary is structured and what it highlights |
| Code formatting | Modify the JavaScript code node to adjust how raw data is preprocessed before the AI step |
FAQ
Q: What databases are supported? A: The workflow uses a PostgreSQL connector via Pipedream. You need a PostgreSQL-compatible database.
Q: Can I change the SQL query? A: Yes. The SQL query in the PostgreSQL node is fully customizable. Update it to match your own tables and columns.
Q: How does the AI format the report? A: GPT-4.1 is instructed to create a structured Slack message with emoji headers, summary metrics, breakdowns by user or email, and suggested next steps for any issues found. It avoids markdown formatting since the output is for Slack.
Q: Can I send the report to multiple channels? A: You can duplicate the Slack node or adjust the configuration to post to additional channels.
Want to showcase your own workflows?
Become a Needle workflow partner and turn your expertise into recurring revenue.