Workflow

Summarize Daily User Activity

Query recent user activity from Postgres, summarize key metrics, and post a concise Slack report.

Needle Team

Last updated

October 1, 2025

Connectors used

postgresql
Slack

Tags

User AnalyticsDatabase AutomationEngagement MetricsProduct Intelligence

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

StepWhat Happens
1. Scheduled triggerFires every day at 9am (Europe/Berlin timezone)
2. PostgreSQL queryRuns a custom SQL query against your database to fetch activity from the last 24 hours, grouped by email and status
3. Code formattingA JavaScript node transforms the raw query results into a readable text report
4. AI summaryGPT-4.1 takes the formatted data and creates a scannable Slack message with metrics, highlights, and suggested actions
5. Slack deliveryThe AI-generated summary is posted to your configured Slack channel

Workflow Nodes

NodeRole
Scheduled TriggerRuns daily at 9am Europe/Berlin
PostgreSQL Custom QueryExecutes 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 MessagePosts the summary to your Slack channel

Setup Instructions

  1. Add the workflow template to Needle
  2. Connect your PostgreSQL database via the Pipedream connector
  3. Update the SQL query in the PostgreSQL node to match your database schema and tables
  4. Connect your Slack account and set the target channel
  5. Adjust the schedule and timezone if needed

Customization

What You Can ChangeHow
SQL queryEdit the query in the PostgreSQL node to pull different data from your tables
ScheduleChange the cron expression in the trigger node (default: daily at 9am)
TimezoneUpdate the timezone setting in the trigger node (default: Europe/Berlin)
Slack channelChange the target channel in the Slack node (default: #general)
Report formatEdit the AI prompt to change how the summary is structured and what it highlights
Code formattingModify 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.

Try Needle today

Streamline AI productivity at your company today

Join thousands of people who have transformed their workflows.

Agentic workflowsAutomations, meet AI agents
AI SearchAll your data, searchable
Chat widgetsDrop-in widget for your website
Developer APIMake your app talk to Needle
    Needle LogoNeedle
    Like many websites, we use cookies to enhance your experience, analyze site traffic and deliver personalized content while you are here. By clicking "Accept", you are giving us your consent to use cookies in this way. Read our more on our cookie policy .