Skip to main content

Memory

The Memory system allows you to store and retrieve contextual information associated with identities. This enables assistants to maintain context across conversations and provide personalized experiences.

Get Memory

GET /memory/from/:identity_id

Retrieves all memory entries associated with a specific identity.
:identity_id
string
required
Identity unique identifier

Response

message
string
Success message
data
array
Array of memory entries

How Memory Works

The Memory system is automatically integrated with conversations:
  1. Automatic Storage - Important information from conversations is automatically stored
  2. Context Retrieval - Memory is retrieved when starting new conversations
  3. Personalization - Assistants use memory to provide personalized responses
  4. Cross-Channel - Memory persists across all channels (WhatsApp, web, etc.)

Memory Access in Conversations

When an identity sends a message, the system automatically:
  • Retrieves relevant memory entries
  • Includes them in the conversation context
  • Updates memory based on new information

Memory Keys

Memory entries use keys to organize information. Common patterns:
  • preferences.* - User preferences (e.g., preferences.language, preferences.timezone)
  • profile.* - Profile information (e.g., profile.name, profile.email)
  • history.* - Historical data (e.g., history.last_order, history.purchases)
  • custom.* - Custom application data

Examples

Get Memory

curl -X GET https://api.plati.ai/memory/from/user_12345 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

{
  "message": "Memory retrieved successfully",
  "data": [
    {
      "key": "preferences.language",
      "value": "pt-BR",
      "metadata": {
        "source": "conversation",
        "confidence": 0.95
      },
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-20T14:22:00Z"
    },
    {
      "key": "profile.name",
      "value": "John Doe",
      "metadata": {},
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    }
  ]
}

Memory in Prompts

You can reference memory in assistant instructions using template syntax:
You are a helpful assistant. The user's name is {{memory.profile.name}} 
and they prefer {{memory.preferences.language}}.
See Prompt Engineering for more details.

Best Practices

  • Use Descriptive Keys - Use clear, hierarchical keys (e.g., profile.email not email)
  • Store Structured Data - Use objects for complex data
  • Keep It Relevant - Only store information that improves conversations
  • Respect Privacy - Don’t store sensitive data without consent

Next Steps