AutomationFlowsData & Sheets › Combined Context Management Example

Combined Context Management Example

Combined Context Management Example. Uses start, n8n-nodes-postgres-context. Manual trigger; 6 nodes.

Manual trigger★★★★☆ complexity6 nodesStartN8N Nodes Postgres Context
Data & Sheets Trigger: Manual Nodes: 6 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": "Combined Context Management Example",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "mode": "save",
        "chatId": "chat-123",
        "contextKey": "user-profile",
        "contextType": "user",
        "contextValue": "{\"name\":\"John Doe\",\"email\":\"john@example.com\",\"preferences\":{\"language\":\"pt-BR\",\"theme\":\"dark\"}}",
        "userId": "user-456",
        "sessionKey": "session-abc",
        "connectionString": "postgresql://username:password@localhost:5432/database"
      },
      "name": "Save User Profile",
      "type": "n8n-nodes-postgres-context.externalContext",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "mode": "save",
        "chatId": "chat-123",
        "contextKey": "agent-config",
        "contextType": "agent",
        "contextValue": "{\"name\":\"Support Agent\",\"capabilities\":[\"customer-service\",\"technical-support\"],\"language\":\"pt-BR\"}",
        "agentId": "agent-789",
        "sessionKey": "session-abc",
        "connectionString": "postgresql://username:password@localhost:5432/database"
      },
      "name": "Save Agent Config",
      "type": "n8n-nodes-postgres-context.externalContext",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "mode": "save",
        "chatId": "chat-123",
        "contextKey": "weather-forecast",
        "contextType": "api",
        "contextValue": "{\"city\":\"Arraial do Cabo\",\"temperature\":\"27\u00b0C\",\"status\":\"Ensolarado\"}",
        "sessionKey": "session-abc",
        "connectionString": "postgresql://username:password@localhost:5432/database"
      },
      "name": "Save Weather API Data",
      "type": "n8n-nodes-postgres-context.externalContext",
      "typeVersion": 1,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "chat-123",
        "alwaysInclude": [
          "api"
        ],
        "limitsPerType": {
          "limits": [
            {
              "type": "user",
              "limit": 5
            },
            {
              "type": "agent",
              "limit": 3
            }
          ]
        },
        "connectionString": "postgresql://username:password@localhost:5432/database"
      },
      "name": "Retrieve All Contexts",
      "type": "n8n-nodes-postgres-context.contextManager",
      "typeVersion": 1,
      "position": [
        1120,
        300
      ]
    },
    {
      "parameters": {
        "content": "=JSON.stringify($json.contexts, null, 2)",
        "height": 400,
        "width": 400
      },
      "name": "Display All Contexts",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1340,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Save User Profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save User Profile": {
      "main": [
        [
          {
            "node": "Save Agent Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Agent Config": {
      "main": [
        [
          {
            "node": "Save Weather API Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Weather API Data": {
      "main": [
        [
          {
            "node": "Retrieve All Contexts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve All Contexts": {
      "main": [
        [
          {
            "node": "Display All Contexts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "",
  "id": "4",
  "tags": [
    {
      "name": "example",
      "createdAt": "2023-01-01T00:00:00.000Z",
      "updatedAt": "2023-01-01T00:00:00.000Z"
    },
    {
      "name": "context",
      "createdAt": "2023-01-01T00:00:00.000Z",
      "updatedAt": "2023-01-01T00:00:00.000Z"
    }
  ]
}
Pro

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

About this workflow

Combined Context Management Example. Uses start, n8n-nodes-postgres-context. Manual trigger; 6 nodes.

Source: https://github.com/aronpc/n8n-nodes-postgres-context/blob/a7689e84a3e7f341110bb33b4e707dfda2a1100e/examples/Combined_Example.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

Traduzir Dados da Obra e Preparar para Supabase. Uses start, httpRequest. Manual trigger; 11 nodes.

Start, HTTP Request
Data & Sheets

External Integrations Workflow. Uses start, httpRequest, mongoDb, postgres. Manual trigger; 9 nodes.

Start, HTTP Request, MongoDB +4
Data & Sheets

DomFasad Product Scraper. Uses start, httpRequest, postgres. Manual trigger; 9 nodes.

Start, HTTP Request, Postgres
Data & Sheets

Postgres: insert update executeQuery. Uses start, postgres. Manual trigger; 7 nodes.

Start, Postgres
Data & Sheets

Filter incoming emails via IMAP, extract & clean the body into plain text, normalize (title/slug/snippet/date/from/url), check for duplicates in Postgres, store as a row in a Notion database, then sen

Email Read Imap, Postgres, Notion +1