Overview
This node manages chat sessions for Symbiosika by storing, retrieving, and deleting session data identified by a unique Session ID. It is useful in scenarios where you need to maintain state or context across multiple interactions in a chat application, such as tracking user conversations or session-specific data.
Practical examples include:
- Storing a chat session with an associated Chat ID when a new conversation starts.
- Retrieving session details to continue a conversation or validate session validity based on duration.
- Deleting a session when it is no longer needed or has expired.
Properties
Name | Meaning |
---|---|
Session ID | A unique identifier for this chat session. |
Output
The node outputs JSON objects that extend the input data with session operation results. The structure varies depending on the operation:
- Delete Session operation output includes:
operation
: Always"deleted"
.existed
: Boolean indicating if the session existed before deletion.
Example output JSON for delete operation:
{
"operation": "deleted",
"existed": true
}
No binary data is produced by this node.
Dependencies
- This node uses an internal in-memory Map object to store session data during runtime.
- No external services or API keys are required.
- Sessions are stored only temporarily in memory and will be lost if the node or workflow restarts.
Troubleshooting
- Missing Session ID: If the Session ID is not provided, the node throws an error stating "No session ID provided".
- Session Not Found: For retrieval or deletion, if the session does not exist, the node indicates this in the output (
not_found
for get,existed: false
for delete). - Session Expired: When retrieving a session, if the last used time exceeds the specified session duration, the session is deleted and marked as expired.
- Since sessions are stored in memory, restarting n8n or the workflow will clear all stored sessions, which might cause unexpected "not found" or "expired" results.
Links and References
- n8n Documentation – General information about creating and using custom nodes.
- JavaScript Map Object – Explanation of the Map used for session storage.