Upstash Redis Chat Memory
The Upstash Redis Chat Memory component lets you keep a record of chat messages in an Upstash Redis database. It’s useful when you want to remember past conversations or share chat history across different parts of your workflow.
How it Works
When you add this component to your dashboard, it connects to an Upstash Redis instance using the URL and token you provide in a credential. Each chat session is identified by a Session ID that you set in the component. The component then stores every message sent in that session and can pull them back later, so your chatbot or automation can remember what was said before.
Inputs
This component uses a credential of type Upstash API.
- First, create the credential in the Credentials section of Nappai.
- Then, select that credential in the component’s Credential field.
Input Fields
The following field is available to configure this component.
- Session ID: A unique identifier for the chat session. Use a different ID for each conversation you want to keep separate.
Outputs
- Memory: A
BaseChatMessageHistory
object that contains all messages for the specified session. You can feed this output into other components that need to read or write chat history.
Usage Example
-
Create the Upstash API credential
- Go to Credentials → Add Credential → Upstash API
- Enter your Index URL and Index Token.
-
Add the component to your workflow
- Drag the Upstash Redis Chat Memory component onto the canvas.
- In the Credential field, choose the credential you just created.
- Set a Session ID (e.g.,
customer-1234
). - Connect the component’s Memory output to a chatbot or any other component that needs chat history.
-
Run the workflow
- Each time the workflow runs, the component will fetch the existing messages for that session and add any new messages you send. The updated memory can then be used by downstream components.
Related Components
- Local Chat Memory – Stores chat history locally on the server.
- Vector Store Memory – Stores messages in a vector database for similarity search.
- Chat History Viewer – Displays the contents of a chat memory for debugging.
Tips and Best Practices
- Use a consistent naming convention for Session IDs (e.g.,
user-<id>
orchat-<timestamp>
). - Keep the Session ID short but unique to avoid accidental overwrites.
- If you need to share a conversation across multiple users, create a shared session ID and make sure the credential has the right permissions.
- Periodically back up your Redis data if you rely on it for critical business processes.
Security Considerations
- Store the Upstash API credential securely; it contains the token that grants access to your Redis instance.
- Do not expose the credential or Session ID in public dashboards or logs.
- Use role‑based access controls in Upstash to limit who can read or write to the database.