This workflow follows the Emailsend → Postgres recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "06a Reports: Daily & Weekly",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "days",
"triggerAtHour": 8
}
]
}
},
"id": "trg-daily",
"name": "Daily 08:00",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
200,
220
]
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtDay": [
1
],
"triggerAtHour": 8
}
]
}
},
"id": "trg-weekly",
"name": "Weekly Mon 08:00",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
200,
400
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "a1",
"name": "period",
"value": "daily",
"type": "string"
},
{
"id": "a2",
"name": "days",
"value": 1,
"type": "number"
}
]
},
"options": {}
},
"id": "set-daily",
"name": "Set Daily",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
420,
220
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "b1",
"name": "period",
"value": "weekly",
"type": "string"
},
{
"id": "b2",
"name": "days",
"value": 7,
"type": "number"
}
]
},
"options": {}
},
"id": "set-weekly",
"name": "Set Weekly",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
420,
400
]
},
{
"parameters": {
"jsCode": "const days = Number($json.days || 1);\nconst period = $json.period || 'daily';\nconst query = `SELECT '${period}' AS period, (SELECT count(*) FROM app.jobs WHERE discovered_at > now()-interval '${days} days') AS jobs_discovered, (SELECT count(*) FROM app.job_scores WHERE created_at > now()-interval '${days} days') AS jobs_scored, (SELECT count(*) FROM app.applications WHERE created_at > now()-interval '${days} days') AS applications, (SELECT count(*) FROM app.outreach WHERE sent_at > now()-interval '${days} days') AS outreach_sent, (SELECT count(*) FROM app.interactions WHERE direction='inbound' AND occurred_at > now()-interval '${days} days') AS replies, (SELECT count(*) FROM app.interactions WHERE classification='interview_request' AND occurred_at > now()-interval '${days} days') AS interview_requests;`;\nreturn [{ json: { query, period } }];"
},
"id": "code-metricsql",
"name": "Build Metrics Query",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
640,
300
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "={{ $json.query }}",
"options": {}
},
"id": "pg-metrics",
"name": "Gather Metrics",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.5,
"position": [
860,
300
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const m = $json;\nconst period = $('Build Metrics Query').item.json.period;\nconst payload = JSON.stringify(m).replace(/'/g, \"''\");\nconst text = `Job Search ${period} report\\n\\nDiscovered: ${m.jobs_discovered}\\nScored: ${m.jobs_scored}\\nApplications: ${m.applications}\\nOutreach sent: ${m.outreach_sent}\\nReplies: ${m.replies}\\nInterview requests: ${m.interview_requests}`;\nconst query = `INSERT INTO app.reports (period, payload) VALUES ('${period}', '${payload}'::jsonb);`;\nreturn [{ json: { query, text, period } }];"
},
"id": "code-report",
"name": "Build Report",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1080,
300
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "={{ $json.query }}",
"options": {}
},
"id": "pg-save",
"name": "Save Report",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.5,
"position": [
1300,
300
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"fromEmail": "={{ $env.GMAIL_ADDRESS }}",
"toEmail": "={{ $env.GMAIL_ADDRESS }}",
"subject": "=Job Search {{ $('Build Report').item.json.period }} report",
"emailFormat": "text",
"text": "={{ $('Build Report').item.json.text }}",
"options": {}
},
"id": "smtp-report",
"name": "Email Report",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [
1520,
300
],
"credentials": {
"smtp": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Daily 08:00": {
"main": [
[
{
"node": "Set Daily",
"type": "main",
"index": 0
}
]
]
},
"Weekly Mon 08:00": {
"main": [
[
{
"node": "Set Weekly",
"type": "main",
"index": 0
}
]
]
},
"Set Daily": {
"main": [
[
{
"node": "Build Metrics Query",
"type": "main",
"index": 0
}
]
]
},
"Set Weekly": {
"main": [
[
{
"node": "Build Metrics Query",
"type": "main",
"index": 0
}
]
]
},
"Build Metrics Query": {
"main": [
[
{
"node": "Gather Metrics",
"type": "main",
"index": 0
}
]
]
},
"Gather Metrics": {
"main": [
[
{
"node": "Build Report",
"type": "main",
"index": 0
}
]
]
},
"Build Report": {
"main": [
[
{
"node": "Save Report",
"type": "main",
"index": 0
}
]
]
},
"Save Report": {
"main": [
[
{
"node": "Email Report",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
postgressmtp
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
06a Reports: Daily & Weekly. Uses postgres, emailSend. Scheduled trigger; 9 nodes.
Source: https://github.com/AskariJafri/job-search-os/blob/main/n8n/workflows/06-reports/report.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Disparador 1.8. Uses itemLists, postgres, emailSend, httpRequest. Scheduled trigger; 85 nodes.
This n8n workflow runs daily to analyze active customer behavior, engineers relevant features from usage and transaction data, applies a machine learning or AI-based model to predict churn probability
This n8n workflow automates continuous compliance monitoring across IT, OT, and cloud environments by aggregating security controls, validating policies (ISO 27001, NIST, GDPR, SOC2), detecting anomal
Automates real-time market monitoring, technical analysis, AI-powered signal generation for cryptocurrencies (and stocks), filters high-confidence trades, and delivers actionable alerts via multiple c
HIPAA-Compliant Healthcare Data Synchronization. Uses httpRequest, postgres, mongoDb, elasticsearch. Scheduled trigger; 19 nodes.