Manage AI agent chat sessions with timeouts, handoff, and webhooks
Ready for 3.0What this workflow does
This workflow has 18 nodes and runs when an HTTP POST request hits its webhook URL (plus 1 other trigger). It uses only n8n's built-in nodes.
How it runs
Trigger: When an HTTP POST request hits its webhook URL (plus 1 other trigger).
- Normalize Message Input (Code): runs custom JavaScript code
- Normalize Command Input (Code): runs custom JavaScript code
- Configure Session Parameters (Code): runs custom JavaScript code
- Route by Request Type (Switch): routes items into 2 branches
- Fetch Latest Session (Data table): get
- Fetch Session for Control (Data table): get
- Evaluate Session State (Code): runs custom JavaScript code
- Execute Session Command (Code): runs custom JavaScript code
- Route by Session Status (Switch): routes items into 7 branches
- Modify Session State (Data table): update
…plus 6 more steps. See the full node list below.
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (4)
- Webhook
n8n-nodes-base.webhook - Code
n8n-nodes-base.code - Data table
n8n-nodes-base.dataTable - Switch
n8n-nodes-base.switch
From the author
Quick overview This workflow exposes two webhooks that manage an AI agent’s session lifecycle in an n8n Data Table, including session creation, TTL-based expiration, pause/auto-resume, human handoff, manual resume, close, and optional message deduplication.…