FloorMemory JavaScript SDK (Node.js + Browser Example)#
The FloorMemory JavaScript SDK allows you to integrate FloorMemory (xfloorβs conversational memory platform) into Node.js services and browser applications.Run context-aware, multi-turn conversational queries
Store posts, notes, documents, and structured knowledge into Floors
Retrieve recent activity feeds
Fetch floor metadata for UI rendering and permissions
Call authentication and identity APIs when required
The SDK exposes capability-based API classes such as:β οΈ Important
Use named imports only. There is no default export.
Each capability must be accessed via its dedicated API class.
Source Code#
Official SDK Repository#
Production Examples (Recommended)#
The examples repository contains:Clean Node.js backend integrations
Browser-safe usage patterns
Multi-turn conversational examples
Structured event ingestion templates
Production-safe configuration patterns
If you're building a real application, start there.
Installation#
Importing the SDK#
Authentication & Setup (Required)#
All FloorMemory APIs use Bearer Token authentication.Authentication is configured once on a shared ApiClient instance and reused across all API classes.
Key Points#
Sent as:
Authorization: Bearer <XFLOOR_API_KEY>
Shared across all API classes
Do not configure per request
Do not embed tokens in payloads
2οΈβ£ app_id Is NOT Global (Critical Detail)#
app_id must be passed explicitly per API call.It is never globally configured.
Common Parameter Glossary#
| Parameter | Meaning |
|---|
user_id | Unique xfloor user identifier. Enables personalization and conversation continuity. |
app_id | Calling application identifier. |
floor_id / floor_ids | Identifies which Floor(s) to read from or write to. |
block_id | Block container inside a floor. |
block_type | Content category (e.g., post, forum). |
Flags ("0" / "1") | Some booleans are string-encoded (summary_needed: "1"). |
Conversational Query (Primary API)#
Endpoint: POST /agent/memory/query
Designed for multi-turn conversational retrieval across Floors.
Example (Node.js Backend)#
What Makes This βMemory-Awareβ?#
Same user_id β conversation continuity
Supports follow-up questions
Can return summarized responses
Can include metadata sources
Add Content to a Floor (Create Event)#
Endpoint: POST /api/memory/events
Content-Type: multipart/form-data
Ingestion model: Asynchronous
200 OK means accepted and queued, not immediately searchable.
Request Structure (inputInfo)#
inputInfo must be a stringified JSON object.| Field | Type | Required | Description |
|---|
floor_id | string | β
| Target floor |
block_id | string | β
| Block container |
block_type | string | β
| Category (post, forum) |
user_id | string | β
| Author |
title | string | Optional | Title |
description | string | β
| Main content |
Example (Text-Only Event)#
Retrieve Recent Activity (Feed)#
Use this to confirm ingestion if your application requires deterministic behavior.
Returns metadata only (no embeddings, no content body retrieval).
Edit Floor (Owner Only)#
Complete Client-Side Example (Browser Application)#
Below is a safe browser pattern using Promises.
Error Handling Pattern#
Configure authentication once at startup
Do not recreate ApiClient per request
Poll feed if ingestion visibility is required
Keep user_id stable for conversation continuity
Never embed app_id inside inputInfo
Using the Official Examples Repository#
A Node.js backend (Express / Fastify)
A browser-based dashboard
An AI agent with conversational memory
A production ingestion pipeline
The examples repository reflects:Real-world usage patterns
Correct parameter placement
Clean separation of auth and payload
Deterministic event ingestion flows
Multi-floor conversational design
Where to Go Next#
π Core FloorMemory APIs
Modified atΒ 2026-02-19 05:01:26