Skip to main content

Webhook Request and Session ID (Memory)

The TellFlow mobile application always sends a session_id when sending a chat message to the webhook. In your n8n workflow, you should use this value as the conversation memory key; this ensures that each chat session maintains its own history.

Webhook Payload (Mobile → n8n)

Every message sent to your webhook URL includes the following fields:

FieldTypeDescription
session_idstringRequired. Session ID (UUID). Remains constant for the same chat session; new chat = new session_id.
messagestringMessage text entered by the user.
tool / tool_namestringSelected tool (optional).
modelstringSelected model parameter (optional).
file / audiomultipartIncluded file or audio file (optional).

Example (JSON):

{
"message": "Hello, what's the weather today?",
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

When using FormData (with file/audio), session_id and message are sent in the same way.

Using session_id as Memory in n8n

  • Extract session_id (or body.session_id) from the body in the webhook trigger.
  • Provide this value as the session / conversation / memory key in nodes that use conversation memory (AI Agent, Chat Model with memory, etc.).
  • This ensures:
    • Same session_id → Same chat history is used.
    • Different session_id → Different session, no overlap.

Example (n8n Expression)

  • Session ID (Memory Key): Use {{ $json.body.session_id }} or {{ $json.session_id }} (if the body is directly at the root) depending on your webhook node configuration.
  • Use this expression in the Chat Memory / Memory node or the AI Agent "Session Id" field.

Workflow Summary

  1. Webhook → Receives body.session_id and body.message.
  2. Memory / Chat History → Session Id = {{ $json.body.session_id }}.
  3. AI / LLM → Generates a response using this memory; the response is written back to the same session.

This way, when a user starts a "new chat" in the app, a new session_id is generated, and a new conversation history begins in n8n.