Bring memory to a local or custom chatbot.

Your application backend can save source messages and retrieve relevant context over the integration API. Preserve your own short term conversation history.

Minimal example

Use these values on a trusted local machine or server. Keep project credentials out of browser code.

typescript
const headers = {
  Authorization: `Bearer ${process.env.MEMORA_API_KEY}`, // Set MEMORA_API_KEY=YOUR_PROJECT_API_KEY locally.
  "Content-Type": "application/json",
};
// Single-user personal connection:
const subject_id = "YOUR_SUBJECT_ID";
// Multi-user app: use each authenticated user’s stable ID instead.

await fetch(`${process.env.MEMORA_API_URL}/v1/integrations/messages`, {
  method: "POST", headers,
  body: JSON.stringify({ subject_id, conversation_id, idempotency_key, content: userMessage }),
});

const response = await fetch(`${process.env.MEMORA_API_URL}/v1/integrations/memories/search`, {
  method: "POST", headers,
  body: JSON.stringify({ subject_id, query: userMessage }),
});
const result = await response.json();
const memoryContext = result.has_relevant_memories ? result.context : "";

Check that it works

  1. Send a message and note its response/source ID for debugging.
  2. Allow the asynchronous processing and indexing steps to complete.
  3. Search again using the same subject and namespace.
  4. Use returned evidence and relevant context when building the next model prompt.

MAKE CONTEXT CARRY FORWARD

Continue with the product docs.

Learn the memory model, API configuration, lifecycle, and troubleshooting.

Get started