Stateful Session Manager for Long-Running Asynchronous Processes - n8n Workflow

Use this advanced n8n workflow pattern to manage long-running asynchronous processes. Implement checkpoints using the Wait n8n node and persistent state management using static data.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Markdown-formatted text:
Advanced n8n Developers: Users who need to manage complex, multi-day, or human-in-the-loop automations.
System Architects: Professionals designing robust process flows that rely on external feedback or time delays.


  • Automation Specialists: Anyone looking for powerful n8n templates to handle session continuity across multiple executions.

Overview

Managing long-running processes in automation platforms like n8n can be challenging, especially when a workflow needs to pause (e.g., waiting for human approval or an external API callback) and then resume later with new data. The provided n8n workflow, known as the 'Teleport Pattern,' solves this by creating a dedicated state management system.

This system leverages the Wait n8n node to create 'Checkpoints' where the main process is physically paused and persisted. A separate 'Async Portal' workflow manages the session state using n8n's persistent static data feature. When a new event arrives for an existing session, the Portal instantly 'teleports' the data to the correct, paused execution via its unique resume URL, allowing the original n8n workflow to continue exactly where it left off. This ensures session continuity and reliable asynchronous processing.

How it Works

Markdown-formatted text:


  1. Initial Activation (Main Process): The n8n workflow starts via a Manual Trigger or an initial n8n trigger (like a Webhook).

  2. State Registration: The Main Process executes a sub-workflow call to the Async Portal, passing a unique sessionid and the resumeurl of the first upcoming Wait n8n node.

  3. State Check (Portal): The Portal's Code n8n node (B. Check if Session is New or Existing) checks the workflow's static data for the sessionid.

  4. New Session Path: If the session is new, the Portal registers the sessionid and the resumeurl and returns the initial data. The Main Process receives this, runs its initial logic, and then pauses at its first Checkpoint (4. PAUSE at Checkpoint 1).

  5. Existing Session (Teleport) Path: If a new activation comes in for an existing sessionid, the Portal detects this, retrieves the stored resume_url, and uses an HTTP Request n8n node (D. TELEPORT) to POST the new input data directly to that URL.

  6. Resumption: The HTTP request wakes up the paused Wait n8n node in the original Main Process execution, which resumes and processes the 'teleported' data. The workflow continues to the next checkpoint or completion.

Installation Guide

Markdown-formatted text:


  1. Import: Copy the provided n8n workflow JSON and import it into your n8n instance.

  2. Self-Reference: Since this n8n workflow template uses an Execute Workflow n8n node (2. Call Async Portal) to call itself (acting as the Portal), ensure the workflow ID configured in that node points to the current workflow ID once imported.

  3. Testing: The documentation includes a detailed testing guide. You must execute the manual trigger multiple times in separate browser tabs to simulate the asynchronous resumption process and observe the power of this n8n workflow in action.

  4. No Credentials: This specific n8n workflow does not require external credentials, but any nodes you replace (like external APIs) will require standard n8n setup.

Node Details

Markdown-formatted text:
A. Entry: Receive Session Info (Execute Workflow Trigger): Acts as the entry point for the Async Portal. It receives critical parameters like sessionid, resumeurl, workflowid, and inputitems from the caller.
B. Check if Session is New or Existing (Code n8n node): The core persistence engine. It uses $getWorkflowStaticData('global') to read and write the state of active sessions, ensuring that session data persists across multiple n8n trigger executions.
C. Route Based on Session State (IF n8n node): Determines the flow: if new: false (existing session), it proceeds to teleport; otherwise, it passes through to start the main logic.
D. TELEPORT: Resume Paused Workflow (HTTP Request n8n node): This crucial step uses the dynamically obtained resume_url to make a POST request, effectively forcing the paused Wait n8n node in the other execution to resume.
4. PAUSE at Checkpoint 1 & 6. PAUSE at Checkpoint 2 (Wait n8n node): These nodes pause the execution and generate the unique, temporary webhook URL required for resumption. Checkpoint 1 is configured to send data back upon resumption, demonstrating two-way communication.
9368010f-f32c-43fc-bac1-e90d193ffca4 (Execute Workflow n8n node): This is the bridge. It calls the 'Async Portal' workflow and is set to 'Wait for Sub-Workflow' to receive the state check result before deciding to continue or pause.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

Featured*