Maintaining Session Context in n8n Workflow

Hello everyone,

I’m currently working on an n8n workflow for a construction company, and I’m running into a challenge that I hope you can help me solve.

Workflow Overview:

  • Webhook Trigger:
    The process starts when a webhook from Telnyx (Phone# Provider) receives data from employees. This data includes the unit number and photos of the completed work.
  • Google Drive Integration:
    The workflow then checks Google Drive to see if there’s an existing folder for that specific unit. If the folder doesn’t exist, it creates one and saves the photos; if it does exist, the photos are added to the existing folder.
  • Data Requirements:
    Each submission includes multiple data points: unit number, materials used, jobsite status, photos, etc.

The Problem:

  • Session Context Issue:
    Every incoming text from Telnyx generates a new session ID. This means that when an employee sends the unit number followed by photos or additional details, each message is processed as a separate session. Without a shared session context, the workflow cannot correlate these messages to the correct unit folder on Google Drive.
  • Data Aggregation Challenge:
    I need to accumulate all relevant data within a set time frame (e.g., 2 minutes) before processing. However, since each message has its own session ID, the workflow loses the connection between related messages.

What I’ve Tried:

  • Experimenting with separate workflows to temporarily hold incoming data until the 2-minute window has passed.
  • Despite these efforts, the issue persists because every new message still creates a new session ID, breaking the desired continuity.

Requesting help

Has anyone encountered this problem or found a solution to:

  • Maintain session context across multiple webhook calls in n8n,
  • Aggregate data over a defined time period even when each message starts a new session,
  • Or implement any workarounds that allow combining incoming data before processing?

I would greatly appreciate any insights or suggestions on how to tackle this issue.

Thank you in advance for your help!

Best regards,