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": "Agent Session Startup",
"nodes": [
{
"parameters": {
"path": "session-startup",
"httpMethod": "GET",
"responseMode": "responseNode",
"authentication": "none",
"responseData": "allEntries",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-448,
-16
],
"id": "webhook-1",
"name": "Webhook"
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT qryName, qrySQL FROM api_wf.AISql WHERE category = 'n8n-startup' ORDER BY qryName",
"options": {}
},
"type": "n8n-nodes-base.mySql",
"typeVersion": 2.5,
"position": [
-224,
-304
],
"id": "load-queries",
"name": "Load Startup Queries",
"credentials": {
"mySql": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Get all query items from the database\nconst queries = $input.all();\n\n// Log for debugging\nconsole.log('Input queries:', queries.length);\n\n// Return each query as a separate item for processing\nconst result = [];\nfor (let i = 0; i < queries.length; i++) {\n const item = queries[i];\n result.push({\n json: {\n query: item.json.qrySQL,\n queryName: item.json.qryName,\n index: i + 1,\n agent: 'session-startup',\n params: {}\n }\n });\n}\n\nconsole.log('Returning items:', result.length);\nreturn result;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
0,
-304
],
"id": "prepare-queries",
"name": "Prepare Queries"
},
{
"parameters": {
"url": "http://host.docker.internal:5678/webhook/adhoc-query",
"method": "POST",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "query",
"value": "={{ $json.query }}"
},
{
"name": "agent",
"value": "={{ $json.agent }}"
},
{
"name": "params",
"value": "{}"
}
]
},
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
224,
-304
],
"id": "run-queries",
"name": "Run Queries"
},
{
"parameters": {
"jsCode": "// Handle the HTTP response data safely\nconst results = $input.all();\nconsole.log('Format Output received:', results.length, 'items');\n\n// Extract query results, handling errors gracefully\nconst queryResults = results.map((item, index) => {\n console.log(`Item ${index}:`, Object.keys(item.json || {}));\n \n if (item.json && item.json.results && item.json.results.data) {\n return {\n queryName: `query${index + 1}`,\n success: true,\n data: item.json.results.data\n };\n } else {\n return {\n queryName: `query${index + 1}`,\n success: false,\n error: item.json ? (item.json.error || 'No results') : 'No response',\n data: []\n };\n }\n});\n\nreturn [{ \n json: { \n session_context: {\n queries: queryResults,\n timestamp: new Date().toISOString(),\n total_queries: queryResults.length,\n successful_queries: queryResults.filter(q => q.success).length\n }\n } \n}];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
448,
-304
],
"id": "format-output",
"name": "Format Output"
},
{
"parameters": {
"respondWith": "allIncomingItems"
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.5,
"position": [
672,
-304
],
"id": "respond",
"name": "Respond to Webhook"
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Load Startup Queries",
"type": "main",
"index": 0
}
]
]
},
"Load Startup Queries": {
"main": [
[
{
"node": "Prepare Queries",
"type": "main",
"index": 0
}
]
]
},
"Prepare Queries": {
"main": [
[
{
"node": "Run Queries",
"type": "main",
"index": 0
}
]
]
},
"Run Queries": {
"main": [
[
{
"node": "Format Output",
"type": "main",
"index": 0
}
]
]
},
"Format Output": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"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.
mySql
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Agent Session Startup. Uses mySql, httpRequest, respondToWebhook. Webhook trigger; 6 nodes.
Source: https://github.com/pchambless/wf-monorepo/blob/47cd16469735c59a12b7c76e2552861f899e335d/.n8n/workflows/agent-session-startup.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.
Sourcing_Multi_Agent_After_Articles_Discovery_Pipeline. Uses mySql, emailSend, chainLlm, outputParserStructured. Webhook trigger; 49 nodes.
Sourcing_Multi_Agent_After_Articles_Discovery_Pipeline. Uses mySql, emailSend, chainLlm, outputParserStructured. Webhook trigger; 49 nodes.
cji102_chatbot. Uses httpRequest, mySql, agent, lmChatGoogleGemini. Webhook trigger; 20 nodes.
Jigsaw API key for image processing, I use this as a gatekeeper/second pair of eyes. LINK to their website https://jigsawstack.com/ SECOND A postgress DATABASE (I use Supabase) LlamaCloud for the pars
W1 - IN WhatsApp Adapter (Secure + Fast ACK). Uses postgres, redis, httpRequest. Webhook trigger; 48 nodes.