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 →
{
"nodes": [
{
"name": "Cron",
"type": "n8n-nodes-base.cron",
"position": [
300,
250
],
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"typeVersion": 1
},
{
"name": "Function",
"type": "n8n-nodes-base.function",
"position": [
500,
250
],
"parameters": {
"functionCode": "var today = new Date();\nvar date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();\nvar time = today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\nvar dateTime = date+' '+time;\n\nitems[0].json.sensor_id = 'humidity01';\nitems[0].json.value = Math.ceil(Math.random()*100);\nitems[0].json.time_stamp = dateTime;\nitems[0].json.notification = false;\n\nreturn items;"
},
"typeVersion": 1
},
{
"name": "Postgres",
"type": "n8n-nodes-base.postgres",
"position": [
680,
250
],
"parameters": {
"table": "n8n",
"columns": "sensor_id,value,time_stamp,notification"
},
"credentials": {
"postgres": "<your credential>"
},
"typeVersion": 1
}
],
"connections": {
"Cron": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "Postgres",
"type": "main",
"index": 0
}
]
]
}
}
}
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.
postgres
About this workflow
Generate And Insert Data Into A Postgres Database. Uses postgres. Scheduled trigger; 3 nodes.
Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →