AutomationFlowsData & Sheets › Stage Automation

Stage Automation

Stage Automation. Uses postgresTrigger, postgres. Event-driven trigger; 12 nodes.

Event trigger★★★★☆ complexity12 nodesPostgres TriggerPostgres
Data & Sheets Trigger: Event Nodes: 12 Complexity: ★★★★☆ Added:

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 →

Download .json
{
  "name": "Stage Automation",
  "nodes": [
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "tableName": {
          "__rl": true,
          "value": "stage_status",
          "mode": "list",
          "cachedResultName": "stage_status"
        },
        "additionalFields": {},
        "options": {}
      },
      "type": "n8n-nodes-base.postgresTrigger",
      "typeVersion": 1,
      "position": [
        -1296,
        384
      ],
      "id": "053e23a8-35c6-4b1a-be63-ddb77a693b62",
      "name": "Postgres Trigger",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -1072,
        384
      ],
      "id": "c5afeb0a-9168-45e6-8d60-2ba8ae1b8e97",
      "name": "Wait"
    },
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "value": "public",
          "mode": "list",
          "cachedResultName": "public"
        },
        "table": {
          "__rl": true,
          "value": "stage_status",
          "mode": "list",
          "cachedResultName": "stage_status"
        },
        "limit": 1,
        "where": {
          "values": [
            {
              "column": "id",
              "value": "={{ $json.payload.id }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -848,
        384
      ],
      "id": "3cc78110-67de-4781-8d97-ba61303bd1c1",
      "name": "Select rows from a table",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "10c3f078-f089-485b-b0d7-7c802bfc1018",
              "leftValue": "={{ $json.deleted_at }}",
              "rightValue": "={{null}}",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "2d52905e-d739-4269-9de7-5a8988b5ed9d",
              "leftValue": "={{ $json.processed }}",
              "rightValue": "={{false}}",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -624,
        384
      ],
      "id": "7cbbbecb-5e5e-4e0b-be3c-5d205a7c7850",
      "name": "If"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.stage.toUpperCase() }}",
                    "rightValue": "A",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "b8e14477-739e-4fae-9f08-de7bcd150291"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "381e3032-722a-4469-8e6b-bfae5b8afdda",
                    "leftValue": "={{ $json.stage.toUpperCase() }}",
                    "rightValue": "B",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "fdde8f30-12e1-4507-90c3-3dfb0900dd76",
                    "leftValue": "={{ $json.stage.toUpperCase() }}",
                    "rightValue": "C",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "cabc2fb1-5d6e-4b52-9acb-f0ef027cc04e",
                    "leftValue": "={{ $json.stage.toUpperCase() }}",
                    "rightValue": "D",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "9c3457bd-06e7-448d-9f1b-33407b22d681",
                    "leftValue": "={{ $json.stage.toUpperCase() }}",
                    "rightValue": "E",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "970db690-63ba-4955-aa9c-f09e1014ac38",
                    "leftValue": "={{ $json.stage.toUpperCase() }}",
                    "rightValue": "F",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "16d30b39-e931-434a-91c8-2eb6d9bb5a66",
                    "leftValue": "={{ $json.stage.toUpperCase() }}",
                    "rightValue": "Z",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        -400,
        304
      ],
      "id": "d29ae4e3-8137-4c08-82a5-eb7adf5a50d3",
      "name": "Switch"
    },
    {
      "parameters": {
        "numberInputs": 7
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        64,
        304
      ],
      "id": "77096ef1-5abe-4213-bf96-4bbc72ba4ac0",
      "name": "Merge"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "p84C6yGnVEkphVcC",
          "mode": "list",
          "cachedResultUrl": "/workflow/p84C6yGnVEkphVcC",
          "cachedResultName": "Notify"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "type": "debug",
            "contents": "='Workflow Ran'"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "type",
              "displayName": "type",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "contents",
              "displayName": "contents",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        496,
        384
      ],
      "id": "6c37ee30-86d1-4a76-ba89-9e18ac03a75d",
      "name": "Call 'Notify'"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "UPDATE stage_status\n  SET processed = TRUE\n  WHERE id = '{{ $('Select rows from a table').item.json.id }}';",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        272,
        384
      ],
      "id": "50a6b773-01fa-4475-9360-c0e4df5dd60c",
      "name": "Set Stage Status to Processed",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "wyu9mtRgOzTKknDJ",
          "mode": "list",
          "cachedResultUrl": "/workflow/wyu9mtRgOzTKknDJ",
          "cachedResultName": "Stage B"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "applicantId": "={{ $('Select rows from a table').item.json.applicant_id }}"
          },
          "matchingColumns": [
            "applicantId"
          ],
          "schema": [
            {
              "id": "applicantId",
              "displayName": "applicantId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        -176,
        -48
      ],
      "id": "b205a729-2036-4cfe-992a-4586319c4909",
      "name": "Call 'Stage B'",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "PJsMvbzfvLkIZ8En",
          "mode": "list",
          "cachedResultUrl": "/workflow/PJsMvbzfvLkIZ8En",
          "cachedResultName": "Stage A"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "applicantId": "={{ $('Select rows from a table').item.json.applicant_id }}"
          },
          "matchingColumns": [
            "applicantId"
          ],
          "schema": [
            {
              "id": "applicantId",
              "displayName": "applicantId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        -176,
        -240
      ],
      "id": "a30dac8d-bcd3-4775-8fea-a44e3693a66a",
      "name": "Call 'Stage C'1"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "ZlduEt4x0sSKkKah",
          "mode": "list",
          "cachedResultUrl": "/workflow/ZlduEt4x0sSKkKah",
          "cachedResultName": "Stage D"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "applicantId": "={{ $('Select rows from a table').item.json.applicant_id }}"
          },
          "matchingColumns": [
            "applicantId"
          ],
          "schema": [
            {
              "id": "applicantId",
              "displayName": "applicantId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        -176,
        304
      ],
      "id": "9e3216dd-51f8-4b5c-9ad1-fc80a4edc643",
      "name": "Call 'Stage D'"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "ZbS9ktl0bZTOXlJS",
          "mode": "list",
          "cachedResultUrl": "/workflow/ZbS9ktl0bZTOXlJS",
          "cachedResultName": "Stage C"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "applicantId": "={{ $('Select rows from a table').item.json.applicant_id }}"
          },
          "matchingColumns": [
            "applicantId"
          ],
          "schema": [
            {
              "id": "applicantId",
              "displayName": "applicantId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        -176,
        144
      ],
      "id": "79815403-1de1-4133-a1da-6982173093e7",
      "name": "Call 'Stage C'"
    }
  ],
  "connections": {
    "Postgres Trigger": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Select rows from a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select rows from a table": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Call 'Stage C'1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Call 'Stage B'",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Call 'Stage C'",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Call 'Stage D'",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 4
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 5
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 6
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Set Stage Status to Processed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Stage Status to Processed": {
      "main": [
        [
          {
            "node": "Call 'Notify'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call 'Stage B'": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Call 'Stage C'1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call 'Stage D'": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Call 'Stage C'": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false,
    "timeSavedMode": "fixed",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "versionId": "54a188ce-7f13-406a-8624-5dd1e7aea2d3",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "lOZe5AyWwXODmx8J",
  "tags": []
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Stage Automation. Uses postgresTrigger, postgres. Event-driven trigger; 12 nodes.

Source: https://github.com/MuNuChapterHKN/HKrecruitment/blob/330e52cf6afdaaac8a3376ec0040df659acd1da1/n8n/workflows/main.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

FK2 - Auto Entity Extraction. Uses postgresTrigger, httpRequest, postgres. Event-driven trigger; 6 nodes.

Postgres Trigger, HTTP Request, Postgres
Data & Sheets

This workflow automatically detects completed orders in PostgreSQL and prepares them for AI-based post-purchase communication. It enriches each order with customer, product, and payment data, then gen

Postgres Trigger, Postgres, Agent +4
Data & Sheets

Reagendamiento_v2. Uses executeWorkflowTrigger, redis, httpRequest, n8n-nodes-evolution-api. Event-driven trigger; 89 nodes.

Execute Workflow Trigger, Redis, HTTP Request +3
Data & Sheets

This workflow acts as a junior finance research analyst for a UK boutique M&A or corporate finance team. It listens for Slack messages, classifies the request, gathers company or market data, and prod

HTTP Request, Google Drive, Google Docs +5
Data & Sheets

Agendamiento_v2. Uses n8n-nodes-evolution-api, redis, httpRequest, executeWorkflowTrigger. Event-driven trigger; 59 nodes.

N8N Nodes Evolution Api, Redis, HTTP Request +3