Templates / Manage AI agent chat sessions with timeouts, handoff, and webhooks

Manage AI agent chat sessions with timeouts, handoff, and webhooks

Ready for 3.0

by Paulina Urbina ✓ · 9 views · created 2026-08-31 · Support Chatbot, AI Chatbot

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What 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).

  1. Normalize Message Input (Code): runs custom JavaScript code
  2. Normalize Command Input (Code): runs custom JavaScript code
  3. Configure Session Parameters (Code): runs custom JavaScript code
  4. Route by Request Type (Switch): routes items into 2 branches
  5. Fetch Latest Session (Data table): get
  6. Fetch Session for Control (Data table): get
  7. Evaluate Session State (Code): runs custom JavaScript code
  8. Execute Session Command (Code): runs custom JavaScript code
  9. Route by Session Status (Switch): routes items into 7 branches
  10. 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)

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.…

Excerpt from Paulina Urbina's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.